"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "gui/about.py" between
relax-4.1.3.src.tar.bz2 and relax-5.0.0.src.tar.bz2

About: relax allows the study of molecular dynamics through the analysis of experimental NMR data. Organic molecules, proteins, RNA, DNA, sugars, and other biomolecules are all supported.

about.py  (relax-4.1.3.src.tar.bz2):about.py  (relax-5.0.0.src.tar.bz2)
############################################################################### ###############################################################################
# # # #
# Copyright (C) 2009 Michael Bieri # # Copyright (C) 2009 Michael Bieri #
# Copyright (C) 2010-2012 Edward d'Auvergne # # Copyright (C) 2010-2012,2019 Edward d'Auvergne #
# # # #
# This file is part of the program relax (http://www.nmr-relax.com). # # This file is part of the program relax (http://www.nmr-relax.com). #
# # # #
# This program is free software: you can redistribute it and/or modify # # This program is free software: you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by # # it under the terms of the GNU General Public License as published by #
# the Free Software Foundation, either version 3 of the License, or # # the Free Software Foundation, either version 3 of the License, or #
# (at your option) any later version. # # (at your option) any later version. #
# # # #
# This program is distributed in the hope that it will be useful, # # This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of # # but WITHOUT ANY WARRANTY; without even the implied warranty of #
skipping to change at line 32 skipping to change at line 32
# Python module imports. # Python module imports.
from copy import deepcopy from copy import deepcopy
from numpy import zeros from numpy import zeros
import webbrowser import webbrowser
import wx import wx
import wx.html import wx.html
from wx.lib.wordwrap import wordwrap from wx.lib.wordwrap import wordwrap
# relax module imports. # relax module imports.
import dep_check
from graphics import IMAGE_PATH from graphics import IMAGE_PATH
from gui.fonts import font from gui.fonts import font
from gui.icons import Relax_icons from gui.icons import Relax_icons
from info import Info_box from info import Info_box
from status import Status; status = Status() from status import Status; status = Status()
class About_base(wx.Frame): class About_base(wx.Frame):
"""The about dialog base class.""" """The about dialog base class."""
# The background colour (gradient if second colour is given). # The background colour (gradient if second colour is given).
skipping to change at line 113 skipping to change at line 114
# Draw everything. # Draw everything.
self.window.Bind(wx.EVT_PAINT, self.generate) self.window.Bind(wx.EVT_PAINT, self.generate)
# Let the dialog be closable with a left button click. # Let the dialog be closable with a left button click.
self.window.Bind(wx.EVT_MOTION, self.cursor_style) self.window.Bind(wx.EVT_MOTION, self.cursor_style)
# Let the dialog be closable with a left button click. # Let the dialog be closable with a left button click.
self.window.Bind(wx.EVT_LEFT_DOWN, self.process_click) self.window.Bind(wx.EVT_LEFT_DOWN, self.process_click)
# Center Window # Center Window
self.Centre() if status.show_gui:
self.Centre()
def add_html(self, text): def add_html(self, text):
"""Add the given HTML text to the DC. """Add the given HTML text to the DC.
@param text: The HTML text. @param text: The HTML text.
@type text: str @type text: str
""" """
# The HTML renderer. # The HTML renderer.
self.html = wx.html.HtmlDCRenderer() self.html = wx.html.HtmlDCRenderer()
skipping to change at line 148 skipping to change at line 150
self.html.Render(self.border, self.border, known_pagebreaks=[]) self.html.Render(self.border, self.border, known_pagebreaks=[])
def build_widget(self): def build_widget(self):
"""Dummy widget building method.""" """Dummy widget building method."""
def create_buffered_dc(self): def create_buffered_dc(self):
"""Build the buffered dc containing the window contents.""" """Build the buffered dc containing the window contents."""
# The buffer for buffered drawing (work around for a GTK bug, the bitmap must be square!!!). # The buffer for buffered drawing (work around for a GTK bug, the bitmap must be square!!!).
size = max(self.virt_x, self.virt_y) size = max(self.virt_x, self.virt_y)
self.buffer = wx.EmptyBitmap(size, size) if dep_check.wx_classic:
self.buffer = wx.EmptyBitmap(size, size)
else:
self.buffer = wx.Bitmap(size, size)
# Create the device context. # Create the device context.
self.dc = wx.BufferedDC(None, self.buffer) self.dc = wx.BufferedDC(None, self.buffer)
# Set a background. # Set a background.
self.set_background() self.set_background()
# Debugging lines. # Debugging lines.
if status.debug: if status.debug:
# Set the font. # Set the font.
self.dc.SetFont(wx.Font(8, wx.FONTFAMILY_SCRIPT, wx.NORMAL, wx.NORMA L)) self.dc.SetFont(wx.Font(8, wx.FONTFAMILY_SCRIPT, wx.NORMAL, wx.NORMA L))
# The virtual size. # The virtual size.
self.dc.DrawText("Virt size: %sx%s" % (self.virt_x, self.virt_y), 2, 2) self.dc.DrawText("Virt size: %sx%s" % (self.virt_x, self.virt_y), 2, 2)
# Cross. # Cross.
self.dc.DrawLine(0, 0, self.virt_x, self.virt_y) self.dc.DrawLine(0, 0, self.virt_x, self.virt_y)
self.dc.DrawLine(self.virt_x, 0, 0, self.virt_y) self.dc.DrawLine(self.virt_x, 0, 0, self.virt_y)
# Lines every 100 pixels. # Lines every 100 pixels.
num = self.virt_y / 100 num = int(self.virt_y / 100)
for i in range(num+1): for i in range(num+1):
pos = i * 100 pos = i * 100
self.dc.DrawLine(0, pos, self.virt_x, pos) self.dc.DrawLine(0, pos, self.virt_x, pos)
self.dc.DrawText(str(pos), self.virt_x-40, pos-10) self.dc.DrawText(str(pos), self.virt_x-40, pos-10)
# Build the rest of the about widget. # Build the rest of the about widget.
self.build_widget() self.build_widget()
# Re-calculate the virtual size, and reset the offset. # Re-calculate the virtual size, and reset the offset.
self.virt_y = self.offset() self.virt_y = self.offset()
self.offset(-self.virt_y) self.offset(-self.virt_y)
# Finish. # Finish.
self.dc.EndDrawing() if dep_check.wx_classic:
self.dc.EndDrawing()
def cursor_style(self, event): def cursor_style(self, event):
"""Change the mouse cursor when over the url.""" """Change the mouse cursor when over the url."""
# Determine the mouse position. # Determine the mouse position.
x = event.GetX() x = event.GetX()
y = event.GetY() y = event.GetY()
# Scrolling. # Scrolling.
y = y + self.window.GetViewStart()[1]*self.SCROLL_RATE y = y + self.window.GetViewStart()[1]*self.SCROLL_RATE
# Selection cursor. # Selection cursor.
over_url = False over_url = False
for i in range(len(self.url_pos)): for i in range(len(self.url_pos)):
if x > self.url_pos[i][0, 0] and x < self.url_pos[i][0, 1] and y > s elf.url_pos[i][1, 0] and y < self.url_pos[i][1, 1]: if x > self.url_pos[i][0, 0] and x < self.url_pos[i][0, 1] and y > s elf.url_pos[i][1, 0] and y < self.url_pos[i][1, 1]:
over_url = True over_url = True
# Only change if needed. # Only change if needed.
if over_url and self.cursor_type == 'normal': if over_url and self.cursor_type == 'normal':
# Build the cursor. # Build the cursor.
select_cursor = wx.StockCursor(wx.CURSOR_HAND) if dep_check.wx_classic:
select_cursor = wx.StockCursor(wx.CURSOR_HAND)
else:
select_cursor = wx.Cursor(wx.CURSOR_HAND)
# Set the cursor. # Set the cursor.
self.window.SetCursor(select_cursor) self.window.SetCursor(select_cursor)
# Reset the cursor type. # Reset the cursor type.
self.cursor_type = 'select' self.cursor_type = 'select'
# Normal cursor. # Normal cursor.
if not over_url and self.cursor_type == 'select': if not over_url and self.cursor_type == 'select':
# Build the cursor. # Build the cursor.
select_cursor = wx.StockCursor(wx.CURSOR_ARROW) if dep_check.wx_classic:
select_cursor = wx.StockCursor(wx.CURSOR_ARROW)
else:
select_cursor = wx.Cursor(wx.CURSOR_ARROW)
# Set the cursor. # Set the cursor.
self.window.SetCursor(select_cursor) self.window.SetCursor(select_cursor)
# Reset the cursor type. # Reset the cursor type.
self.cursor_type = 'normal' self.cursor_type = 'normal'
def draw_url(self, url_text=None, pos_x=0, carriage_ret=False, centre=False) : def draw_url(self, url_text=None, pos_x=0, carriage_ret=False, centre=False) :
"""Draw a URL as a hyperlink. """Draw a URL as a hyperlink.
 End of changes. 8 change blocks. 
7 lines changed or deleted 19 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)