"Fossies" - the Fresh Open Source Software Archive  

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

menu.py  (relax-4.1.3.src.tar.bz2):menu.py  (relax-5.0.0.src.tar.bz2)
############################################################################### ###############################################################################
# # # #
# Copyright (C) 2009-2010 Michael Bieri # # Copyright (C) 2009-2010 Michael Bieri #
# Copyright (C) 2009-2014 Edward d'Auvergne # # Copyright (C) 2009-2014,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 31 skipping to change at line 31
############################################################################### ###############################################################################
# Module docstring. # Module docstring.
"""The main relax menu bar.""" """The main relax menu bar."""
# Python module imports. # Python module imports.
import sys import sys
import wx import wx
# relax module imports. # relax module imports.
import dep_check
from graphics import fetch_icon from graphics import fetch_icon
from gui.components.menu import build_menu_item from gui.components.menu import build_menu_item
from gui.uf_objects import build_uf_menus, Uf_storage; uf_store = Uf_storage() from gui.uf_objects import build_uf_menus, Uf_storage; uf_store = Uf_storage()
from status import Status; status = Status() from status import Status; status = Status()
from user_functions.data import Uf_info; uf_info = Uf_info() from user_functions.data import Uf_info; uf_info = Uf_info()
# Some IDs for the menu entries. # Some IDs for the menu entries.
MENU_FILE_NEW = wx.NewId() MENU_FILE_NEW = wx.NewId()
MENU_FILE_CLOSE = wx.NewId() MENU_FILE_CLOSE = wx.NewId()
MENU_FILE_CLOSE_ALL = wx.NewId() MENU_FILE_CLOSE_ALL = wx.NewId()
skipping to change at line 80 skipping to change at line 81
"""Build the menu bar.""" """Build the menu bar."""
# Store the args. # Store the args.
self.gui = gui self.gui = gui
# Create the menu bar GUI item. # Create the menu bar GUI item.
self.menubar = wx.MenuBar() self.menubar = wx.MenuBar()
# The 'File' menu entries. # The 'File' menu entries.
menu = wx.Menu() menu = wx.Menu()
menu.AppendItem(build_menu_item(menu, id=MENU_FILE_NEW, text="&New analy build_menu_item(menu, id=MENU_FILE_NEW, text="&New analysis\tCtrl+N", ic
sis\tCtrl+N", icon=fetch_icon('oxygen.actions.document-new', "16x16"))) on=fetch_icon('oxygen.actions.document-new', "16x16"))
menu.AppendItem(build_menu_item(menu, id=MENU_FILE_CLOSE, text="&Close a build_menu_item(menu, id=MENU_FILE_CLOSE, text="&Close analysis", icon=f
nalysis", icon=fetch_icon('oxygen.actions.document-close', "16x16"))) etch_icon('oxygen.actions.document-close', "16x16"))
menu.AppendItem(build_menu_item(menu, id=MENU_FILE_CLOSE_ALL, text="&Clo build_menu_item(menu, id=MENU_FILE_CLOSE_ALL, text="&Close all analyses"
se all analyses", icon=fetch_icon('oxygen.actions.dialog-close', "16x16"))) , icon=fetch_icon('oxygen.actions.dialog-close', "16x16"))
menu.AppendSeparator() menu.AppendSeparator()
menu.AppendItem(build_menu_item(menu, id=MENU_FILE_CWD, text="&Change di build_menu_item(menu, id=MENU_FILE_CWD, text="&Change directory\tCtrl+W"
rectory\tCtrl+W", icon=fetch_icon('oxygen.places.folder-favorites', "16x16"))) , icon=fetch_icon('oxygen.places.folder-favorites', "16x16"))
menu.AppendItem(build_menu_item(menu, id=MENU_FILE_OPEN, text="&Open rel build_menu_item(menu, id=MENU_FILE_OPEN, text="&Open relax state\tCtrl+O
ax state\tCtrl+O", icon=fetch_icon('oxygen.actions.document-open', "16x16"))) ", icon=fetch_icon('oxygen.actions.document-open', "16x16"))
menu.AppendItem(build_menu_item(menu, id=MENU_FILE_SAVE, text="S&ave rel build_menu_item(menu, id=MENU_FILE_SAVE, text="S&ave relax state\tCtrl+S
ax state\tCtrl+S", icon=fetch_icon('oxygen.actions.document-save', "16x16"))) ", icon=fetch_icon('oxygen.actions.document-save', "16x16"))
menu.AppendItem(build_menu_item(menu, id=MENU_FILE_SAVE_AS, text="Save a build_menu_item(menu, id=MENU_FILE_SAVE_AS, text="Save as...\tCtrl+Shift
s...\tCtrl+Shift+S", icon=fetch_icon('oxygen.actions.document-save-as', "16x16") +S", icon=fetch_icon('oxygen.actions.document-save-as', "16x16"))
))
menu.AppendSeparator() menu.AppendSeparator()
menu.AppendItem(build_menu_item(menu, id=MENU_FILE_EXPORT_BMRB, text="Ex port for BMRB deposition", icon=fetch_icon('relax.bmrb'))) build_menu_item(menu, id=MENU_FILE_EXPORT_BMRB, text="Export for BMRB de position", icon=fetch_icon('relax.bmrb'))
menu.AppendSeparator() menu.AppendSeparator()
menu.AppendItem(build_menu_item(menu, id=MENU_FILE_EXIT, text="E&xit\tCt rl+Q", icon=fetch_icon('oxygen.actions.system-shutdown', "16x16"))) build_menu_item(menu, id=MENU_FILE_EXIT, text="E&xit\tCtrl+Q", icon=fetc h_icon('oxygen.actions.system-shutdown', "16x16"))
self.menubar.Append(menu, "&File") self.menubar.Append(menu, "&File")
# The 'File' menu actions. # The 'File' menu actions.
self.gui.Bind(wx.EVT_MENU, self.gui.analysis.menu_new, id=MENU_FILE_NEW) self.gui.Bind(wx.EVT_MENU, self.gui.analysis.menu_new, id=MENU_FILE_NEW)
self.gui.Bind(wx.EVT_MENU, self.gui.analysis.menu_close, id=MENU_FILE_CL OSE) self.gui.Bind(wx.EVT_MENU, self.gui.analysis.menu_close, id=MENU_FILE_CL OSE)
self.gui.Bind(wx.EVT_MENU, self.gui.analysis.menu_close_all, id=MENU_FIL E_CLOSE_ALL) self.gui.Bind(wx.EVT_MENU, self.gui.analysis.menu_close_all, id=MENU_FIL E_CLOSE_ALL)
self.gui.Bind(wx.EVT_MENU, self.gui.system_cwd, id=MENU_FILE_CWD) self.gui.Bind(wx.EVT_MENU, self.gui.system_cwd, id=MENU_FILE_CWD)
self.gui.Bind(wx.EVT_MENU, self.gui.state_load, id=MENU_FILE_OPEN) self.gui.Bind(wx.EVT_MENU, self.gui.state_load, id=MENU_FILE_OPEN)
self.gui.Bind(wx.EVT_MENU, self.gui.action_state_save, id=MENU_FILE_SAVE ) self.gui.Bind(wx.EVT_MENU, self.gui.action_state_save, id=MENU_FILE_SAVE )
self.gui.Bind(wx.EVT_MENU, self.gui.action_state_save_as, id=MENU_FILE_S AVE_AS) self.gui.Bind(wx.EVT_MENU, self.gui.action_state_save_as, id=MENU_FILE_S AVE_AS)
self.gui.Bind(wx.EVT_MENU, self.gui.action_export_bmrb, id=MENU_FILE_EXP ORT_BMRB) self.gui.Bind(wx.EVT_MENU, self.gui.action_export_bmrb, id=MENU_FILE_EXP ORT_BMRB)
self.gui.Bind(wx.EVT_MENU, self.gui.exit_gui, id=MENU_FILE_EXIT) self.gui.Bind(wx.EVT_MENU, self.gui.exit_gui, id=MENU_FILE_EXIT)
# The 'View' menu entries. # The 'View' menu entries.
menu = wx.Menu() menu = wx.Menu()
menu.AppendItem(build_menu_item(menu, id=MENU_VIEW_CONTROLLER, text="&Co build_menu_item(menu, id=MENU_VIEW_CONTROLLER, text="&Controller\tCtrl+Z
ntroller\tCtrl+Z", icon=fetch_icon('oxygen.apps.preferences-system-performance', ", icon=fetch_icon('oxygen.apps.preferences-system-performance', "16x16"))
"16x16"))) build_menu_item(menu, id=MENU_VIEW_SPIN_VIEW, text="&Spin viewer\tCtrl+T
menu.AppendItem(build_menu_item(menu, id=MENU_VIEW_SPIN_VIEW, text="&Spi ", icon=fetch_icon('relax.spin', "16x16"))
n viewer\tCtrl+T", icon=fetch_icon('relax.spin', "16x16"))) build_menu_item(menu, id=MENU_VIEW_RESULTS, text="&Results viewer\tCtrl+
menu.AppendItem(build_menu_item(menu, id=MENU_VIEW_RESULTS, text="&Resul R", icon=fetch_icon('oxygen.actions.view-statistics', "16x16"))
ts viewer\tCtrl+R", icon=fetch_icon('oxygen.actions.view-statistics', "16x16"))) build_menu_item(menu, id=MENU_VIEW_PIPE_EDIT, text="&Data pipe editor\tC
menu.AppendItem(build_menu_item(menu, id=MENU_VIEW_PIPE_EDIT, text="&Dat trl+D", icon=fetch_icon('relax.pipe', "16x16"))
a pipe editor\tCtrl+D", icon=fetch_icon('relax.pipe', "16x16"))) build_menu_item(menu, id=MENU_VIEW_PROMPT, text="relax &prompt\tCtrl+P",
menu.AppendItem(build_menu_item(menu, id=MENU_VIEW_PROMPT, text="relax & icon=fetch_icon('oxygen.mimetypes.application-x-executable-script', "16x16"))
prompt\tCtrl+P", icon=fetch_icon('oxygen.mimetypes.application-x-executable-scri
pt', "16x16")))
self.menubar.Append(menu, "&View") self.menubar.Append(menu, "&View")
# The 'View' actions. # The 'View' actions.
self.gui.Bind(wx.EVT_MENU, self.gui.show_controller, id=MENU_VIEW_CONTRO LLER) self.gui.Bind(wx.EVT_MENU, self.gui.show_controller, id=MENU_VIEW_CONTRO LLER)
self.gui.Bind(wx.EVT_MENU, self.gui.show_prompt, id=MENU_VIEW_PROMPT) self.gui.Bind(wx.EVT_MENU, self.gui.show_prompt, id=MENU_VIEW_PROMPT)
self.gui.Bind(wx.EVT_MENU, self.gui.show_tree, id=MENU_VIEW_SPIN_VIEW) self.gui.Bind(wx.EVT_MENU, self.gui.show_tree, id=MENU_VIEW_SPIN_VIEW)
self.gui.Bind(wx.EVT_MENU, self.gui.show_results_viewer, id=MENU_VIEW_RE SULTS) self.gui.Bind(wx.EVT_MENU, self.gui.show_results_viewer, id=MENU_VIEW_RE SULTS)
self.gui.Bind(wx.EVT_MENU, self.gui.show_pipe_editor, id=MENU_VIEW_PIPE_ EDIT) self.gui.Bind(wx.EVT_MENU, self.gui.show_pipe_editor, id=MENU_VIEW_PIPE_ EDIT)
# The auto generated 'User functions' menu entries. # The auto generated 'User functions' menu entries.
self.menu_uf_ids = build_uf_menus(parent=self.gui, menubar=self.menubar) self.menu_uf_ids = build_uf_menus(parent=self.gui, menubar=self.menubar)
# The 'Tools' menu entries. # The 'Tools' menu entries.
menu = wx.Menu() menu = wx.Menu()
menu.AppendItem(build_menu_item(menu, id=MENU_TOOLS_FORMAT, text="&Free build_menu_item(menu, id=MENU_TOOLS_FORMAT, text="&Free file format sett
file format settings", icon=fetch_icon('oxygen.actions.document-properties', "16 ings", icon=fetch_icon('oxygen.actions.document-properties', "16x16"))
x16"))) build_menu_item(menu, id=MENU_TOOLS_SYS_INFO, text="System &information"
menu.AppendItem(build_menu_item(menu, id=MENU_TOOLS_SYS_INFO, text="Syst , icon=fetch_icon('oxygen.actions.help-about', "16x16"))
em &information", icon=fetch_icon('oxygen.actions.help-about', "16x16")))
# The 'Tools->Test suite" sub-menu. # The 'Tools->Test suite" sub-menu.
test_suite_item = build_menu_item(menu, id=MENU_TOOLS_TEST_SUITE, text=" &Test suite", icon=fetch_icon('oxygen.mimetypes.application-x-desktop', "16x16") ) test_suite_item = build_menu_item(menu, id=MENU_TOOLS_TEST_SUITE, text=" &Test suite", icon=fetch_icon('oxygen.mimetypes.application-x-desktop', "16x16") , append=False)
sub_menu = wx.Menu() sub_menu = wx.Menu()
test_suite_item.SetSubMenu(sub_menu) test_suite_item.SetSubMenu(sub_menu)
sub_menu.AppendItem(build_menu_item(sub_menu, id=MENU_TOOLS_TEST_SUITE_A LL, text="&Full test suite", icon=fetch_icon('oxygen.mimetypes.application-x-des ktop', "16x16"))) build_menu_item(sub_menu, id=MENU_TOOLS_TEST_SUITE_ALL, text="&Full test suite", icon=fetch_icon('oxygen.mimetypes.application-x-desktop', "16x16"))
sub_menu.AppendSeparator() sub_menu.AppendSeparator()
sub_menu.AppendItem(build_menu_item(sub_menu, id=MENU_TOOLS_TEST_SUITE_S build_menu_item(sub_menu, id=MENU_TOOLS_TEST_SUITE_SYS, text="&System te
YS, text="&System tests", icon=fetch_icon('oxygen.mimetypes.application-x-deskto sts", icon=fetch_icon('oxygen.mimetypes.application-x-desktop', "16x16"))
p', "16x16"))) build_menu_item(sub_menu, id=MENU_TOOLS_TEST_SUITE_UNIT, text="&Unit tes
sub_menu.AppendItem(build_menu_item(sub_menu, id=MENU_TOOLS_TEST_SUITE_U ts", icon=fetch_icon('oxygen.mimetypes.application-x-desktop', "16x16"))
NIT, text="&Unit tests", icon=fetch_icon('oxygen.mimetypes.application-x-desktop build_menu_item(sub_menu, id=MENU_TOOLS_TEST_SUITE_GUI, text="&GUI tests
', "16x16"))) ", icon=fetch_icon('oxygen.mimetypes.application-x-desktop', "16x16"))
sub_menu.AppendItem(build_menu_item(sub_menu, id=MENU_TOOLS_TEST_SUITE_G build_menu_item(sub_menu, id=MENU_TOOLS_TEST_SUITE_VERIFICATION, text="&
UI, text="&GUI tests", icon=fetch_icon('oxygen.mimetypes.application-x-desktop', Verification tests", icon=fetch_icon('oxygen.mimetypes.application-x-desktop', "
"16x16"))) 16x16"))
sub_menu.AppendItem(build_menu_item(sub_menu, id=MENU_TOOLS_TEST_SUITE_V if dep_check.wx_classic:
ERIFICATION, text="&Verification tests", icon=fetch_icon('oxygen.mimetypes.appli menu.AppendItem(test_suite_item)
cation-x-desktop', "16x16"))) else:
menu.AppendItem(test_suite_item) menu.Append(test_suite_item)
self.menubar.Append(menu, "&Tools") self.menubar.Append(menu, "&Tools")
# The 'Tools' menu actions. # The 'Tools' menu actions.
self.gui.Bind(wx.EVT_MENU, self.gui.free_file_format_settings, id=MENU_T OOLS_FORMAT) self.gui.Bind(wx.EVT_MENU, self.gui.free_file_format_settings, id=MENU_T OOLS_FORMAT)
self.gui.Bind(wx.EVT_MENU, self._sys_info, id=MENU_TOOLS_SYS_INFO) self.gui.Bind(wx.EVT_MENU, self._sys_info, id=MENU_TOOLS_SYS_INFO)
self.gui.Bind(wx.EVT_MENU, self.gui.run_test_suite, id=MENU_TOOLS_TEST_S UITE_ALL) self.gui.Bind(wx.EVT_MENU, self.gui.run_test_suite, id=MENU_TOOLS_TEST_S UITE_ALL)
self.gui.Bind(wx.EVT_MENU, self.gui.run_test_suite_sys, id=MENU_TOOLS_TE ST_SUITE_SYS) self.gui.Bind(wx.EVT_MENU, self.gui.run_test_suite_sys, id=MENU_TOOLS_TE ST_SUITE_SYS)
self.gui.Bind(wx.EVT_MENU, self.gui.run_test_suite_unit, id=MENU_TOOLS_T EST_SUITE_UNIT) self.gui.Bind(wx.EVT_MENU, self.gui.run_test_suite_unit, id=MENU_TOOLS_T EST_SUITE_UNIT)
self.gui.Bind(wx.EVT_MENU, self.gui.run_test_suite_gui, id=MENU_TOOLS_TE ST_SUITE_GUI) self.gui.Bind(wx.EVT_MENU, self.gui.run_test_suite_gui, id=MENU_TOOLS_TE ST_SUITE_GUI)
self.gui.Bind(wx.EVT_MENU, self.gui.run_test_suite_verification, id=MENU _TOOLS_TEST_SUITE_VERIFICATION) self.gui.Bind(wx.EVT_MENU, self.gui.run_test_suite_verification, id=MENU _TOOLS_TEST_SUITE_VERIFICATION)
# The 'Help' menu entries. # The 'Help' menu entries.
menu = wx.Menu() menu = wx.Menu()
menu.AppendItem(build_menu_item(menu, id=MENU_HELP_MANUAL, text="relax u ser &manual\tF1", icon=fetch_icon('oxygen.mimetypes.application-pdf', "16x16"))) build_menu_item(menu, id=MENU_HELP_MANUAL, text="relax user &manual\tF1" , icon=fetch_icon('oxygen.mimetypes.application-pdf', "16x16"))
menu.AppendSeparator() menu.AppendSeparator()
menu.AppendItem(build_menu_item(menu, id=MENU_HELP_MAIL, text="Mailing l build_menu_item(menu, id=MENU_HELP_MAIL, text="Mailing list &contact (re
ist &contact (relax-users@gna.org)", icon=fetch_icon('oxygen.actions.mail-mark-u lax-users@gna.org)", icon=fetch_icon('oxygen.actions.mail-mark-unread-new', "16x
nread-new', "16x16"))) 16"))
menu.AppendItem(build_menu_item(menu, id=MENU_HELP_REFS, text="&Referenc build_menu_item(menu, id=MENU_HELP_REFS, text="&References", icon=fetch_
es", icon=fetch_icon('oxygen.actions.flag-blue', "16x16"))) icon('oxygen.actions.flag-blue', "16x16"))
menu.AppendSeparator() menu.AppendSeparator()
menu.AppendItem(build_menu_item(menu, id=MENU_HELP_GPL, text="&Licence", icon=fetch_icon('relax.gnu-head-mini', "16x16"))) build_menu_item(menu, id=MENU_HELP_GPL, text="&Licence", icon=fetch_icon ('relax.gnu-head-mini', "16x16"))
menu.AppendSeparator() menu.AppendSeparator()
menu.AppendItem(build_menu_item(menu, id=MENU_HELP_ABOUT, text="About re la&x", icon=fetch_icon("relax.relax"))) build_menu_item(menu, id=MENU_HELP_ABOUT, text="About rela&x", icon=fetc h_icon("relax.relax"))
self.menubar.Append(menu, "&Help") self.menubar.Append(menu, "&Help")
# The 'Help' menu actions. # The 'Help' menu actions.
self.gui.Bind(wx.EVT_MENU, self.gui.relax_manual, id=MENU_HELP_MANUAL) self.gui.Bind(wx.EVT_MENU, self.gui.relax_manual, id=MENU_HELP_MANUAL)
self.gui.Bind(wx.EVT_MENU, self.gui.contact_relax, id=MENU_HELP_MAIL) self.gui.Bind(wx.EVT_MENU, self.gui.contact_relax, id=MENU_HELP_MAIL)
self.gui.Bind(wx.EVT_MENU, self.gui.references, id=MENU_HELP_REFS) self.gui.Bind(wx.EVT_MENU, self.gui.references, id=MENU_HELP_REFS)
self.gui.Bind(wx.EVT_MENU, self._licence, id=MENU_HELP_GPL) self.gui.Bind(wx.EVT_MENU, self._licence, id=MENU_HELP_GPL)
self.gui.Bind(wx.EVT_MENU, self.gui.about_relax, id=MENU_HELP_ABOUT) self.gui.Bind(wx.EVT_MENU, self.gui.about_relax, id=MENU_HELP_ABOUT)
# Add the menu bar GUI item to the main frame. # Add the menu bar GUI item to the main frame.
skipping to change at line 183 skipping to change at line 187
# Menu update. # Menu update.
self.gui.Bind(wx.EVT_MENU_OPEN, self.update_menus) self.gui.Bind(wx.EVT_MENU_OPEN, self.update_menus)
def _create_menu(self, menu, entries): def _create_menu(self, menu, entries):
"""Build the menu.""" """Build the menu."""
# Loop over the menu entries. # Loop over the menu entries.
for item in entries: for item in entries:
# Build the menu entry. # Build the menu entry.
menu_item = build_menu_item(menu, id=item[0], text=item[1], icon=ite m[2]) menu_item = build_menu_item(menu, id=item[0], text=item[1], icon=ite m[2], append=False)
# A sub-menu. # A sub-menu.
if len(item[4]): if len(item[4]):
# The sub-menu. # The sub-menu.
sub_menu = wx.Menu() sub_menu = wx.Menu()
# Loop over the sub-menus. # Loop over the sub-menus.
for sub_item in item[4]: for sub_item in item[4]:
# Build the menu entry. # Build the menu entry.
sub_menu_item = build_menu_item(sub_menu, id=sub_item[0], te xt=sub_item[1], icon=sub_item[2]) sub_menu_item = build_menu_item(sub_menu, id=sub_item[0], te xt=sub_item[1], icon=sub_item[2])
sub_menu.AppendItem(sub_menu_item)
# The menu actions. # The menu actions.
self.gui.Bind(wx.EVT_MENU, sub_item[3], id=sub_item[0]) self.gui.Bind(wx.EVT_MENU, sub_item[3], id=sub_item[0])
# Append the sub-menu. # Append the sub-menu.
menu_item.SetSubMenu(sub_menu) menu_item.SetSubMenu(sub_menu)
# A normal menu item. # A normal menu item.
else: else:
# The menu actions. # The menu actions.
self.gui.Bind(wx.EVT_MENU, item[3], id=item[0]) self.gui.Bind(wx.EVT_MENU, item[3], id=item[0])
# Append the menu item. # Append the menu item.
menu.AppendItem(menu_item) if dep_check.wx_classic:
menu.AppendItem(menu_item)
else:
menu.Append(menu_item)
def _licence(self, event): def _licence(self, event):
"""Show the GPL licence. """Show the GPL licence.
@param event: The wx event. @param event: The wx event.
@type event: wx event @type event: wx event
""" """
# Print the GPL to STDOUT. # Print the GPL to STDOUT.
file = open('docs/COPYING') file = open('docs/COPYING')
 End of changes. 17 change blocks. 
62 lines changed or deleted 61 lines changed or added

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