"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "gui/components/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-2011 Edward d'Auvergne # # Copyright (C) 2009-2011,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 29 skipping to change at line 29
# along with this program. If not, see <http://www.gnu.org/licenses/>. # # along with this program. If not, see <http://www.gnu.org/licenses/>. #
# # # #
############################################################################### ###############################################################################
# Module docstring. # Module docstring.
"""Module for the main relax menu bar.""" """Module for the main relax menu bar."""
# Python module imports. # Python module imports.
import wx import wx
def build_menu_item(menu, parent=None, id=-1, text='', tooltip='', icon=None, fn # relax module imports.
=None): import dep_check
def build_menu_item(menu, parent=None, id=-1, text='', tooltip='', icon=None, fn
=None, append=True):
"""Construct and return the menu sub-item. """Construct and return the menu sub-item.
@param menu: The menu object to place this entry in. @param menu: The menu object to place this entry in.
@type menu: wx.Menu instance @type menu: wx.Menu instance
@keyword id: The element identification number. @keyword id: The element identification number.
@type id: int @type id: int
@keyword text: The text for the menu entry. @keyword text: The text for the menu entry.
@type text: None or str @type text: None or str
@keyword tooltip: A tool tip. @keyword tooltip: A tool tip.
@type tooltip: str @type tooltip: str
@keyword icon: The bitmap icon path. @keyword icon: The bitmap icon path.
@type icon: None or str @type icon: None or str
@keyword fn: The function to bind to the menu entry. @keyword fn: The function to bind to the menu entry.
@type fn: class method @type fn: class method
@keyword append: A flag which if true will cause the element to be append
ed to the given menu.
@type append: bool
@return: The initialised wx.MenuItem() instance. @return: The initialised wx.MenuItem() instance.
@rtype: wx.MenuItem() instance @rtype: wx.MenuItem() instance
""" """
# Initialise the GUI element. # Initialise the GUI element.
element = wx.MenuItem(menu, id, text, tooltip) element = wx.MenuItem(menu, id, text, tooltip)
# Set the icon. # Set the icon.
if icon: if icon:
element.SetBitmap(wx.Bitmap(icon)) element.SetBitmap(wx.Bitmap(icon))
# Bind the menu entry. # Bind the menu entry.
if fn and parent: if fn and parent:
parent.Bind(wx.EVT_MENU, fn, id=id) parent.Bind(wx.EVT_MENU, fn, id=id)
# Append the item.
if append:
if dep_check.wx_classic:
menu.AppendItem(element)
else:
menu.Append(element)
# Return the element. # Return the element.
return element return element
 End of changes. 4 change blocks. 
3 lines changed or deleted 16 lines changed or added

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