dabo Commit
Revision 1596
Date: 2005-11-29 10:11:38 -0800 (Tue, 29 Nov 2005)
Author: paul

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

Log:
Found and fixed the Gtk warnings of the form:

(python:5834): Gtk-CRITICAL **: gtk_widget_add_accelerator: assertion 
`GTK_IS_WIDGET (widget)' failed

They were happening when setting the Caption of a newly created dMenuItem
before the menu item was added to a menu. I simply delayed the setting of
the Caption until later, and the lines are gone.



Diff:
Modified: trunk/dabo/ui/uiwx/dMenu.py
===================================================================
--- trunk/dabo/ui/uiwx/dMenu.py 2005-11-29 16:33:32 UTC (rev 1595)
+++ trunk/dabo/ui/uiwx/dMenu.py 2005-11-29 18:11:38 UTC (rev 1596)
@@ -128,8 +128,9 @@
                of the dMenuItem: if valid property names/values, the dMenuItem 
will take
                them on; if not valid, an exception will be raised.
                """
-               item = self._getItem(caption, bindfunc, help, bmp, menutype, 
**kwargs)
+               item = self._getItem(bindfunc, help, bmp, menutype, **kwargs)
                self.appendItem(item)
+               item.Caption = caption
                return item
                
        
@@ -143,8 +144,9 @@
                of the dMenuItem: if valid property names/values, the dMenuItem 
will take
                them on; if not valid, an exception will be raised.
                """
-               item = self._getItem(caption, bindfunc, help, bmp, menutype)
+               item = self._getItem(bindfunc, help, bmp, menutype)
                self.insertItem(pos, item)
+               item.Caption = caption
                return item
                
 
@@ -158,8 +160,9 @@
                of the dMenuItem: if valid property names/values, the dMenuItem 
will take
                them on; if not valid, an exception will be raised.
                """
-               item = self._getItem(caption, bindfunc, help, bmp, menutype)
+               item = self._getItem(bindfunc, help, bmp, menutype)
                self.prependItem(item)
+               item.Caption = caption
                return item
                
                
@@ -180,9 +183,9 @@
                return item
 
 
-       def _getItem(self, prompt, bindfunc, help, icon, menutype, **kwargs):
+       def _getItem(self, bindfunc, help, icon, menutype, **kwargs):
                itmtyp = self._getItemType(menutype)
-               itm = dMenuItem.dMenuItem(self, Caption=prompt, HelpText=help, 
Icon=icon, 
+               itm = dMenuItem.dMenuItem(self, HelpText=help, Icon=icon, 
                                kind=itmtyp, **kwargs)
                if bindfunc:
                        itm.bindEvent(dEvents.Hit, bindfunc)




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev

Reply via email to