dabo Commit
Revision 6175
Date: 2010-10-29 15:20:20 -0700 (Fri, 29 Oct 2010)
Author: Ed
Trac: http://trac.dabodev.com/changeset/6175

Changed:
U   trunk/dabo/ui/uiwx/dSpinner.py

Log:
Added type conversion if Max/Min and Value were not both Decimal or Float.


Diff:
Modified: trunk/dabo/ui/uiwx/dSpinner.py
===================================================================
--- trunk/dabo/ui/uiwx/dSpinner.py      2010-10-27 12:55:57 UTC (rev 6174)
+++ trunk/dabo/ui/uiwx/dSpinner.py      2010-10-29 22:20:20 UTC (rev 6175)
@@ -243,12 +243,19 @@
                """
                pt = self._proxy_textbox
                val = pt.Value
-               if (val > self.Max) or (val < self.Min):
+               def _wrapType(compval):
+                       tv = type(val)
+                       if tv != type(compval):
+                               try:
+                                       ret = tv(compval)
+                               except TypeError:
+                                       ret = tv(str(compval))
+                       return ret
+               if (val > _wrapType(self.Max)) or (val < _wrapType(self.Min)):
                        pt.Value = pt._oldVal
                evt.Skip()
-               #pt._oldVal = self.Value
-               #self.flushValue()
 
+
        def _numericStringVal(self, val):
                """If passed a string, attempts to convert it to the 
appropriate numeric
                type. If such a conversion is not possible, returns None.



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

Reply via email to