dabo Commit
Revision 2704
Date: 2007-01-16 14:44:03 -0800 (Tue, 16 Jan 2007)
Author: Paul

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

Log:
I noticed that the column order in dGrid wasn't being restored (it was
being persisted though). It came down to some comparison problems.
Fixed.


Diff:
Modified: trunk/dabo/ui/uiwx/dGrid.py
===================================================================
--- trunk/dabo/ui/uiwx/dGrid.py 2007-01-16 22:42:24 UTC (rev 2703)
+++ trunk/dabo/ui/uiwx/dGrid.py 2007-01-16 22:44:03 UTC (rev 2704)
@@ -1,4 +1,5 @@
 # -*- coding: utf-8 -*-
+import copy
 import sys
 import datetime
 import locale
@@ -108,15 +109,13 @@
                        
        def setColumns(self, colDefs):
                """Create columns based on passed list of column definitions."""
-               # Column order should already be in the definition. If there is 
a custom
-               # setting by the user, override it.
-
-               # See if the defs have changed. If not, update any column info,
-               # and return. If so, clear the data to force a re-draw of the 
table.
                if colDefs == self.colDefs:
-                       self.setColumnInfo()
+                       # Already done, no need to take the time.
                        return
 
+               app = self.grid.Application
+               form = self.grid.Form
+
                for idx, col in enumerate(colDefs):
                        nm = col.DataField
                        while not nm:
@@ -125,8 +124,6 @@
                                if nm in colDefs:
                                        nm = ""
                        colName = "Column_%s" % nm
-                       app = self.grid.Application
-                       form = self.grid.Form
 
                        pos = col._getUserSetting("Order")
                        if pos is not None:
@@ -166,17 +163,12 @@
                        if col.Order < 0:
                                col.Order = num
                colDefs.sort(self.orderSort)
-               self.colDefs = colDefs
-               self.setColumnInfo()
+               self.colDefs = copy.copy(colDefs)
        
        def orderSort(self, col1, col2):
                return cmp(col1.Order, col2.Order)
                
                
-       def setColumnInfo(self):
-               self.colDefs.sort(self.orderSort)
-
-
        def convertType(self, typ):
                """Convert common types, names and abbreviations for 
                data types into the constants needed by the wx.grid.




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev

Reply via email to