dabo Commit
Revision 5123
Date: 2009-03-13 13:17:02 -0700 (Fri, 13 Mar 2009)
Author: Paul
Trac: http://trac.dabodev.com/changeset/5123

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

Log:
Fixed dGrid's refresh() to merely repaint the grid and cells, instead of also
syncing up the rows and columns.

Fixed dGrid's update() to not do the callAfter() - I have a feeling that the 
note on performance was from a prior era because my large grids are updating
instantaneously.



Diff:
Modified: trunk/dabo/ui/uiwx/dGrid.py
===================================================================
--- trunk/dabo/ui/uiwx/dGrid.py 2009-03-13 18:52:02 UTC (rev 5122)
+++ trunk/dabo/ui/uiwx/dGrid.py 2009-03-13 20:17:02 UTC (rev 5123)
@@ -232,7 +232,7 @@
 
                if _oldRowCount == _newRowCount and not force:
                        return _newRowCount
-
+               
                self.grid._syncRowCount()
                # Column widths come from multiple places. In decreasing 
precedence:
                #   1) dApp user settings,
@@ -1892,18 +1892,24 @@
 
 
        def update(self):
-               """We need to re-sync various properties after the data is 
updated. However,
-               with very large grids, multiple update calls can result in 
problems. So we 
-               use a callAfterInterval() to eliminate the duplicate calls.
+               """Call this when your datasource or dataset has changed to get 
the grid showing
+               the proper number of rows with current data.
                """
-               dabo.ui.callAfterInterval(100, self._updateSync)
-       def _updateSync(self):          
-               super(dGrid, self).update
-               self._Table._clearCache()
+               # Note that we never call self.super(), because we don't 
need/want that behavior.
                self._syncRowCount()
+               self._syncCurrentRow()
+               self.refresh()  ## to clear the cache and repaint the cells
+
+
+       def _syncAll(self):
+               self._syncRowCount()
                self._syncColumnCount()
                self._syncCurrentRow()
 
+       def refresh(self):
+               """Repaint the grid."""
+               self._Table._clearCache()  ## Make sure the proper values are 
filled into the cells
+               super(dGrid, self).refresh()
 
        def _refreshHeader(self):
                self._getWxHeader().Refresh()
@@ -3046,14 +3052,6 @@
                return None
 
 
-       def refresh(self):
-               self._Table._clearCache()
-               self._syncColumnCount()
-               self._syncRowCount()
-               self._syncCurrentRow()
-               super(dGrid, self).refresh()
-
-
        def _getWxHeader(self):
                """Return the wx grid header window."""
                return self.GetGridColLabelWindow()



_______________________________________________
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