dabo Commit
Revision 3138
Date: 2007-05-26 07:20:27 -0700 (Sat, 26 May 2007)
Author: Ed
Trac: http://svn.dabodev.com/trac/dabo/changeset/3138
Changed:
U trunk/dabo/ui/uiwx/dTextBoxMixin.py
Log:
Fixed an edge-case problem that can throw errors as the text control is being
destroyed.
Diff:
Modified: trunk/dabo/ui/uiwx/dTextBoxMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dTextBoxMixin.py 2007-05-25 23:49:07 UTC (rev 3137)
+++ trunk/dabo/ui/uiwx/dTextBoxMixin.py 2007-05-26 14:20:27 UTC (rev 3138)
@@ -18,6 +18,7 @@
import dabo.dEvents as dEvents
from dabo.ui import makeDynamicProperty
+
class dTextBoxMixinBase(dcm.dDataControlMixin):
def __init__(self, preClass, parent, properties=None,
attProperties=None, *args, **kwargs):
self._forceCase = None
@@ -46,6 +47,7 @@
# Now that the dabo Value is set properly, the default behavior
that flushes
# the value to the bizobj can be called:
super(dTextBoxMixinBase, self).flushValue()
+
def getStringValue(self, val):
"""Hook function if you want to implement dataTypes other than
str"""
@@ -65,15 +67,22 @@
def __onKeyChar(self, evt):
"""This handles KeyChar events when ForceCase is set to a
non-empty value."""
+ if not self:
+ # The control is being destroyed
+ return
keyChar = evt.keyChar
if keyChar is not None and (keyChar.isalnum()
or keyChar in """,./<>?;':"[]\\{}|[EMAIL
PROTECTED]&*()-_=+"""):
dabo.ui.callAfter(self._checkForceCase)
dabo.ui.callAfter(self._checkTextLength)
+
def _checkTextLength(self):
"""If the TextLength property is set, checks the current value
of the control
and truncates it if too long"""
+ if not self:
+ # The control is being destroyed
+ return
if not isinstance(self.Value, basestring):
#Don't bother if it isn't a string type
return
@@ -82,7 +91,6 @@
return
insPos = self.InsertionPosition
-
self._inTextLength = True
if len(self.Value) > length:
self.Value = self.Value[:length]
@@ -93,10 +101,14 @@
self.refresh()
self._inTextLength = False
+
def _checkForceCase(self):
"""If the ForceCase property is set, casts the current value of
the control
to the specified case.
"""
+ if not self:
+ # The control is being destroyed
+ return
if not isinstance(self.Value, basestring):
# Don't bother if it isn't a string type
return
@@ -624,4 +636,5 @@
# Dynamic property declarations
DynamicPasswordEntry = makeDynamicProperty(PasswordEntry)
DynamicStrictDateEntry = makeDynamicProperty(StrictDateEntry)
- DynamicValue = makeDynamicProperty(Value)
\ No newline at end of file
+ DynamicValue = makeDynamicProperty(Value)
+
\ No newline at end of file
_______________________________________________
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/dabo-dev/[EMAIL PROTECTED]