dabo Commit
Revision 6409
Date: 2011-02-07 18:02:06 -0800 (Mon, 07 Feb 2011)
Author: Ed
Trac: http://trac.dabodev.com/changeset/6409

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

Log:
Added the 'Form' property to sizers. It will return the form with which the 
sizer is associated, or None. 

Fixed some logic in the _getParent property.



Diff:
Modified: trunk/dabo/ui/uiwx/dSizerMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dSizerMixin.py   2011-02-07 21:06:00 UTC (rev 6408)
+++ trunk/dabo/ui/uiwx/dSizerMixin.py   2011-02-08 02:02:06 UTC (rev 6409)
@@ -820,7 +820,16 @@
                self._defaultSpacing = val
 
 
-       def _getHt(self):
+       def _getForm(self):
+               parent = self.Parent
+               if isinstance(parent, dabo.ui.dFormMixin):
+                       return parent
+               elif isinstance(parent, dabo.ui.dPemMixin):
+                       return parent.Form
+               return None
+
+
+       def _getHeight(self):
                return self.GetSize()[1]
 
 
@@ -848,8 +857,8 @@
                        # sizers to find the parent object
                        cs = ob.ControllingSizer
                        if cs is None:
-                               # Something's wrong!
-                               raise RuntimeError(_("Nested sizer missing its 
ControllingSizer"))
+                               # The sizer is not nested; it is "unattached"
+                               return None
                        else:
                                ob = cs
                                ret = ob._parent
@@ -874,7 +883,7 @@
                self.ShowItems(val)
 
 
-       def _getWd(self):
+       def _getWidth(self):
                return self.GetSize()[0]
 
 
@@ -936,7 +945,10 @@
        DefaultSpacing = property(_getDefaultSpacing, _setDefaultSpacing, None,
                        _("Amount of space automatically inserted between 
elements.  (int)"))
 
-       Height = property(_getHt, None, None,
+       Form = property(_getForm, None, None,
+                       _("Form with which the sizer is associated.  (dForm or 
None)"))
+
+       Height = property(_getHeight, None, None,
                        _("Height of the sizer  (int)"))
 
        Orientation = property(_getOrientation, _setOrientation, None,
@@ -949,7 +961,7 @@
        Visible = property(_getVisible, _setVisible, None,
                        _("Specifies whether the sizer and contained items are 
shown  (bool)"))
 
-       Width = property(_getWd, None, None,
+       Width = property(_getWidth, None, None,
                        _("Width of this sizer  (int)"))
 
 



_______________________________________________
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