dabo Commit
Revision 4494
Date: 2008-09-01 10:54:04 -0700 (Mon, 01 Sep 2008)
Author: Ed
Trac: http://svn.dabodev.com/trac/dabo/changeset/4494
Changed:
U trunk/dabo/ui/uiwx/dGrid.py
Log:
Spent a couple of hours this morning trying to figure out why I couldn't edit
anything in the Class Designer prop sheet. Turns out that the recent addition
of cacheing to the grid prevented *anything* from being edited. I added an
option to force the grid table not to use any cached value when comparing old
and new values.
Diff:
Modified: trunk/dabo/ui/uiwx/dGrid.py
===================================================================
--- trunk/dabo/ui/uiwx/dGrid.py 2008-09-01 16:13:02 UTC (rev 4493)
+++ trunk/dabo/ui/uiwx/dGrid.py 2008-09-01 17:54:04 UTC (rev 4494)
@@ -323,17 +323,17 @@
return True
- def GetValue(self, row, col):
- try:
- cv = self.__cachedVals.get((row, col))
- except KeyError:
- cv = None
+ def GetValue(self, row, col, useCache=True):
+ if useCache:
+ try:
+ cv = self.__cachedVals.get((row, col))
+ except KeyError:
+ cv = None
+ if cv:
+ diff = time.time() - cv[1]
+ if diff < 10: ## if it's been less than this #
of seconds.
+ return cv[0]
- if cv:
- diff = time.time() - cv[1]
- if diff < 10: ## if it's been less than this # of
seconds.
- return cv[0]
-
bizobj = self.grid.getBizobj()
col_obj = self.grid.Columns[col]
field = col_obj.DataField
@@ -351,9 +351,10 @@
ret = ""
if ret is None:
ret = self.grid.NoneDisplay
- self.__cachedVals[(row, col)] = (ret, time.time())
+ self.__cachedVals[(row, col)] = (ret, time.time())
return ret
+
def getStringValue(self, val):
"""Get the string value to display in the grid."""
if isinstance(val, datetime.datetime):
@@ -362,6 +363,7 @@
return dabo.lib.dates.getStringFromDate(val)
return val
+
def SetValue(self, row, col, value):
field = self.grid.Columns[col].DataField
bizobj = self.grid.getBizobj()
@@ -1886,9 +1888,9 @@
self._syncCurrentRow()
- def GetCellValue(self, row, col):
+ def GetCellValue(self, row, col, useCache=True):
try:
- ret = self._Table.GetValue(row, col)
+ ret = self._Table.GetValue(row, col, useCache=useCache)
except AttributeError:
ret = super(dGrid, self).GetCellValue(row, col)
return ret
@@ -3123,7 +3125,7 @@
bizobj = self.getBizobj()
row, col = evt.EventData["row"], evt.EventData["col"]
fld = self.Columns[col].DataField
- newVal = self.GetCellValue(row, col)
+ newVal = self.GetCellValue(row, col, useCache=False)
if bizobj:
oldVal = bizobj.getFieldVal(fld, row)
else:
_______________________________________________
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]