dabo Commit
Revision 4348
Date: 2008-08-03 13:17:16 -0700 (Sun, 03 Aug 2008)
Author: Ed
Trac: http://svn.dabodev.com/trac/dabo/changeset/4348

Changed:
U   trunk/dabo/ui/uiwx/dMenu.py

Log:
This fixes a bug introduced with the earlier fix for menu appearance. The trick 
of adding and removing dummy menu items to preserve the layout was interfering 
with radio menu items, as they depend on position, and removing the dummy was 
altering the position. Changing the removal to a callAfter() instead fixed the 
problem.

Also added some defensive code to remove(). Some of these calls to remove the 
dummy items were firing after the menu had been destroyed; this catches that 
case and handles it properly.


Diff:
Modified: trunk/dabo/ui/uiwx/dMenu.py
===================================================================
--- trunk/dabo/ui/uiwx/dMenu.py 2008-08-03 18:45:05 UTC (rev 4347)
+++ trunk/dabo/ui/uiwx/dMenu.py 2008-08-03 20:17:16 UTC (rev 4348)
@@ -228,9 +228,8 @@
                dummySpacer = None
                if not self.Children:
                        dummySpacer = _actualCreation(" ", "", None, "")
+                       dabo.ui.callAfter(self.remove, dummySpacer)
                item = _actualCreation(caption, help, picture, menutype, *args, 
**kwargs)
-               if dummySpacer:
-                       self.remove(dummySpacer)
                return item
 
 
@@ -298,6 +297,9 @@
                True (the default), the item is destroyed as well. If release 
is False, a reference 
                to the object will be returned, and the caller is responsible 
for destroying it.
                """
+               if not self:
+                       # Menu has already been destroyed.
+                       return
                item = self._resolveItem(capIdxOrItem)
                id_ = item.GetId()
                if self._daboChildren.has_key(id_):




_______________________________________________
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]

Reply via email to