dabo Commit
Revision 3704
Date: 2007-11-16 04:14:06 -0800 (Fri, 16 Nov 2007)
Author: Ed
Trac: http://svn.dabodev.com/trac/dabo/changeset/3704

Changed:
U   trunk/dabo/ui/uiwx/dTextBoxMixin.py
U   trunk/dabo/ui/uiwx/dTimer.py

Log:
Added an explicit call to self.Stop() to dTimer.release(). I ran into 
situations where the timer events continued even after the form (and its timer) 
should have already been destroyed.

Added a fix that prevents format errors with textboxes that have Mask set from 
stopping the flow of the program. Instead, an appropriate message is printed to 
the dabo.errorLog, and execution continues. Thanks to Pedro Vale de Gato for 
this fix.


Diff:
Modified: trunk/dabo/ui/uiwx/dTextBoxMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dTextBoxMixin.py 2007-11-16 12:10:02 UTC (rev 3703)
+++ trunk/dabo/ui/uiwx/dTextBoxMixin.py 2007-11-16 12:14:06 UTC (rev 3704)
@@ -52,7 +52,9 @@
                setter = self.SetValue
                if hasattr(self, "ChangeValue"):
                        setter = self.ChangeValue
-               setter(self.getStringValue(self.Value))
+               val = self.getStringValue(self.Value)
+               print "VAL", val
+               setter(val)
                self.InsertionPosition = insPos
                self.SelectionStart = startPos
                self.SelectionEnd = endPos
@@ -659,9 +661,13 @@
                        # Update the display if it is different from what is 
already displayed
                        # (note that if we did it unconditionally, the user's 
selection could
                        # be reset, which isn't very nice):
-                       if strVal != self.GetValue():
-                               setter(strVal)
-               
+                       if strVal != _oldVal:
+                               try:
+                                       setter(strVal)
+                               except ValueError, e:
+                                       #PVG: maskedtextedit sometimes fails, 
on value error..allow the code to continue
+                                       dabo.errorLog.write(_("Error setting 
value to '%(strVal)s: %(e)s") % locals())
+
                        if type(_oldVal) != type(val) or _oldVal != val:
                                self._afterValueChanged()
                else:

Modified: trunk/dabo/ui/uiwx/dTimer.py
===================================================================
--- trunk/dabo/ui/uiwx/dTimer.py        2007-11-16 12:10:02 UTC (rev 3703)
+++ trunk/dabo/ui/uiwx/dTimer.py        2007-11-16 12:14:06 UTC (rev 3704)
@@ -45,6 +45,12 @@
                return not self.IsRunning()
        
        
+       def release(self):
+               """Make sure that the timer is stopped first"""
+               self.Stop()
+               super(dTimer, self).release()
+       
+       
        # The following methods are not needed except for 
        # compatibility with the various properties.
        def Show(self, val):
@@ -58,17 +64,6 @@
                
                
        # property get/set functions
-       def _getInterval(self):
-               try:
-                       v = self._interval
-               except AttributeError:
-                       v = self._interval = 0
-               return v
-       
-       def _setInterval(self, val):
-               self._interval = val
-       
-       
        def _getEnabled(self):
                return self.IsRunning()
                
@@ -82,15 +77,28 @@
                        self._properties["Enabled"] = val
                        
                
-       Interval = property(_getInterval, _setInterval, None,
-                       _("Specifies the timer interval (milliseconds)."))
-       DynamicInterval = makeDynamicProperty(Interval)
+       def _getInterval(self):
+               try:
+                       v = self._interval
+               except AttributeError:
+                       v = self._interval = 0
+               return v
        
+       def _setInterval(self, val):
+               self._interval = val
+       
+       
        Enabled = property(_getEnabled, _setEnabled, None,
                        _("Alternative means of starting/stopping the timer, or 
determining "
                        "its status. If Enabled is set to True and the timer 
has a positive value "
                        "for its Interval, the timer will be started."))
+
+       Interval = property(_getInterval, _setInterval, None,
+                       _("Specifies the timer interval (milliseconds)."))
+       
+
        DynamicEnabled = makeDynamicProperty(Enabled)
+       DynamicInterval = makeDynamicProperty(Interval)
        
        
 class _dTimer_test(dPanel.dPanel):




_______________________________________________
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]

Reply via email to