Ed Leafe wrote:
dabo Commit
Revision 2173
Date: 2006-05-21 08:31:34 -0700 (Sun, 21 May 2006)
Author: ed
Changed:
U trunk/dabo/ui/uiwx/dMenuBar.py
Log:
Added protective code to insertMenu() in case an out-of-range value for
position is passed.
Diff:
Modified: trunk/dabo/ui/uiwx/dMenuBar.py
===================================================================
--- trunk/dabo/ui/uiwx/dMenuBar.py 2006-05-21 03:17:28 UTC (rev 2172)
+++ trunk/dabo/ui/uiwx/dMenuBar.py 2006-05-21 15:31:34 UTC (rev 2173)
@@ -46,6 +46,7 @@
def insertMenu(self, pos, menu):
"""Inserts a dMenu in the dMenuBar at the specified position."""
+ pos = min(pos, self.GetMenuCount())
ret = self.Insert(pos, menu, menu.Caption)
if ret:
menu.Parent = self
I haven't tried it, but since pos is 0-based, and GetMenuCount() is
1-based, shouldn't that be:
pos = min(pos, self.GetMenuCount() - 1)
--
Paul McNett
http://paulmcnett.com
http://dabodev.com
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev