| 63 | | def selectAll(self): |
|---|
| 64 | | """Each subclass must define their own selectAll method. This will |
|---|
| 65 | | be called if SelectOnEntry is True when the control gets focus. |
|---|
| 66 | | """ |
|---|
| 67 | | self.SetSelection(-1, -1) |
|---|
| 68 | | |
|---|
| 69 | | |
|---|
| 70 | | def getBlankValue(self): |
|---|
| 71 | | return "" |
|---|
| 72 | | |
|---|
| 73 | | |
|---|
| 74 | | def convertStringValueToDataType(self, strVal, dataType): |
|---|
| 75 | | """Given a string value and a type, return an appropriate value of that type. |
|---|
| 76 | | |
|---|
| 77 | | If the value can't be converted, a ValueError will be raised. |
|---|
| 78 | | """ |
|---|
| 79 | | if dataType == bool: |
|---|
| 80 | | # Bools can't convert from string representations, because a zero- |
|---|
| 81 | | # length denotes False, and anything else denotes True. |
|---|
| 82 | | if strVal == "True": |
|---|
| 83 | | retVal = True |
|---|
| 84 | | else: |
|---|
| 85 | | retVal = False |
|---|
| 86 | | |
|---|
| 87 | | elif dataType in (datetime.date, datetime.datetime, datetime.time): |
|---|
| 88 | | # We expect the string to be in ISO 8601 format. |
|---|
| 89 | | if dataType == datetime.date: |
|---|
| 90 | | retVal = self._getDateFromString(strVal) |
|---|
| 91 | | elif dataType == datetime.datetime: |
|---|
| 92 | | retVal = self._getDateTimeFromString(strVal) |
|---|
| 93 | | elif dataType == datetime.time: |
|---|
| 94 | | retVal = self._getTimeFromString(strVal) |
|---|
| 95 | | |
|---|
| 96 | | if retVal is None: |
|---|
| 97 | | raise ValueError, "String not in ISO 8601 format." |
|---|
| 98 | | |
|---|
| 99 | | elif str(dataType) == "<type 'DateTime'>": |
|---|
| 100 | | # mx DateTime type. MySQLdb will use this if mx is installed. |
|---|
| 101 | | try: |
|---|
| 102 | | import mx.DateTime |
|---|
| 103 | | retVal = mx.DateTime.DateTimeFrom(str(strVal)) |
|---|
| 104 | | except ImportError: |
|---|
| 105 | | raise ValueError, "Can't import mx.DateTime" |
|---|
| 106 | | |
|---|
| 107 | | elif str(dataType) == "<type 'DateTimeDelta'>": |
|---|
| 108 | | # mx TimeDelta type. MySQLdb will use this for Time columns if mx is installed. |
|---|
| 109 | | try: |
|---|
| 110 | | import mx.DateTime |
|---|
| 111 | | retVal = mx.DateTime.TimeFrom(str(strVal)) |
|---|
| 112 | | except ImportError: |
|---|
| 113 | | raise ValueError, "Can't import mx.DateTime" |
|---|
| 114 | | |
|---|
| 115 | | elif (decimal is not None and dataType == decimal.Decimal): |
|---|
| 116 | | try: |
|---|
| 117 | | _oldVal = self._oldVal |
|---|
| 118 | | except: |
|---|
| 119 | | _oldVal = None |
|---|
| 120 | | |
|---|
| 121 | | try: |
|---|
| 122 | | if type(_oldVal) == decimal.Decimal: |
|---|
| 123 | | # Enforce the precision as previously set programatically |
|---|
| 124 | | retVal = decimal.DefaultContext.quantize(decimal.Decimal(strVal), _oldVal) |
|---|
| 125 | | else: |
|---|
| 126 | | retVal = decimal.Decimal(strVal) |
|---|
| 127 | | except: |
|---|
| 128 | | raise ValueError, "Can't convert to decimal." |
|---|
| 129 | | |
|---|
| 130 | | else: |
|---|
| 131 | | # Other types can convert directly. |
|---|
| 132 | | if dataType == str: |
|---|
| 133 | | dataType = unicode |
|---|
| 134 | | try: |
|---|
| 135 | | retVal = dataType(strVal) |
|---|
| 136 | | except: |
|---|
| 137 | | # The Python object couldn't convert it. Our validator, once |
|---|
| 138 | | # implemented, won't let the user get this far. Just keep the |
|---|
| 139 | | # old value. |
|---|
| 140 | | raise ValueError, "Can't convert." |
|---|
| 141 | | return retVal |
|---|
| 142 | | |
|---|
| 143 | | |
|---|
| 144 | | def getStringValue(self, value): |
|---|
| 145 | | """Given a value of any data type, return a string rendition. |
|---|
| 146 | | |
|---|
| 147 | | Used internally by _setValue and flushValue, but also exposed to subclasses |
|---|
| 148 | | in case they need specialized behavior. The value returned from this |
|---|
| 149 | | function will be what is displayed in the UI textbox. |
|---|
| 150 | | """ |
|---|
| 151 | | if isinstance(value, basestring): |
|---|
| 152 | | # keep it unicode instead of converting to str |
|---|
| 153 | | strVal = value |
|---|
| 154 | | elif isinstance(value, datetime.datetime): |
|---|
| 155 | | # Use the ISO 8601 datetime string format (with a " " separator |
|---|
| 156 | | # instead of "T") |
|---|
| 157 | | strVal = value.isoformat(" ") |
|---|
| 158 | | elif isinstance(value, datetime.date): |
|---|
| 159 | | # Use the ISO 8601 date string format so we can convert |
|---|
| 160 | | # back from a known quantity later... |
|---|
| 161 | | strVal = value.isoformat() |
|---|
| 162 | | elif isinstance(value, datetime.time): |
|---|
| 163 | | # Use the ISO 8601 time string format |
|---|
| 164 | | strVal = value.isoformat() |
|---|
| 165 | | elif value is None: |
|---|
| 166 | | strVal = self.Application.NoneDisplay |
|---|
| 167 | | else: |
|---|
| 168 | | # convert all other data types to string: |
|---|
| 169 | | strVal = str(value) # (floats look like 25.55) |
|---|
| 170 | | #strVal = repr(value) # (floats look like 25.55000000000001) |
|---|
| 171 | | return strVal |
|---|
| 172 | | |
|---|
| 173 | | |
|---|
| 174 | | def _getDateFromString(self, strVal): |
|---|
| 175 | | """Given a string in an accepted date format, return a |
|---|
| 176 | | datetime.date object, or None. |
|---|
| 177 | | """ |
|---|
| 178 | | formats = ["ISO8601"] |
|---|
| 179 | | if not self.StrictDateEntry: |
|---|
| 180 | | # Add some less strict date-entry formats: |
|---|
| 181 | | formats.append("YYYYMMDD") |
|---|
| 182 | | formats.append("YYMMDD") |
|---|
| 183 | | formats.append("MMDD") |
|---|
| 184 | | # (define more formats in dabo.lib.dates._getDateRegex, and enter |
|---|
| 185 | | # them above in more explicit -> less explicit order.) |
|---|
| 186 | | return dabo.lib.dates.getDateFromString(strVal, formats) |
|---|
| 187 | | |
|---|
| 188 | | |
|---|
| 189 | | def _getDateTimeFromString(self, strVal): |
|---|
| 190 | | """Given a string in ISO 8601 datetime format, return a |
|---|
| 191 | | datetime.datetime object. |
|---|
| 192 | | """ |
|---|
| 193 | | formats = ["ISO8601"] |
|---|
| 194 | | if not self.StrictDateEntry: |
|---|
| 195 | | # Add some less strict date-entry formats: |
|---|
| 196 | | formats.append("YYYYMMDDHHMMSS") |
|---|
| 197 | | formats.append("YYMMDDHHMMSS") |
|---|
| 198 | | formats.append("YYYYMMDD") |
|---|
| 199 | | formats.append("YYMMDD") |
|---|
| 200 | | # (define more formats in dabo.lib.dates._getDateTimeRegex, and enter |
|---|
| 201 | | # them above in more explicit -> less explicit order.) |
|---|
| 202 | | return dabo.lib.dates.getDateTimeFromString(strVal, formats) |
|---|
| 203 | | |
|---|
| 204 | | |
|---|
| 205 | | def _getTimeFromString(self, strVal): |
|---|
| 206 | | """Given a string in ISO 8601 time format, return a |
|---|
| 207 | | datetime.time object. |
|---|
| 208 | | """ |
|---|
| 209 | | formats = ["ISO8601"] |
|---|
| 210 | | return dabo.lib.dates.getTimeFromString(strVal, formats) |
|---|
| 211 | | |
|---|
| 212 | | |
|---|
| 213 | | def __onKeyChar(self, evt): |
|---|
| 214 | | """This handles KeyChar events when ForceCase is set to a non-empty value.""" |
|---|
| 215 | | keyChar = evt.keyChar |
|---|
| 216 | | if keyChar is not None and (keyChar.isalnum() |
|---|
| 217 | | or keyChar in """,./<>?;':"[]\\{}|`~!@#$%%^&*()-_=+"""): |
|---|
| 218 | | dabo.ui.callAfter(self.__forceCase) |
|---|
| 219 | | dabo.ui.callAfter(self.__textLength) |
|---|
| 220 | | |
|---|
| 221 | | def __textLength(self): |
|---|
| 222 | | """If the TextLength property is set, checks the current value of the control |
|---|
| 223 | | and truncates it if too long""" |
|---|
| 224 | | if not isinstance(self.Value, basestring): |
|---|
| 225 | | #Don't bother if it isn't a string type |
|---|
| 226 | | return |
|---|
| 227 | | length = self.TextLength |
|---|
| 228 | | if not length: |
|---|
| 229 | | return |
|---|
| 230 | | |
|---|
| 231 | | insPos = self.InsertionPosition |
|---|
| 232 | | |
|---|
| 233 | | self._inTextLength = True |
|---|
| 234 | | if len(self.Value) > length: |
|---|
| 235 | | self.Value = self.Value[:length] |
|---|
| 236 | | if insPos > length: |
|---|
| 237 | | self.InsertionPosition = length |
|---|
| 238 | | else: |
|---|
| 239 | | self.InsertionPosition = insPos |
|---|
| 240 | | self.refresh() |
|---|
| 241 | | self._inTextLength = False |
|---|
| 242 | | |
|---|
| 243 | | def __forceCase(self): |
|---|
| 244 | | """If the ForceCase property is set, casts the current value of the control |
|---|
| 245 | | to the specified case. |
|---|
| 246 | | """ |
|---|
| 247 | | if not isinstance(self.Value, basestring): |
|---|
| 248 | | # Don't bother if it isn't a string type |
|---|
| 249 | | return |
|---|
| 250 | | case = self.ForceCase |
|---|
| 251 | | if not case: |
|---|
| 252 | | return |
|---|
| 253 | | insPos = self.InsertionPosition |
|---|
| 254 | | selLen = self.SelectionLength |
|---|
| 255 | | changed = False |
|---|
| 256 | | self._inForceCase = True |
|---|
| 257 | | if case == "upper": |
|---|
| 258 | | self.Value = self.Value.upper() |
|---|
| 259 | | changed = True |
|---|
| 260 | | elif case == "lower": |
|---|
| 261 | | self.Value = self.Value.lower() |
|---|
| 262 | | changed = True |
|---|
| 263 | | elif case == "title": |
|---|
| 264 | | self.Value = self.Value.title() |
|---|
| 265 | | changed = True |
|---|
| 266 | | if changed: |
|---|
| 267 | | #self.SelectionStart = selStart |
|---|
| 268 | | self.InsertionPosition = insPos |
|---|
| 269 | | self.SelectionLength = selLen |
|---|
| 270 | | self.refresh() |
|---|
| 271 | | self._inForceCase = False |
|---|
| 272 | | |
|---|
| 273 | | |
|---|
| 274 | | # property get/set functions |
|---|
| 275 | | def _getAlignment(self): |
|---|
| 276 | | if self._hasWindowStyleFlag(wx.TE_RIGHT): |
|---|
| 277 | | return "Right" |
|---|
| 278 | | elif self._hasWindowStyleFlag(wx.TE_CENTRE): |
|---|
| 279 | | return "Center" |
|---|
| 280 | | else: |
|---|
| 281 | | return "Left" |
|---|
| 282 | | |
|---|
| 283 | | def _setAlignment(self, val): |
|---|
| 284 | | # Note: alignment doesn't seem to work, at least on GTK2 |
|---|
| 285 | | self._delWindowStyleFlag(wx.TE_LEFT) |
|---|
| 286 | | self._delWindowStyleFlag(wx.TE_CENTRE) |
|---|
| 287 | | self._delWindowStyleFlag(wx.TE_RIGHT) |
|---|
| 288 | | val = val[0].lower() |
|---|
| 289 | | if val == "l": |
|---|
| 290 | | self._addWindowStyleFlag(wx.TE_LEFT) |
|---|
| 291 | | elif val == "c": |
|---|
| 292 | | self._addWindowStyleFlag(wx.TE_CENTRE) |
|---|
| 293 | | elif val == "r": |
|---|
| 294 | | self._addWindowStyleFlag(wx.TE_RIGHT) |
|---|
| 295 | | else: |
|---|
| 296 | | raise ValueError, "The only possible values are 'Left', 'Center', and 'Right'" |
|---|
| 297 | | |
|---|
| 298 | | |
|---|
| 299 | | def _getForceCase(self): |
|---|
| 300 | | return self._forceCase |
|---|
| 301 | | |
|---|
| 302 | | def _setForceCase(self, val): |
|---|
| 303 | | if self._constructed(): |
|---|
| 304 | | if val is None: |
|---|
| 305 | | valKey = None |
|---|
| 306 | | else: |
|---|
| 307 | | valKey = val[0].upper() |
|---|
| 308 | | self._forceCase = {"U": "upper", "L": "lower", "T": "title", None: None, |
|---|
| 309 | | "None": None}.get(valKey) |
|---|
| 310 | | self.__forceCase() |
|---|
| 311 | | self.unbindEvent(dEvents.KeyChar, self.__onKeyChar) |
|---|
| 312 | | if self._forceCase or self._textLength: |
|---|
| 313 | | self.bindEvent(dEvents.KeyChar, self.__onKeyChar) |
|---|
| 314 | | else: |
|---|
| 315 | | self._properties["ForceCase"] = val |
|---|
| 316 | | |
|---|
| 317 | | |
|---|
| 318 | | def _getInsertionPosition(self): |
|---|
| 319 | | return self.GetInsertionPoint() |
|---|
| 320 | | |
|---|
| 321 | | def _setInsertionPosition(self, val): |
|---|
| 322 | | self.SetInsertionPoint(val) |
|---|
| 323 | | |
|---|
| 324 | | |
|---|
| 325 | | def _getPasswordEntry(self): |
|---|
| 326 | | return self._hasWindowStyleFlag(wx.TE_PASSWORD) |
|---|
| 327 | | |
|---|
| 328 | | def _setPasswordEntry(self, val): |
|---|
| 329 | | self._delWindowStyleFlag(wx.TE_PASSWORD) |
|---|
| 330 | | if val: |
|---|
| 331 | | self._addWindowStyleFlag(wx.TE_PASSWORD) |
|---|
| 332 | | self.IsSecret = True |
|---|
| 333 | | |
|---|
| 334 | | |
|---|
| 335 | | def _getReadOnly(self): |
|---|
| 336 | | return not self.IsEditable() |
|---|
| 337 | | |
|---|
| 338 | | def _setReadOnly(self, val): |
|---|
| 339 | | if self._constructed(): |
|---|
| 340 | | self.SetEditable(not bool(val)) |
|---|
| 341 | | else: |
|---|
| 342 | | self._properties["ReadOnly"] = val |
|---|
| 343 | | |
|---|
| 344 | | |
|---|
| 345 | | def _getSelectedText(self): |
|---|
| 346 | | return self.GetStringSelection() |
|---|
| 347 | | |
|---|
| 348 | | |
|---|
| 349 | | def _getSelectionEnd(self): |
|---|
| 350 | | return self.GetSelection()[1] |
|---|
| 351 | | |
|---|
| 352 | | def _setSelectionEnd(self, val): |
|---|
| 353 | | start, end = self.GetSelection() |
|---|
| 354 | | self.SetSelection(start, val) |
|---|
| 355 | | self.refresh() |
|---|
| 356 | | |
|---|
| 357 | | |
|---|
| 358 | | def _getSelectionLength(self): |
|---|
| 359 | | start, end = self.GetSelection() |
|---|
| 360 | | return end - start |
|---|
| 361 | | |
|---|
| 362 | | def _setSelectionLength(self, val): |
|---|
| 363 | | start = self.GetSelection()[0] |
|---|
| 364 | | self.SetSelection(start, start + val) |
|---|
| 365 | | self.refresh() |
|---|
| 366 | | |
|---|
| 367 | | |
|---|
| 368 | | def _getSelectionStart(self): |
|---|
| 369 | | return self.GetSelection()[0] |
|---|
| 370 | | |
|---|
| 371 | | def _setSelectionStart(self, val): |
|---|
| 372 | | start, end = self.GetSelection() |
|---|
| 373 | | self.SetSelection(val, end) |
|---|
| 374 | | self.refresh() |
|---|
| 375 | | |
|---|
| 376 | | |
|---|
| 377 | | def _getSelectOnEntry(self): |
|---|
| 378 | | try: |
|---|
| 379 | | return self._SelectOnEntry |
|---|
| 380 | | except AttributeError: |
|---|
| 381 | | return False |
|---|
| 382 | | |
|---|
| 383 | | def _setSelectOnEntry(self, val): |
|---|
| 384 | | self._SelectOnEntry = bool(val) |
|---|
| 385 | | |
|---|
| 386 | | |
|---|
| 387 | | def _getStrictDateEntry(self): |
|---|
| 388 | | try: |
|---|
| 389 | | v = self._strictDateEntry |
|---|
| 390 | | except AttributeError: |
|---|
| 391 | | v = self._strictDateEntry = False |
|---|
| 392 | | return v |
|---|
| 393 | | |
|---|
| 394 | | def _setStrictDateEntry(self, val): |
|---|
| 395 | | self._strictDateEntry = bool(val) |
|---|
| 396 | | |
|---|
| 397 | | |
|---|
| 398 | | def _getTextLength(self): |
|---|
| 399 | | return self._textLength |
|---|
| 400 | | |
|---|
| 401 | | def _setTextLength(self, val): |
|---|
| 402 | | if val == None: |
|---|
| 403 | | self._textLength = None |
|---|
| 404 | | else: |
|---|
| 405 | | val = int(val) |
|---|
| 406 | | if val < 1: |
|---|
| 407 | | raise ValueError, 'TextLength must be a positve Integer' |
|---|
| 408 | | self._textLength = val |
|---|
| 409 | | self.__textLength() |
|---|
| 410 | | |
|---|
| 411 | | self.unbindEvent(dEvents.KeyChar, self.__onKeyChar) |
|---|
| 412 | | if self._forceCase or self._textLength: |
|---|
| 413 | | self.bindEvent(dEvents.KeyChar, self.__onKeyChar) |
|---|
| 414 | | |
|---|
| 415 | | |
|---|
| 416 | | def _getValue(self): |
|---|
| 417 | | # Return the value as reported by wx, but convert it to the data type as |
|---|
| 418 | | # reported by self._value. |
|---|
| 419 | | try: |
|---|
| 420 | | _value = self._value |
|---|
| 421 | | except AttributeError: |
|---|
| 422 | | _value = self._value = unicode("") |
|---|
| 423 | | dataType = type(_value) |
|---|
| 424 | | |
|---|
| 425 | | # Get the string value as reported by wx, which is the up-to-date |
|---|
| 426 | | # string value of the control: |
|---|
| 427 | | strVal = self.GetValue() |
|---|
| 428 | | |
|---|
| 429 | | # Convert the current string value of the control, as entered by the |
|---|
| 430 | | # user, into the proper data type. |
|---|
| 431 | | skipConversion = False |
|---|
| 432 | | if _value is None: |
|---|
| 433 | | if strVal == self.Application.NoneDisplay: |
|---|
| 434 | | # Keep the value None |
|---|
| 435 | | convertedVal = None |
|---|
| 436 | | skipConversion = True |
|---|
| 437 | | else: |
|---|
| 438 | | # User changed the None value to something else, convert to the last |
|---|
| 439 | | # known real datatype. |
|---|
| 440 | | dataType = self._lastDataType |
|---|
| 441 | | |
|---|
| 442 | | if not skipConversion: |
|---|
| 443 | | try: |
|---|
| 444 | | convertedVal = self.convertStringValueToDataType(strVal, dataType) |
|---|
| 445 | | except ValueError: |
|---|
| 446 | | # It couldn't convert; return the previous value. |
|---|
| 447 | | convertedVal = self._value |
|---|
| 448 | | return convertedVal |
|---|
| 449 | | |
|---|
| 450 | | def _setValue(self, val): |
|---|
| 451 | | if self._constructed(): |
|---|
| 452 | | # Must convert all to string for sending to wx, but our internal |
|---|
| 453 | | # _value will always retain the correct type. |
|---|
| 454 | | |
|---|
| 455 | | # Todo: set up validators based on the type of data we are editing, |
|---|
| 456 | | # so the user can't, for example, enter a letter "p" in a textbox |
|---|
| 457 | | # that is currently showing numeric data. |
|---|
| 458 | | |
|---|
| 459 | | if self._inForceCase: |
|---|
| 460 | | # Value is changing internally. Don't update the oldval |
|---|
| 461 | | # setting or change the type; just set the value. |
|---|
| 462 | | self.SetValue(val) |
|---|
| 463 | | return |
|---|
| 464 | | else: |
|---|
| 465 | | dabo.ui.callAfter(self.__forceCase) |
|---|
| 466 | | |
|---|
| 467 | | strVal = self.getStringValue(val) |
|---|
| 468 | | _oldVal = self._oldVal = self.Value |
|---|
| 469 | | |
|---|
| 470 | | # save the actual value for return by _getValue: |
|---|
| 471 | | self._value = val |
|---|
| 472 | | |
|---|
| 473 | | if val is not None: |
|---|
| 474 | | # Save the type of the value, so that in the case of actual None |
|---|
| 475 | | # assignments, we know the datatype to expect. |
|---|
| 476 | | self._lastDataType = type(val) |
|---|
| 477 | | |
|---|
| 478 | | # Update the display no matter what: |
|---|
| 479 | | self.SetValue(strVal) |
|---|
| 480 | | |
|---|
| 481 | | if type(_oldVal) != type(val) or _oldVal != val: |
|---|
| 482 | | self._afterValueChanged() |
|---|
| 483 | | else: |
|---|
| 484 | | self._properties["Value"] = val |
|---|
| 485 | | |
|---|
| 486 | | self.__textLength() |
|---|
| 487 | | |
|---|
| 488 | | |
|---|
| 489 | | # Property definitions: |
|---|
| 490 | | Alignment = property(_getAlignment, _setAlignment, None, |
|---|
| 491 | | _("""Specifies the alignment of the text. (str) |
|---|
| 492 | | Left (default) |
|---|
| 493 | | Center |
|---|
| 494 | | Right""")) |
|---|
| 495 | | |
|---|
| 496 | | ForceCase = property(_getForceCase, _setForceCase, None, |
|---|
| 497 | | _("""Determines if we change the case of entered text. Possible values are: |
|---|
| 498 | | None, "" (empty string): No changes made (default) |
|---|
| 499 | | "Upper": FORCE TO UPPER CASE |
|---|
| 500 | | "Lower": force to lower case |
|---|
| 501 | | "Title": Force To Title Case |
|---|
| 502 | | These can be abbreviated to "u", "l" or "t" (str)""")) |
|---|
| 503 | | |
|---|
| 504 | | InsertionPosition = property(_getInsertionPosition, _setInsertionPosition, None, |
|---|
| 505 | | _("Position of the insertion point within the control (int)")) |
|---|
| 506 | | |
|---|
| 507 | | PasswordEntry = property(_getPasswordEntry, _setPasswordEntry, None, |
|---|
| 508 | | _("Specifies whether plain-text or asterisks are echoed. (bool)")) |
|---|
| 509 | | |
|---|
| 510 | | ReadOnly = property(_getReadOnly, _setReadOnly, None, |
|---|
| 511 | | _("Specifies whether or not the text can be edited. (bool)")) |
|---|
| 512 | | |
|---|
| 513 | | SelectedText = property(_getSelectedText, None, None, |
|---|
| 514 | | _("Currently selected text. Returns the empty string if nothing is selected (str)")) |
|---|
| 515 | | |
|---|
| 516 | | SelectionEnd = property(_getSelectionEnd, _setSelectionEnd, None, |
|---|
| 517 | | _("""Position of the end of the selected text. If no text is |
|---|
| 518 | | selected, returns the Position of the insertion cursor. (int)""")) |
|---|
| 519 | | |
|---|
| 520 | | SelectionLength = property(_getSelectionLength, _setSelectionLength, None, |
|---|
| 521 | | _("Length of the selected text, or 0 if nothing is selected. (int)")) |
|---|
| 522 | | |
|---|
| 523 | | SelectionStart = property(_getSelectionStart, _setSelectionStart, None, |
|---|
| 524 | | _("""Position of the beginning of the selected text. If no text is |
|---|
| 525 | | selected, returns the Position of the insertion cursor. (int)""")) |
|---|
| 526 | | |
|---|
| 527 | | SelectOnEntry = property(_getSelectOnEntry, _setSelectOnEntry, None, |
|---|
| 528 | | _("Specifies whether all text gets selected upon receiving focus. (bool)")) |
|---|
| 529 | | |
|---|
| 530 | | StrictDateEntry = property(_getStrictDateEntry, _setStrictDateEntry, None, |
|---|
| 531 | | _("""Specifies whether date values must be entered in strict ISO8601 format. Default=False. |
|---|
| 532 | | |
|---|
| 533 | | If not strict, dates can be accepted in YYYYMMDD, YYMMDD, and MMDD format, |
|---|
| 534 | | which will be coerced into sensible date values automatically.""")) |
|---|
| 535 | | |
|---|
| 536 | | TextLength = property(_getTextLength, _setTextLength, None, |
|---|
| 537 | | _("""The maximum length the entered text can be. (int)""")) |
|---|
| 538 | | |
|---|
| 539 | | Value = property(_getValue, _setValue, None, |
|---|
| 540 | | _("Specifies the current state of the control (the value of the field). (varies)")) |
|---|
| 541 | | |
|---|
| 542 | | |
|---|
| 543 | | # Dynamic property declarations |
|---|
| 544 | | DynamicAlignment = makeDynamicProperty(Alignment) |
|---|
| 545 | | DynamicInsertionPosition = makeDynamicProperty(InsertionPosition) |
|---|
| 546 | | DynamicPasswordEntry = makeDynamicProperty(PasswordEntry) |
|---|
| 547 | | DynamicReadOnly = makeDynamicProperty(ReadOnly) |
|---|
| 548 | | DynamicSelectionEnd = makeDynamicProperty(SelectionEnd) |
|---|
| 549 | | DynamicSelectionLength = makeDynamicProperty(SelectionLength) |
|---|
| 550 | | DynamicSelectionStart = makeDynamicProperty(SelectionStart) |
|---|
| 551 | | DynamicSelectOnEntry = makeDynamicProperty(SelectOnEntry) |
|---|
| 552 | | DynamicStrictDateEntry = makeDynamicProperty(StrictDateEntry) |
|---|
| 553 | | DynamicValue = makeDynamicProperty(Value) |
|---|
| 554 | | |
|---|