dabo Commit
Revision 5503
Date: 2009-10-27 14:47:32 -0700 (Tue, 27 Oct 2009)
Author: Paul
Trac: http://trac.dabodev.com/changeset/5503

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

Log:
When debugging, I got spurious errors trying to print information out in the 
beforeInit cycle, based on dObject.__repr__ which calls _getId() and 
_getName(), overridden in dPemMixin. These dPemMixin calls fail in the preinit 
cycle with TypeError, so add that class of exception to the alternative 
fail-gracefully scenario.

Diff:
Modified: trunk/dabo/ui/uiwx/dPemMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dPemMixin.py     2009-10-27 20:09:54 UTC (rev 5502)
+++ trunk/dabo/ui/uiwx/dPemMixin.py     2009-10-27 21:47:32 UTC (rev 5503)
@@ -771,8 +771,10 @@
                """Override the default behavior to return the wxPython ID."""
                try:
                        ret = self.GetId()
-               except AttributeError:
-                       # Object doesn't support GetID()
+               except (TypeError, AttributeError):
+                       # Object doesn't support GetID(), which includes trying
+                       # to get the id of a not-yet-fully-instantiated wxPython
+                       # object. 
                        ret = super(dPemMixin, self)._getID()
                return ret
 
@@ -2235,9 +2237,10 @@
        def _getName(self):
                try:
                        name = self.GetName()
-               except AttributeError:
+               except (TypeError, AttributeError):
                        # Some objects that inherit from dPemMixin (dMenu*) 
don't have GetName()
-                       # or SetName() methods.
+                       # or SetName() methods. Or, the wxPython object isn't 
fully
+                       # instantiated yet.
                        name = self._name
                # keep name available even after C++ object is gone:
                self._name = name

Modified: trunk/dabo/ui/uiwx/dSpinner.py
===================================================================
--- trunk/dabo/ui/uiwx/dSpinner.py      2009-10-27 20:09:54 UTC (rev 5502)
+++ trunk/dabo/ui/uiwx/dSpinner.py      2009-10-27 21:47:32 UTC (rev 5503)
@@ -270,6 +270,19 @@
 
 
        # Property get/set definitions begin here
+       def _getButtonWidth(self):
+               return self._proxy_spinner.Width
+
+       def _setButtonWidth(self, val):
+               print "buttonWidth"
+               if self._constructed():
+                       print 1
+                       #raise NotImplementedError, "Can't set ButtonWidth 
after initProperties"
+                       self._proxy_spinner.Width = val
+               else:
+                       print 2
+                       self._properties["ButtonWidth"] = val
+
        def _getChildren(self):
                # The native wx control will return the items that make up this 
composite
                # control, which our user doesn't want.
@@ -339,6 +352,9 @@
 
 
 
+       ButtonWidth = property(_getButtonWidth, _setButtonWidth, None,
+                       _("""Allows the developer to explicitly specify the 
width of the up/down buttons."""))
+
        Children = property(_getChildren, None, None, 
                        _("""Returns a list of object references to the 
children of 
                        this object. Only applies to containers. Children will 
be None for 




_______________________________________________
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