dabo Commit
Revision 4204
Date: 2008-06-27 15:49:18 -0700 (Fri, 27 Jun 2008)
Author: Paul
Trac: http://svn.dabodev.com/trac/dabo/changeset/4204

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

Log:
Added VisibleOnScreen property to all ui controls. This is a read-only
property that tells you if the object is actually visible or not,
taking into account visibility of parent objects and sizers.

Fixed a problem in the getter of dSizerMixin.Visible: querying it when
it hadn't been explicitly set would result in an AttributeError.



Diff:
Modified: trunk/dabo/ui/uiwx/dPemMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dPemMixin.py     2008-06-27 12:20:04 UTC (rev 4203)
+++ trunk/dabo/ui/uiwx/dPemMixin.py     2008-06-27 22:49:18 UTC (rev 4204)
@@ -2498,6 +2498,10 @@
                else:
                        self._properties["Visible"] = val
 
+       
+       def _getVisibleOnScreen(self):
+               return self.IsShownOnScreen()
+
                
        def _getWidth(self):
                return self.GetSize()[0]
@@ -2724,7 +2728,17 @@
 
        Visible = property(_getVisible, _setVisible, None,
                        _("Specifies whether the object is visible at runtime.  
(bool)") )
-       
+
+       VisibleOnScreen = property(_getVisibleOnScreen, None, None, 
+                       _("""Specifies whether the object is physically visible 
at runtime.  (bool)     
+
+                       The Visible property could return True even if the 
object isn't actually
+                       shown on screen, due to a parent object or sizer being 
invisible.
+
+                       The VisibleOnScreen property will return True only if 
the object and all
+                       parents are visible.
+                       """))
+
        Width = property(_getWidth, _setWidth, None,
                        _("The width of the object. (int)") )
        

Modified: trunk/dabo/ui/uiwx/dSizerMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dSizerMixin.py   2008-06-27 12:20:04 UTC (rev 4203)
+++ trunk/dabo/ui/uiwx/dSizerMixin.py   2008-06-27 22:49:18 UTC (rev 4204)
@@ -807,8 +807,13 @@
                                        
                
        def _getVisible(self):
-               return self._visible
-               
+               try:
+                       return self._visible
+               except AttributeError:
+                       default = True
+                       self._setVisible(default)
+                       return default
+                       
        def _setVisible(self, val):
                if isinstance(val, basestring):
                        val = (val.lower()[0] in ("t", "y"))
@@ -876,7 +881,7 @@
                        sizers, it is the object that the outermost sizer 
belongs to. (obj)"""))
        
        Visible = property(_getVisible, _setVisible, None, 
-                       _("Shows/hides the sizer and its contained items  
(bool)" ) )
+                       _("Specifies whether the sizer and contained items are 
shown  (bool)" ) )
 
        Width = property(_getWd, 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