dabo Commit
Revision 6142
Date: 2010-10-24 07:40:47 -0700 (Sun, 24 Oct 2010)
Author: Ed
Trac: http://trac.dabodev.com/changeset/6142
Changed:
U trunk/dabo/ui/uiwx/dMenuBar.py
Log:
Modified the appendMenu(), prependMenu(), and insertMenu() methods to return
the menu reference instead of a boolean indicating success. While these methods
require the reference to be passed in, I felt that it was confusing since every
other append, prepend and insert method returned the reference to the item
being added.
Diff:
Modified: trunk/dabo/ui/uiwx/dMenuBar.py
===================================================================
--- trunk/dabo/ui/uiwx/dMenuBar.py 2010-10-24 14:39:01 UTC (rev 6141)
+++ trunk/dabo/ui/uiwx/dMenuBar.py 2010-10-24 14:40:47 UTC (rev 6142)
@@ -47,32 +47,38 @@
def appendMenu(self, menu):
- """Inserts a dMenu at the end of the dMenuBar."""
- ret = self.Append(menu, menu.Caption)
- if ret:
+ """Inserts a dMenu at the end of the dMenuBar, and returns the
+ reference to the that menu."""
+ ok = self.Append(menu, menu.Caption)
+ if ok:
menu.Parent = self
- return ret
+ return menu
def insertMenu(self, pos, menu):
- """Inserts a dMenu in the dMenuBar at the specified position."""
+ """Inserts a dMenu in the dMenuBar at the specified position,
and
+ returns a reference to that menu.
+ """
pos = min(pos, self.GetMenuCount())
- ret = self.Insert(pos, menu, menu.Caption)
- if ret:
+ ok = self.Insert(pos, menu, menu.Caption)
+ if ok:
menu.Parent = self
- return ret
+ return menu
def prependMenu(self, menu):
- """Inserts a dMenu at the beginning of the dMenuBar."""
- ret = self.PrependMenu(menu, menu.Caption)
- if ret:
+ """Inserts a dMenu at the beginning of the dMenuBar, and returns
+ a reference to that menu.
+ """
+ ok = self.PrependMenu(menu, menu.Caption)
+ if ok:
menu.Parent = self
- return ret
+ return menu
def append(self, caption, MenuID=None):
- """Appends a dMenu to the end of the dMenuBar.
+ """Appends a dMenu to the end of the dMenuBar, and returns a
reference
+ to that menu.
A generic dMenu will be created with the passed caption. Also
see the
appendMenu() function, which takes a dMenu instance as an
argument.
@@ -83,7 +89,8 @@
def insert(self, pos, caption, MenuID=None):
- """Inserts a dMenu at the specified position in the dMenuBar.
+ """Inserts a dMenu at the specified position in the dMenuBar,
and returns
+ a reference to that menu.
A generic dMenu will be created with the passed caption. Also
see the
insertMenu() function, which takes a dMenu instance as an
argument.
@@ -94,7 +101,8 @@
def prepend(self, caption, MenuID=None):
- """Prepends a dMenu to the beginning of the dMenuBar.
+ """Prepends a dMenu to the beginning of the dMenuBar, and
returns
+ a reference to that menu.
A generic dMenu will be created with the passed caption. Also
see the
prependMenu() function, which takes a dMenu instance as an
argument.
_______________________________________________
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/[email protected]