dabo Commit
Revision 3181
Date: 2007-06-18 11:39:50 -0700 (Mon, 18 Jun 2007)
Author: Ed
Trac: http://svn.dabodev.com/trac/dabo/changeset/3181

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

Log:
Fixed the _getID() method to work with menus and other objects that do not have 
the wxPython GetId() method.

Modified the Visible property's get/set methods to handle cases where objects 
do not have the IsShown() and Show() methods. Attempting to read/write to 
Visible for these objects will no longer throw an error; instead, an 
appropriate message is written to the errorLog object.



Diff:
Modified: trunk/dabo/ui/uiwx/dPemMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dPemMixin.py     2007-06-18 15:32:09 UTC (rev 3180)
+++ trunk/dabo/ui/uiwx/dPemMixin.py     2007-06-18 18:39:50 UTC (rev 3181)
@@ -680,7 +680,12 @@
 
        def _getID(self):
                """Override the default behavior to return the wxPython ID."""
-               return self.GetId()
+               try:
+                       ret = self.GetId()
+               except AttributeError:
+                       # Object doesn't support GetID()
+                       ret = super(dPemMixin, self)._getID()
+               return ret
 
 
        def fitToSizer(self, extraWidth=0, extraHeight=0):
@@ -2271,11 +2276,18 @@
 
        
        def _getVisible(self):
-               return self.IsShown()
+               try:
+                       return self.IsShown()
+               except AttributeError:
+                       dabo.errorLog.write(_("The object %s does not support 
the Visible property.") % self)
+                       return None
        
        def _setVisible(self, val):
                if self._constructed():
-                       self.Show(bool(val))
+                       try:
+                               self.Show(bool(val))
+                       except AttributeError:
+                               dabo.errorLog.write(_("The object %s does not 
support the Visible property.") % self)
                else:
                        self._properties["Visible"] = val
 




_______________________________________________
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