enaml.widgets.field

Classes

Field

A single line editable text widget.

class enaml.widgets.field.Field(parent=None, **kwargs)[source]

Bases: enaml.widgets.control.Control

A single line editable text widget.

text

The unicode text to display in the field.

mask

The mask to use for text input http://qt-project.org/doc/qt-4.8/qlineedit.html#inputMask-prop

The summary of the mask grammar is as follows: A ASCII alphabetic character required. A-Z, a-z. a ASCII alphabetic character permitted but not required. N ASCII alphanumeric character required. A-Z, a-z, 0-9. n ASCII alphanumeric character permitted but not required. X Any character required. x Any character permitted but not required. 9 ASCII digit required. 0-9. 0 ASCII digit permitted but not required. D ASCII digit required. 1-9. d ASCII digit permitted but not required (1-9). # ASCII digit or plus/minus sign permitted but not required. H Hexadecimal character required. A-F, a-f, 0-9. h Hexadecimal character permitted but not required. B Binary character required. 0-1. b Binary character permitted but not required. > All following alphabetic characters are uppercased. < All following alphabetic characters are lowercased. ! Switch off case conversion. Use to escape the special characters listed above to use them as separators.

The mask consists of a string of mask characters and separators, optionally followed by a semicolon and the character used for blanks Eg: 9 digit phone number: (999) 999-9999;_

validator

The validator to use for this field. If the validator provides a client side validator, then text will only be submitted if it passes that validator.

submit_triggers

The list of actions which should cause the client to submit its text to the server for validation and update. The currently supported values are ‘lost_focus’, ‘return_pressed’, and ‘auto_sync’. The ‘auto_sync’ mode will attempt to validate and synchronize the text when the user stops typing.

sync_time

Time in ms after which the client submit its text to the server for validation and update when the user stop typing. This is used only when the ‘auto_sync’ mode is part of the submit_triggers.

placeholder

The grayed-out text to display if the field is empty and the widget doesn’t have focus. Defaults to the empty string.

echo_mode

How to display the text in the field. Valid values are ‘normal’ which displays the text as normal, ‘password’ which displays the text with an obscured character, and ‘silent’ which displays no text at all but still allows input.

max_length

The maximum length of the field in characters. The default value is Zero and indicates there is no maximum length.

read_only

Whether or not the field is read only. Defaults to False.

text_align

Alignment for the text inside the field. Defaults to ‘left’.

hug_width

How strongly a component hugs it’s contents’ width. Fields ignore the width hug by default, so they expand freely in width.

proxy

A reference to the ProxyField object.

field_text()[source]

Get the text stored in the field control.

Depending on the state of the field, this text may be different than that stored in the ‘text’ attribute.

Returns

result – The unicode text stored in the field.

Return type

unicode