dabo Commit
Revision 7052
Date: 2012-01-13 15:17:19 -0800 (Fri, 13 Jan 2012)
Author: Paul
Trac: http://trac.dabodev.com/changeset/7052
Changed:
U trunk/dabo/ui/uiwx/dGrid.py
Log:
Fixed dColumn so that you don't have to explicitly tell it the DataType
when this can be implicitly gleaned from the bizobj's DataStructure.
Diff:
Modified: trunk/dabo/ui/uiwx/dGrid.py
===================================================================
--- trunk/dabo/ui/uiwx/dGrid.py 2012-01-12 19:59:03 UTC (rev 7051)
+++ trunk/dabo/ui/uiwx/dGrid.py 2012-01-13 23:17:19 UTC (rev 7052)
@@ -468,6 +468,9 @@
self._headerForeColor = None
self._headerBackColor = None
+ dataFieldSent = "DataField" in kwargs
+ dataTypeSent = "DataType" in kwargs
+
self._beforeInit()
kwargs["Parent"] = parent
# dColumn maintains one attr object that the grid table will
use for
@@ -481,7 +484,10 @@
*args, **kwargs)
self._baseClass = dColumn
+ if dataFieldSent and not dataTypeSent:
+ self._setDataTypeFromDataField()
+
def _beforeInit(self):
# Define the cell renderer and editor classes
import gridRenderers
@@ -710,18 +716,16 @@
self._setUserSetting(prop, getattr(self, prop))
- def _setDataTypeFromDataField(self, fld):
+ def _setDataTypeFromDataField(self):
"""
When a column has its DataField changed, we need to set the
correct DataType based on the new value.
"""
if self.Parent:
currDT = self.DataType
- dt = self.Parent.typeFromDataField(fld)
+ dt = self.Parent.typeFromDataField(self.DataField)
if dt is not None and (dt != currDT):
self.DataType = dt
- self._updateRenderer()
- self._updateEditor()
def _getUserSetting(self, prop):
@@ -1021,7 +1025,7 @@
if self._constructed():
if self._dataField:
# Use a callAfter, since the parent may not be
finished instantiating yet.
-
dabo.ui.callAfter(self._setDataTypeFromDataField, val)
+
dabo.ui.callAfter(self._setDataTypeFromDataField)
self._dataField = val
if not self.Name or self.Name == "?":
self._name = _("col_%s") % val
_______________________________________________
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]