"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "gui/relax_gui.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.

relax_gui.py  (relax-4.1.3.src.tar.bz2):relax_gui.py  (relax-5.0.0.src.tar.bz2)
############################################################################### ###############################################################################
# # # #
# Copyright (C) 2009-2011 Michael Bieri # # Copyright (C) 2009-2011 Michael Bieri #
# Copyright (C) 2009-2014 Edward d'Auvergne # # Copyright (C) 2009-2014,2019 Edward d'Auvergne #
# Copyright (C) 2016 Troels Schwarz-Linnet # # Copyright (C) 2016 Troels Schwarz-Linnet #
# # # #
# 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, #
skipping to change at line 33 skipping to change at line 33
# Module docstring. # Module docstring.
"""Main module for the relax graphical user interface.""" """Main module for the relax graphical user interface."""
# Python module imports. # Python module imports.
from os import F_OK, access, getcwd, sep from os import F_OK, access, getcwd, sep
import platform import platform
from re import search from re import search
import sys import sys
from time import sleep from time import sleep
from warnings import warn
import webbrowser import webbrowser
import wx import wx
# relax module imports. # relax module imports.
from data_store import Relax_data_store; ds = Relax_data_store() from data_store import Relax_data_store; ds = Relax_data_store()
from data_store.gui import Gui from data_store.gui import Gui
import dep_check
from graphics import IMAGE_PATH, fetch_icon from graphics import IMAGE_PATH, fetch_icon
from gui.about import About_relax from gui.about import About_relax
from gui.analyses import Analysis_controller from gui.analyses import Analysis_controller
from gui.spin_viewer.frame import Spin_view_window from gui.spin_viewer.frame import Spin_view_window
from gui.controller import Controller from gui.controller import Controller
from gui.export_bmrb import Export_bmrb_window from gui.export_bmrb import Export_bmrb_window
from gui.filedialog import RelaxDirDialog, RelaxFileDialog from gui.filedialog import RelaxDirDialog, RelaxFileDialog
from gui.fonts import font from gui.fonts import font
from gui.icons import Relax_icons from gui.icons import Relax_icons
from gui.interpreter import Interpreter from gui.interpreter import Interpreter
skipping to change at line 61 skipping to change at line 63
from gui.misc import bitmap_setup, gui_raise, open_file, protected_exec from gui.misc import bitmap_setup, gui_raise, open_file, protected_exec
from gui.pipe_editor import Pipe_editor from gui.pipe_editor import Pipe_editor
from gui.references import References from gui.references import References
from gui.relax_prompt import Prompt from gui.relax_prompt import Prompt
from gui.results_viewer import Results_viewer from gui.results_viewer import Results_viewer
from gui.components.free_file_format import Free_file_format_window from gui.components.free_file_format import Free_file_format_window
from gui.string_conv import gui_to_str from gui.string_conv import gui_to_str
from gui.uf_objects import Uf_storage; uf_store = Uf_storage() from gui.uf_objects import Uf_storage; uf_store = Uf_storage()
from info import Info_box from info import Info_box
from lib.errors import RelaxNoPipeError from lib.errors import RelaxNoPipeError
from lib.warnings import RelaxWarning
from lib.io import io_streams_restore from lib.io import io_streams_restore
from pipe_control import state from pipe_control import state
from pipe_control.pipes import cdp_name from pipe_control.pipes import cdp_name
from pipe_control.reset import reset from pipe_control.reset import reset
from pipe_control.system import pwd from pipe_control.system import pwd
from status import Status; status = Status() from status import Status; status = Status()
from version import version from version import version
# wx IDs for the toolbar. # wx IDs for the toolbar.
TB_FILE_NEW = wx.NewId() TB_FILE_NEW = wx.NewId()
skipping to change at line 262 skipping to change at line 265
def add_start_screen(self): def add_start_screen(self):
"""Create a start screen for the main window when no analyses exist.""" """Create a start screen for the main window when no analyses exist."""
# The sizer for the main GUI window. # The sizer for the main GUI window.
sizer = wx.BoxSizer(wx.VERTICAL) sizer = wx.BoxSizer(wx.VERTICAL)
self.SetSizer(sizer) self.SetSizer(sizer)
# The relax icon. # The relax icon.
image = wx.StaticBitmap(self, -1, bitmap_setup(IMAGE_PATH+'ulysses_shado wless_400x168.png')) image = wx.StaticBitmap(self, -1, bitmap_setup(IMAGE_PATH+'ulysses_shado wless_400x168.png'))
# Add the icon to the main spacer with spacing.
sizer.AddStretchSpacer() sizer.AddStretchSpacer()
sizer.Add(image, 0, wx.ALIGN_CENTER_HORIZONTAL, 0) sizer.Add(image, 0, wx.ALIGN_CENTER_HORIZONTAL, 0)
sizer.AddStretchSpacer() sizer.AddStretchSpacer()
# wxPython-Phoenix instability warning text.
if not dep_check.wx_stable:
text = [
"wxPython-Phoenix version %s.%s.%s detected." % (wx.VERSION[0],
wx.VERSION[1], wx.VERSION[2]),
"This version of Phoenix is not stable and relax support is expe
rimental.",
"Not all features of the GUI may be available or functional.",
"Please use wxPython \"Classic\" instead - otherwise use at your
own risk."
]
for i in range(len(text)):
element = wx.StaticText(self, -1, text[i])
element.SetFont(font.roman_font_18)
element.SetForegroundColour("red")
sizer.Add(element, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ADJUST_MINSI
ZE, 0)
sizer.AddStretchSpacer()
warn(RelaxWarning(" ".join(text)))
# Re-perform the layout of the GUI elements, and refresh. # Re-perform the layout of the GUI elements, and refresh.
self.Layout() self.Layout()
self.Refresh() self.Refresh()
def build_toolbar(self): def build_toolbar(self):
"""Create the toolbar.""" """Create the toolbar."""
# Init. # Init.
self.toolbar = self.CreateToolBar(wx.TB_HORIZONTAL|wx.TB_FLAT) self.toolbar = self.CreateToolBar(wx.TB_HORIZONTAL|wx.TB_FLAT)
# The new analysis button. # The new analysis button.
self.toolbar.AddLabelTool(TB_FILE_NEW, "New analysis", wx.Bitmap(fetch_i if dep_check.wx_classic:
con('oxygen.actions.document-new', "22x22"), wx.BITMAP_TYPE_ANY), shortHelp="New self.toolbar.AddLabelTool(TB_FILE_NEW, "New analysis", wx.Bitmap(fet
analysis") ch_icon('oxygen.actions.document-new', "22x22"), wx.BITMAP_TYPE_ANY), shortHelp=
"New analysis")
else:
self.toolbar.AddTool(TB_FILE_NEW, "New analysis", wx.Bitmap(fetch_ic
on('oxygen.actions.document-new', "22x22"), wx.BITMAP_TYPE_ANY), shortHelp="New
analysis")
self.Bind(wx.EVT_TOOL, self.analysis.menu_new, id=TB_FILE_NEW) self.Bind(wx.EVT_TOOL, self.analysis.menu_new, id=TB_FILE_NEW)
# The close analysis button. # The close analysis button.
self.toolbar.AddLabelTool(TB_FILE_CLOSE, "Close analysis", wx.Bitmap(fet if dep_check.wx_classic:
ch_icon('oxygen.actions.document-close', "22x22"), wx.BITMAP_TYPE_ANY), shortHel self.toolbar.AddLabelTool(TB_FILE_CLOSE, "Close analysis", wx.Bitmap
p="Close analysis") (fetch_icon('oxygen.actions.document-close', "22x22"), wx.BITMAP_TYPE_ANY), shor
tHelp="Close analysis")
else:
self.toolbar.AddTool(TB_FILE_CLOSE, "Close analysis", wx.Bitmap(fetc
h_icon('oxygen.actions.document-close', "22x22"), wx.BITMAP_TYPE_ANY), shortHelp
="Close analysis")
self.Bind(wx.EVT_TOOL, self.analysis.menu_close, id=TB_FILE_CLOSE) self.Bind(wx.EVT_TOOL, self.analysis.menu_close, id=TB_FILE_CLOSE)
# The close all analyses button. # The close all analyses button.
self.toolbar.AddLabelTool(TB_FILE_CLOSE_ALL, "Close all analyses", wx.Bi if dep_check.wx_classic:
tmap(fetch_icon('oxygen.actions.dialog-close', "22x22"), wx.BITMAP_TYPE_ANY), sh self.toolbar.AddLabelTool(TB_FILE_CLOSE_ALL, "Close all analyses", w
ortHelp="Close all analyses") x.Bitmap(fetch_icon('oxygen.actions.dialog-close', "22x22"), wx.BITMAP_TYPE_ANY)
, shortHelp="Close all analyses")
else:
self.toolbar.AddTool(TB_FILE_CLOSE_ALL, "Close all analyses", wx.Bit
map(fetch_icon('oxygen.actions.dialog-close', "22x22"), wx.BITMAP_TYPE_ANY), sho
rtHelp="Close all analyses")
self.Bind(wx.EVT_TOOL, self.analysis.menu_close_all, id=TB_FILE_CLOSE_AL L) self.Bind(wx.EVT_TOOL, self.analysis.menu_close_all, id=TB_FILE_CLOSE_AL L)
# A separator. # A separator.
self.toolbar.AddSeparator() self.toolbar.AddSeparator()
# The change working directory button. # The change working directory button.
self.toolbar.AddLabelTool(TB_FILE_CWD, "Change working directory", wx.Bi if dep_check.wx_classic:
tmap(fetch_icon('oxygen.places.folder-favorites', "22x22"), wx.BITMAP_TYPE_ANY), self.toolbar.AddLabelTool(TB_FILE_CWD, "Change working directory", w
shortHelp="Change working directory") x.Bitmap(fetch_icon('oxygen.places.folder-favorites', "22x22"), wx.BITMAP_TYPE_A
NY), shortHelp="Change working directory")
else:
self.toolbar.AddTool(TB_FILE_CWD, "Change working directory", wx.Bit
map(fetch_icon('oxygen.places.folder-favorites', "22x22"), wx.BITMAP_TYPE_ANY),
shortHelp="Change working directory")
self.Bind(wx.EVT_TOOL, self.system_cwd, id=TB_FILE_CWD) self.Bind(wx.EVT_TOOL, self.system_cwd, id=TB_FILE_CWD)
# The open state button. # The open state button.
self.toolbar.AddLabelTool(TB_FILE_OPEN, "Open relax state", wx.Bitmap(fe if dep_check.wx_classic:
tch_icon('oxygen.actions.document-open', "22x22"), wx.BITMAP_TYPE_ANY), shortHel self.toolbar.AddLabelTool(TB_FILE_OPEN, "Open relax state", wx.Bitma
p="Open relax state") p(fetch_icon('oxygen.actions.document-open', "22x22"), wx.BITMAP_TYPE_ANY), shor
tHelp="Open relax state")
else:
self.toolbar.AddTool(TB_FILE_OPEN, "Open relax state", wx.Bitmap(fet
ch_icon('oxygen.actions.document-open', "22x22"), wx.BITMAP_TYPE_ANY), shortHelp
="Open relax state")
self.Bind(wx.EVT_TOOL, self.state_load, id=TB_FILE_OPEN) self.Bind(wx.EVT_TOOL, self.state_load, id=TB_FILE_OPEN)
# The save state button. # The save state button.
self.toolbar.AddLabelTool(TB_FILE_SAVE, "Save relax state", wx.Bitmap(fe if dep_check.wx_classic:
tch_icon('oxygen.actions.document-save', "22x22"), wx.BITMAP_TYPE_ANY), shortHel self.toolbar.AddLabelTool(TB_FILE_SAVE, "Save relax state", wx.Bitma
p="Save relax state") p(fetch_icon('oxygen.actions.document-save', "22x22"), wx.BITMAP_TYPE_ANY), shor
tHelp="Save relax state")
else:
self.toolbar.AddTool(TB_FILE_SAVE, "Save relax state", wx.Bitmap(fet
ch_icon('oxygen.actions.document-save', "22x22"), wx.BITMAP_TYPE_ANY), shortHelp
="Save relax state")
self.Bind(wx.EVT_TOOL, self.action_state_save, id=TB_FILE_SAVE) self.Bind(wx.EVT_TOOL, self.action_state_save, id=TB_FILE_SAVE)
# The save as button. # The save as button.
self.toolbar.AddLabelTool(TB_FILE_SAVE_AS, "Save as", wx.Bitmap(fetch_ic if dep_check.wx_classic:
on('oxygen.actions.document-save-as', "22x22"), wx.BITMAP_TYPE_ANY), shortHelp=" self.toolbar.AddLabelTool(TB_FILE_SAVE_AS, "Save as", wx.Bitmap(fetc
Save as") h_icon('oxygen.actions.document-save-as', "22x22"), wx.BITMAP_TYPE_ANY), shortHe
lp="Save as")
else:
self.toolbar.AddTool(TB_FILE_SAVE_AS, "Save as", wx.Bitmap(fetch_ico
n('oxygen.actions.document-save-as', "22x22"), wx.BITMAP_TYPE_ANY), shortHelp="S
ave as")
self.Bind(wx.EVT_TOOL, self.action_state_save_as, id=TB_FILE_SAVE_AS) self.Bind(wx.EVT_TOOL, self.action_state_save_as, id=TB_FILE_SAVE_AS)
# A separator. # A separator.
self.toolbar.AddSeparator() self.toolbar.AddSeparator()
# The relax controller button. # The relax controller button.
self.toolbar.AddLabelTool(TB_VIEW_CONTROLLER, "Controller", wx.Bitmap(fe if dep_check.wx_classic:
tch_icon('oxygen.apps.preferences-system-performance', "22x22"), wx.BITMAP_TYPE_ self.toolbar.AddLabelTool(TB_VIEW_CONTROLLER, "Controller", wx.Bitma
ANY), shortHelp="relax controller") p(fetch_icon('oxygen.apps.preferences-system-performance', "22x22"), wx.BITMAP_T
YPE_ANY), shortHelp="relax controller")
else:
self.toolbar.AddTool(TB_VIEW_CONTROLLER, "Controller", wx.Bitmap(fet
ch_icon('oxygen.apps.preferences-system-performance', "22x22"), wx.BITMAP_TYPE_A
NY), shortHelp="relax controller")
self.Bind(wx.EVT_TOOL, self.show_controller, id=TB_VIEW_CONTROLLER) self.Bind(wx.EVT_TOOL, self.show_controller, id=TB_VIEW_CONTROLLER)
# The spin viewer button. # The spin viewer button.
self.toolbar.AddLabelTool(TB_VIEW_SPIN_VIEW, "Spin viewer", wx.Bitmap(fe if dep_check.wx_classic:
tch_icon('relax.spin', "22x22"), wx.BITMAP_TYPE_ANY), shortHelp="Spin viewer win self.toolbar.AddLabelTool(TB_VIEW_SPIN_VIEW, "Spin viewer", wx.Bitma
dow") p(fetch_icon('relax.spin', "22x22"), wx.BITMAP_TYPE_ANY), shortHelp="Spin viewer
window")
else:
self.toolbar.AddTool(TB_VIEW_SPIN_VIEW, "Spin viewer", wx.Bitmap(fet
ch_icon('relax.spin', "22x22"), wx.BITMAP_TYPE_ANY), shortHelp="Spin viewer wind
ow")
self.Bind(wx.EVT_TOOL, self.show_tree, id=TB_VIEW_SPIN_VIEW) self.Bind(wx.EVT_TOOL, self.show_tree, id=TB_VIEW_SPIN_VIEW)
# The results viewer button. # The results viewer button.
self.toolbar.AddLabelTool(TB_VIEW_RESULTS, "Results viewer", wx.Bitmap(f if dep_check.wx_classic:
etch_icon('oxygen.actions.view-statistics', "22x22"), wx.BITMAP_TYPE_ANY), short self.toolbar.AddLabelTool(TB_VIEW_RESULTS, "Results viewer", wx.Bitm
Help="Results viewer window") ap(fetch_icon('oxygen.actions.view-statistics', "22x22"), wx.BITMAP_TYPE_ANY), s
hortHelp="Results viewer window")
else:
self.toolbar.AddTool(TB_VIEW_RESULTS, "Results viewer", wx.Bitmap(fe
tch_icon('oxygen.actions.view-statistics', "22x22"), wx.BITMAP_TYPE_ANY), shortH
elp="Results viewer window")
self.Bind(wx.EVT_TOOL, self.show_results_viewer, id=TB_VIEW_RESULTS) self.Bind(wx.EVT_TOOL, self.show_results_viewer, id=TB_VIEW_RESULTS)
# The data pipe editor button. # The data pipe editor button.
self.toolbar.AddLabelTool(TB_VIEW_PIPE_EDIT, "Data pipe editor", wx.Bitm if dep_check.wx_classic:
ap(fetch_icon('relax.pipe', "22x22"), wx.BITMAP_TYPE_ANY), shortHelp="Data pipe self.toolbar.AddLabelTool(TB_VIEW_PIPE_EDIT, "Data pipe editor", wx.
editor") Bitmap(fetch_icon('relax.pipe', "22x22"), wx.BITMAP_TYPE_ANY), shortHelp="Data p
ipe editor")
else:
self.toolbar.AddTool(TB_VIEW_PIPE_EDIT, "Data pipe editor", wx.Bitma
p(fetch_icon('relax.pipe', "22x22"), wx.BITMAP_TYPE_ANY), shortHelp="Data pipe e
ditor")
self.Bind(wx.EVT_TOOL, self.show_pipe_editor, id=TB_VIEW_PIPE_EDIT) self.Bind(wx.EVT_TOOL, self.show_pipe_editor, id=TB_VIEW_PIPE_EDIT)
# The relax prompt button. # The relax prompt button.
self.toolbar.AddLabelTool(TB_VIEW_PROMPT, "relax prompt", wx.Bitmap(fetc if dep_check.wx_classic:
h_icon('oxygen.mimetypes.application-x-executable-script', "22x22"), wx.BITMAP_T self.toolbar.AddLabelTool(TB_VIEW_PROMPT, "relax prompt", wx.Bitmap(
YPE_ANY), shortHelp="The relax prompt GUI window") fetch_icon('oxygen.mimetypes.application-x-executable-script', "22x22"), wx.BITM
AP_TYPE_ANY), shortHelp="The relax prompt GUI window")
else:
self.toolbar.AddTool(TB_VIEW_PROMPT, "relax prompt", wx.Bitmap(fetch
_icon('oxygen.mimetypes.application-x-executable-script', "22x22"), wx.BITMAP_TY
PE_ANY), shortHelp="The relax prompt GUI window")
self.Bind(wx.EVT_TOOL, self.show_prompt, id=TB_VIEW_PROMPT) self.Bind(wx.EVT_TOOL, self.show_prompt, id=TB_VIEW_PROMPT)
# Build the toolbar. # Build the toolbar.
self.toolbar.Realize() self.toolbar.Realize()
def close_windows(self): def close_windows(self):
"""Throw a warning to close all of the non-essential windows when execut ion is locked. """Throw a warning to close all of the non-essential windows when execut ion is locked.
This is to speed up the calculations by avoiding window updates. This is to speed up the calculations by avoiding window updates.
""" """
 End of changes. 18 change blocks. 
39 lines changed or deleted 120 lines changed or added

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