dabo Commit
Revision 6698
Date: 2011-07-10 09:17:34 -0700 (Sun, 10 Jul 2011)
Author: Jacekk
Trac: http://trac.dabodev.com/changeset/6698

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

Log:
Few improvements in _checkForceCase method.

Diff:
Modified: trunk/dabo/ui/uiwx/dTextBoxMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dTextBoxMixin.py 2011-07-10 16:10:02 UTC (rev 6697)
+++ trunk/dabo/ui/uiwx/dTextBoxMixin.py 2011-07-10 16:17:34 UTC (rev 6698)
@@ -7,6 +7,7 @@
 import wx.lib.masked as masked
 import dabo.lib.dates
 import dKeys
+from dabo.dLocalize import _
 from dabo.lib.utils import ustr
 import decimal
 numericTypes = (int, long, decimal.Decimal, float)
@@ -134,7 +135,8 @@
                if not self:
                        # The control is being destroyed
                        return
-               if not isinstance(self.Value, basestring):
+               currVal = self.Value
+               if not isinstance(currVal, basestring):
                        # Don't bother if it isn't a string type
                        return
                case = self.ForceCase
@@ -142,22 +144,19 @@
                        return
                insPos = self.InsertionPosition
                selLen = self.SelectionLength
-               changed = False
                self._inForceCase = True
                if case == "upper":
-                       self.Value = self.Value.upper()
-                       changed = True
+                       newValue = currVal.upper()
                elif case == "lower":
-                       self.Value = self.Value.lower()
-                       changed = True
+                       newValue = currVal.lower()
                elif case == "title":
-                       self.Value = self.Value.title()
-                       changed = True
-               if changed:
-                       #self.SelectionStart = selStart
+                       newValue = currVal.title()
+               else:
+                       newValue = currVal
+               if currVal <> newValue:
+                       self.Value = newValue
                        self.InsertionPosition = insPos
                        self.SelectionLength = selLen
-                       self.refresh()
                self._inForceCase = False
 
 
@@ -337,7 +336,7 @@
                        else:
                                val = int(val)
                                if val < 1:
-                                       raise ValueError('TextLength must be a 
positve Integer')
+                                       raise ValueError(_("TextLength must be 
a positve Integer"))
                                self._textLength = val
                        self._checkTextLength()
 



_______________________________________________
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