dabo Commit
Revision 4589
Date: 2008-10-24 08:50:48 -0700 (Fri, 24 Oct 2008)
Author: Paul
Trac: http://svn.dabodev.com/trac/dabo/changeset/4589

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

Log:
Fixed dGrid.addColumn() to accept not just a custom dColumn instance, but also 
a 
custom dColumn subclass, which it'll instantiate with any passed property
settings. If an instance is passed, the properties will be applied to the
instance.



Diff:
Modified: trunk/dabo/ui/uiwx/dGrid.py
===================================================================
--- trunk/dabo/ui/uiwx/dGrid.py 2008-10-23 22:40:45 UTC (rev 4588)
+++ trunk/dabo/ui/uiwx/dGrid.py 2008-10-24 15:50:48 UTC (rev 4589)
@@ -2917,13 +2917,20 @@
        def addColumn(self, col=None, inBatch=False, *args, **kwargs):
                """ Adds a column to the grid.
 
-               If no column is passed, a blank dColumn is added, which can be 
customized
-               later. Any extra keyword arguments are passed to the 
constructor of the
-               new dColumn.
+               If no col (class or instance) is passed, a blank dColumn is 
added, which 
+               can be customized       later. Any extra keyword arguments are 
passed to the 
+               constructor of the new dColumn.
                """
                if col is None:
                        col = self.ColumnClass(self, *args, **kwargs)
                else:
+                       if not isinstance(col, dColumn):
+                               if issubclass(col, dabo.ui.dColumn):
+                                       col = col(self, *args, **kwargs)
+                               else:
+                                       raise ValueError, _("col must be a 
dColumn subclass or instance")
+                       else:
+                               col.setProperties(**kwargs)
                        col.Parent = self
 
                if col.Order == -1:




_______________________________________________
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