dabo Commit
Revision 3180
Date: 2007-06-18 08:32:09 -0700 (Mon, 18 Jun 2007)
Author: Ed
Trac: http://svn.dabodev.com/trac/dabo/changeset/3180
Changed:
U trunk/dabo/ui/uiwx/dMenuBar.py
Log:
Added the ability to pass either a menu reference, a menu Caption, or the menu
index to the remove() method.
Diff:
Modified: trunk/dabo/ui/uiwx/dMenuBar.py
===================================================================
--- trunk/dabo/ui/uiwx/dMenuBar.py 2007-06-15 01:37:08 UTC (rev 3179)
+++ trunk/dabo/ui/uiwx/dMenuBar.py 2007-06-18 15:32:09 UTC (rev 3180)
@@ -106,13 +106,23 @@
return dMenu.dMenu(self, Caption=caption)
- def remove(self, index, release=True):
- """Removes the menu at the specified index from the menu bar.
+ def remove(self, indexOrMenu, release=True):
+ """Removes the menu at the specified index from the menu bar.
You may
+ also pass a reference to the menu, or the menu's Caption, and
it will
+ find the associated index.
If release is True (the default), the menu is deleted as well.
If release
is False, a reference to the menu object will be returned, and
the caller
is responsible for deleting it.
"""
+ if isinstance(indexOrMenu, dabo.ui.dMenu):
+ index = self.getMenuIndex(indexOrMenu.Caption)
+ elif isinstance(indexOrMenu, basestring):
+ # They passed a caption
+ index = self.getMenuIndex(indexOrMenu)
+ else:
+ # An index was passed.
+ index = indexOrMenu
menu = self.Remove(index)
if release:
menu.release()
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/dabo-dev/[EMAIL PROTECTED]