dabo Commit
Revision 7084
Date: 2012-02-08 07:59:33 -0800 (Wed, 08 Feb 2012)
Author: Jacekk
Trac: http://trac.dabodev.com/changeset/7084
Changed:
U trunk/dabo/ui/dDataControlMixinBase.py
Log:
Added some checks to prevent the flushValue() method recursive call if data
source is bound to widget property.
This is a second attempt with fixed (hope) errors reported by Paul.
Diff:
Modified: trunk/dabo/ui/dDataControlMixinBase.py
===================================================================
--- trunk/dabo/ui/dDataControlMixinBase.py 2012-02-08 14:56:44 UTC (rev
7083)
+++ trunk/dabo/ui/dDataControlMixinBase.py 2012-02-08 15:59:33 UTC (rev
7084)
@@ -71,6 +71,8 @@
if not self._fldValidFailed:
self._oldVal = self.Value
self._fldValidFailed = False
+ # Reset flushing flag.
+ self._from_flushValue = False
try:
if self.SelectOnEntry:
self.selectAll()
@@ -213,6 +215,8 @@
Save any changes to the underlying source field. First check to
make sure
that any changes are validated.
"""
+ if self._from_flushValue:
+ return True
# We need to test empty oldvals because of the way that
textboxes work; they
# can set _oldVal to "" before the actual Value is set.
if (not self._oldVal) or (self._oldVal != self.Value):
@@ -247,6 +251,10 @@
else:
isChanged = (curVal != oldVal)
if isChanged:
+ # In some situations, e.g. if control is bound to
widget property, changes of property
+ # value can cause recursive call to the flushValue()
method.
+ # To prevent such situation we have to check the
_from_flushValue attribute at the beginning.
+ self._from_flushValue = True
if not self._DesignerMode:
if (self.DataSource or
isinstance(self.DataSource, dabo.dPref)) and self.DataField:
src = self.Source
@@ -292,7 +300,6 @@
nm =
ustr(self.DataSource)
dabo.log.error("Could not bind to '%s.%s'\nReason: %s" % (nm, self.DataField,
e))
self._oldVal = curVal
- self._from_flushValue = True
self._afterValueChanged()
self._from_flushValue = False
# Raise an event so that user code can react if needed:
_______________________________________________
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]