Author: bugman Date: Fri Jan 29 16:12:44 2010 New Revision: 10601 URL: http://svn.gna.org/viewcvs/relax?rev=10601&view=rev Log: Made build_menu_sub_item() more flexible in that the icon or text is now optional. Modified: branches/bieri_gui/gui_bieri/relax_gui.py Modified: branches/bieri_gui/gui_bieri/relax_gui.py URL: http://svn.gna.org/viewcvs/relax/branches/bieri_gui/gui_bieri/relax_gui.py?rev=10601&r1=10600&r2=10601&view=diff ============================================================================== --- branches/bieri_gui/gui_bieri/relax_gui.py (original) +++ branches/bieri_gui/gui_bieri/relax_gui.py Fri Jan 29 16:12:44 2010 @@ -725,9 +725,9 @@ @keyword id: The element identification number. @type id: int @keyword text: The text for the menu entry. - @type text: str + @type text: None or str @keyword icon: The bitmap icon path. - @type icon: str + @type icon: None or str @keyword kind: The item type, which defaults to wx.ITEM_NORMAL. @type kind: int @return: The initialised wx.MenuItem() instance. @@ -739,9 +739,13 @@ # Set up the element. element.SetId(id) - element.SetBitmap(wx.Bitmap(icon)) - element.SetText(text) element.SetKind(kind) + + # Optional details. + if icon: + element.SetBitmap(wx.Bitmap(icon)) + if text: + element.SetText(text) # Return the element. return element