Change the setter to self._usePlainValue = bool(val), and fix the typo in the
property docstring, and I say go for it!
Paul
johnf wrote:
> Hi,
> Just waiting for the OK.
>
> --- dabo/ui/uiwx/dTextBoxMixin.py (revision 4702)
> +++ dabo/ui/uiwx/dTextBoxMixin.py (working copy)
> @@ -614,7 +614,10 @@
> # Get the string value as reported by wx, which is the
> up-to-date
> # string value of the control:
> if isinstance(self, masked.TextCtrl) and hasattr(self,
> "_template"):
> - strVal = self.GetPlainValue()
> + if self.UsePlainValue:
> + strVal = self.GetPlainValue()
> + else:
> + strVal = self.GetValue()
> else:
> strVal = self.GetValue()
>
> Index: dabo/ui/uiwx/dMaskedTextBox.py
> ===================================================================
> --- dabo/ui/uiwx/dMaskedTextBox.py (revision 4702)
> +++ dabo/ui/uiwx/dMaskedTextBox.py (working copy)
> @@ -65,27 +65,37 @@
> "ip": "IPADDR"}
>
>
> - def __init__(self, parent, properties=None, attProperties=None, *args,
> **kwargs):
> + def __init__(self, parent, properties=None, attProperties=None, *args,
> **kwargs):
> self._baseClass = dMaskedTextBox
> self._mask = self._extractKey((properties, attProperties,
> kwargs), "Mask", "")
> self._format = self._extractKey((properties, attProperties,
> kwargs), "Format", "")
> + self._validregex = self._extractKey((properties, attProperties,
> kwargs), "ValidRegex", "")
> self._inputCodes =
> self._uniqueCodes(self._extractKey((properties,
> attProperties, kwargs),
> "InputCodes", "_>"))
> kwargs["mask"] = self._mask
> kwargs["formatcodes"] = self._inputCodes
> + kwargs["validRegex"] = self._validregex
> if self._format:
> code = self._formatMap.get(self._format.lower(), "")
> if code:
> kwargs["autoformat"] = code
> kwargs.pop("mask")
> kwargs.pop("formatcodes")
> + kwargs.pop("validRegex")
> kwargs["useFixedWidthFont"] = False
>
> preClass = wx.lib.masked.TextCtrl
> tbm.dTextBoxMixin.__init__(self, preClass, parent, properties,
> attProperties,
> *args, **kwargs)
> +
> +
> +
> + def _getUsePlainValue(self):
> + return getattr(self, "_usePlainValue", False)
> +
> + def _setUsePlainValue(self, val):
> + self._usePlainValue = val
>
> -
> def getFormats(cls):
> """Return a list of available format codes."""
> return cls._formatMap.keys()
> @@ -257,6 +267,8 @@
>
> MaskedValue = property(_getMaskedValue, None, None,
> _("Value of the control, including mask characters, if
> any. (read-only)
> (str)"))
> + UsePlainValue = property(_getUsePlainValue, _setUsePlainValue, None,
> + _("Specifies whether or not to use the GetPlanValue or
> GetValue. (bool)"))
_______________________________________________
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]