Changeset 3257
- Timestamp:
- 07/17/07 11:39:36 (1 year ago)
- Files:
-
- trunk/dabo/ui/uiwx/dPemMixin.py (modified) (3 diffs)
- trunk/dabo/ui/uiwx/dTextBox.py (modified) (5 diffs)
- trunk/dabo/ui/uiwx/dTextBoxMixin.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/dabo/ui/uiwx/dPemMixin.py
r3248 r3257 1835 1835 1836 1836 1837 def _get Font(self):1837 def _getDaboFont(self): 1838 1838 if hasattr(self, "_font"): 1839 1839 v = self._font … … 1842 1842 return v 1843 1843 1844 def _set Font(self, val):1844 def _setDaboFont(self, val): 1845 1845 assert isinstance(val, dabo.ui.dFont) 1846 1846 if self._constructed(): … … 2466 2466 _("""Specifies whether the object and children can get user input. (bool)""") ) 2467 2467 2468 Font = property(_get Font, _setFont, None,2468 Font = property(_getDaboFont, _setDaboFont, None, 2469 2469 _("Specifies font object for this control. (dFont)") ) 2470 2470 trunk/dabo/ui/uiwx/dTextBox.py
r3120 r3257 3 3 import datetime 4 4 import wx 5 6 import dabo , dabo.ui5 import wx.lib.masked as masked 6 import dabo 7 7 if __name__ == "__main__": 8 8 dabo.ui.loadUI("wx") … … 15 15 self._baseClass = dTextBox 16 16 17 preClass = wx.PreTextCtrl 17 msk = self._extractKey((properties, attProperties, kwargs), "Mask") 18 if msk is not None: 19 kwargs["mask"] = msk 20 kwargs["formatcodes"] = "_" 21 def _preMask(): 22 return wx.lib.masked.TextCtrl 23 preClass = wx.lib.masked.TextCtrl 24 25 dTextBox.__bases__ = (tbm.dTextBoxMixin, masked.TextCtrl) 26 else: 27 preClass = wx.PreTextCtrl 28 18 29 tbm.dTextBoxMixin.__init__(self, preClass, parent, properties, attProperties, 19 30 *args, **kwargs) … … 33 44 class TestBase(dTextBox): 34 45 def initProperties(self): 46 self.SelectOnEntry = True 35 47 self.super() 36 48 self.LogEvents = ["ValueChanged",] … … 38 50 def onValueChanged(self, evt): 39 51 if self.IsSecret: 40 print "%s changed, but the new value is a secret! " % self.Name52 print "%s changed, but the new value is a secret! " % self.Name, 41 53 else: 42 print "%s.onValueChanged:" % self.Name, self.Value, type(self.Value) 43 54 print "%s.onValueChanged:" % self.Name, self.Value, type(self.Value), 55 if self.Mask: 56 print "Masked Value:", self.MaskedValue 57 else: 58 print 44 59 45 60 class IntText(TestBase): … … 74 89 self.Value = datetime.datetime.now() 75 90 76 testParms = [IntText, FloatText, StrText, PWText, BoolText, DateText, DateTimeText] 91 class MaskedText(TestBase): 92 def __init__(self, *args, **kwargs): 93 kwargs["Mask"] = "(###) ###-####" 94 super(MaskedText, self).__init__(*args, **kwargs) 95 96 testParms = [IntText, FloatText, StrText, PWText, BoolText, DateText, DateTimeText, MaskedText] 77 97 78 98 try: trunk/dabo/ui/uiwx/dTextBoxMixin.py
r3235 r3257 3 3 import datetime 4 4 import wx 5 import wx.lib.masked as masked 5 6 import dabo.lib.dates 6 7 … … 381 382 def __init__(self, preClass, parent, properties=None, attProperties=None, *args, **kwargs): 382 383 self._dregex = {} 384 self._mask = None 383 385 self._lastDataType = unicode 384 386 … … 525 527 526 528 # property get/set functions 529 def _getMask(self): 530 return self._mask 531 532 def _setMask(self, val): 533 if self._constructed(): 534 self._mask = val 535 try: 536 self.SetMask(val) 537 except AttributeError: 538 raise TypeError, _("You must initialize the Mask property when the control is constructed.") 539 else: 540 self._properties["Mask"] = val 541 542 543 def _getMaskedValue(self): 544 return self.GetValue() 545 546 527 547 def _getPasswordEntry(self): 528 548 return self._hasWindowStyleFlag(wx.TE_PASSWORD) … … 559 579 # Get the string value as reported by wx, which is the up-to-date 560 580 # string value of the control: 561 strVal = self.GetValue() 581 if isinstance(self, masked.TextCtrl) and hasattr(self, "_template"): 582 strVal = self.GetPlainValue() 583 else: 584 strVal = self.GetValue() 562 585 563 586 # Convert the current string value of the control, as entered by the … … 637 660 638 661 # Property definitions: 662 Mask = property(_getMask, _setMask, None, 663 _("Display Mask for the control (str)")) 664 665 MaskedValue = property(_getMaskedValue, None, None, 666 _("Value of the control, including mask characters, if any. (read-only) (str)")) 667 639 668 PasswordEntry = property(_getPasswordEntry, _setPasswordEntry, None, 640 669 _("Specifies whether plain-text or asterisks are echoed. (bool)"))
