dabo Commit
Revision 6870
Date: 2011-10-03 13:16:36 -0700 (Mon, 03 Oct 2011)
Author: Paul
Trac: http://trac.dabodev.com/changeset/6870

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

Log:
I tried to set a grid column's DynamicVisible property, and while it worked to 
hide
the column dynamically, the column wouldn't ever become visible again. Turns 
out,
dynamic property evaluation wasn't ever being run for invisible columns because
column visibility is pure Dabo, while running dynamic property evaluations is 
triggered from wx. This fixes the issue by forcing updating of dynamic column
properties for invisible columns during the grid's refresh.

Future enhancement of this would be to only update visibility, since we probably
don't care about anything else (other dynamic props can be updated after the 
column is visible again).


Diff:
Modified: trunk/dabo/ui/uiwx/dGrid.py
===================================================================
--- trunk/dabo/ui/uiwx/dGrid.py 2011-10-03 12:10:54 UTC (rev 6869)
+++ trunk/dabo/ui/uiwx/dGrid.py 2011-10-03 20:16:36 UTC (rev 6870)
@@ -1427,8 +1427,7 @@
        def _setVisible(self, val):
                if self._constructed():
                        self._visible = val
-                       if self.Parent:
-                               self.Parent.showColumn(self, val)
+                       self.Parent.showColumn(self, val)
                else:
                        self._properties["Visible"] = val
 
@@ -2002,8 +2001,16 @@
 
        def refresh(self):
                """Repaint the grid."""
+               if getattr(self, "__inRefresh", False):
+                       return
+               self.__inRefresh = True
                self._Table._clearCache()  ## Make sure the proper values are 
filled into the cells
+               
+               # Force invisible column dynamic properties to update (possible 
to make Visible again):
+               invisible_cols = [c._updateDynamicProps() for c in self.Columns 
if not c.Visible]
+
                super(dGrid, self).refresh()
+               self.__inRefresh = False
 
 
        def _refreshHeader(self):
@@ -2720,7 +2727,8 @@
                                return
                col._visible = visible
                self._syncColumnCount()
-               self.refresh()
+               if getattr(self.Parent, "__inRefresh", False):
+                       self.refresh()
 
 
        def moveColumn(self, colNum, toNum):



_______________________________________________
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