dabo Commit
Revision 3778
Date: 2007-12-09 12:40:49 -0800 (Sun, 09 Dec 2007)
Author: Ed
Trac: http://svn.dabodev.com/trac/dabo/changeset/3778

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

Log:
This should fix the long-standing issue with Check/Radio menus under Gtk and 
Windows. The problem was that passing a Icon property, even an empty one, would 
call the SetBitmap() method of the menu item, and this would disrupt the way 
the menu was handled. Ticket #1123.


Diff:
Modified: trunk/dabo/ui/uiwx/dMenu.py
===================================================================
--- trunk/dabo/ui/uiwx/dMenu.py 2007-12-06 15:02:01 UTC (rev 3777)
+++ trunk/dabo/ui/uiwx/dMenu.py 2007-12-09 20:40:49 UTC (rev 3778)
@@ -373,16 +373,13 @@
        def _getItemType(self, typ):
                typ = str(typ).lower()[:3]
                ret = NormalItemType
-               if self.Application:
-                       # This is to work around a bug in Gtk 
-                       if self.Application.Platform != "GTK":
-                               if typ in ("che", "chk"):
-                                       ret = CheckItemType
-                               elif typ == "rad":
-                                       # Currently only implemented under 
Windows and GTK, 
-                                       # use #if wxHAS_RADIO_MENU_ITEMS to 
test for 
-                                       # availability of this feature.
-                                       ret = RadioItemType
+               if typ in ("che", "chk"):
+                       ret = CheckItemType
+               elif typ == "rad":
+                       # Currently only implemented under Windows and GTK, 
+                       # use #if wxHAS_RADIO_MENU_ITEMS to test for 
+                       # availability of this feature.
+                       ret = RadioItemType
                return ret
 
 

Modified: trunk/dabo/ui/uiwx/dMenuItem.py
===================================================================
--- trunk/dabo/ui/uiwx/dMenuItem.py     2007-12-06 15:02:01 UTC (rev 3777)
+++ trunk/dabo/ui/uiwx/dMenuItem.py     2007-12-09 20:40:49 UTC (rev 3778)
@@ -181,6 +181,13 @@
 
 class dCheckMenuItem(dMenuItem):
        """Creates a checkbox-like item in a menu."""
+       def __init__(self, parent=None, properties=None, *args, **kwargs):
+               # Remove the 'Icon' property, as it interferes with the 
'selected' display 
+               self._extractKey((properties, kwargs), "Icon")
+               super(dCheckMenuItem, self).__init__(parent=parent, 
properties=properties,
+                               *args, **kwargs)
+                               
+
        def _getChecked(self):
                return self.IsChecked()
 
@@ -198,6 +205,13 @@
 
 class dRadioMenuItem(dMenuItem):
        """Creates a radiobox-like item in a menu."""
+       def __init__(self, parent=None, properties=None, *args, **kwargs):
+               # Remove the 'Icon' property, as it interferes with the 
'selected' display 
+               self._extractKey((properties, kwargs), "Icon")
+               super(dRadioMenuItem, self).__init__(parent=parent, 
properties=properties,
+                               *args, **kwargs)
+
+
        def _getChecked(self):
                return self.IsChecked()
 




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

Reply via email to