|
| __init__ (self, form, controls) |
|
| Free (self) |
|
| __getitem__ (self, name) |
|
| Add (self, name, ctrl, mkattr=True) |
|
| FindControlById (self, id) |
|
| AddControls (self, controls, mkattr=True) |
|
| CompileEx (self, form) |
|
| Compile (self) |
|
| Compiled (self) |
|
| Execute (self) |
|
| Open (self) |
|
| EnableField (self, ctrl, enable) |
|
| ShowField (self, ctrl, show) |
|
| MoveField (self, ctrl, x, y, w, h) |
|
| GetFocusedField (self) |
|
| SetFocusedField (self, ctrl) |
|
| RefreshField (self, ctrl) |
|
| Close (self, close_normally) |
|
| GetControlValue (self, ctrl) |
|
| SetControlValue (self, ctrl, value) |
|
◆ __init__()
__init__ |
( |
| self, |
|
|
| form, |
|
|
| controls ) |
Contruct a Form class.
This class wraps around ask_form() or open_form() and provides an easier / alternative syntax for describing forms.
The form control names are wrapped inside the opening and closing curly braces and the control themselves are
defined and instantiated via various form controls (subclasses of Form).
@param form: The form string
@param controls: A dictionary containing the control name as a _key_ and control object as _value_
◆ __getitem__()
__getitem__ |
( |
| self, |
|
|
| name ) |
Returns a control object by name
◆ _AddGroup()
_AddGroup |
( |
| self, |
|
|
| Group, |
|
|
| mkattr = True ) |
|
protected |
Internal function.
This function expands the group item names and creates individual group item controls
@param Group: The group class (checkbox or radio group class)
◆ _ChkCompiled()
◆ _ParseFormTitle()
Parses the form's title from the form text
◆ _reset()
Resets the Form class state variables
◆ Add()
Add |
( |
| self, |
|
|
| name, |
|
|
| ctrl, |
|
|
| mkattr = True ) |
Low level function. Prefer AddControls() to this function.
This function adds one control to the form.
@param name: Control name
@param ctrl: Control object
@param mkattr: Create control name / control object as a form attribute
◆ AddControls()
AddControls |
( |
| self, |
|
|
| controls, |
|
|
| mkattr = True ) |
Adds controls from a dictionary.
The dictionary key is the control name and the value is a Form.Control object
@param controls: The control dictionary
◆ Close()
Close |
( |
| self, |
|
|
| close_normally ) |
Close the form
@param close_normally:
1: form is closed normally as if the user pressed Enter
0: form is closed abnormally as if the user pressed Esc
@return: None
◆ Compile()
Compiles a form and returns the form object (self) and the argument list.
The form object will contain object names corresponding to the form elements
@return: It will raise an exception on failure. Otherwise the return value is ignored
◆ Compiled()
Checks if the form has already been compiled
@return: Boolean
◆ CompileEx()
Low level function.
Compiles (parses the form syntax and adds the control) the form string and
returns the argument list to be passed the argument list to ask_form().
The form controls are wrapped inside curly braces: {ControlName}.
A special operator can be used to return the index of a given control by its name: {id:ControlName}.
This is useful when you use the STARTITEM form keyword to set the initially focused control.
(note that, technically, the index is not the same as the ID; that's because STARTITEM
uses raw, 0-based indexes rather than control IDs to determine the focused widget.)
@param form: Compiles the form and returns the arguments needed to be passed to ask_form()
◆ ControlToFieldTypeIdAndSize()
ControlToFieldTypeIdAndSize |
( |
| ctrl | ) |
|
|
static |
Converts a control object to a tuple containing the field id
and the associated buffer size
◆ create_string_buffer()
create_string_buffer |
( |
| value, |
|
|
| size = None ) |
|
static |
◆ EnableField()
EnableField |
( |
| self, |
|
|
| ctrl, |
|
|
| enable ) |
Enable or disable an input field
@return: False - no such control
◆ Execute()
Displays a modal dialog containing the compiled form.
@return: 1 - ok ; 0 - cancel
◆ fieldtype_to_ctype()
fieldtype_to_ctype |
( |
| tp, |
|
|
| i64 = False ) |
|
static |
Factory method returning a ctype class corresponding to the field type string
◆ FindControlById()
FindControlById |
( |
| self, |
|
|
| id ) |
Finds a control instance given its id
◆ Free()
Frees all resources associated with a compiled form.
Make sure you call this function when you finish using the form.
◆ GetControlValue()
GetControlValue |
( |
| self, |
|
|
| ctrl ) |
Returns the control's value depending on its type
@param ctrl: Form control instance
@return:
- color button, radio controls: integer
- file/dir input, string input and string label: string
- embedded chooser control (0-based indices of selected items): integer list
- for multilinetext control: textctrl_info_t
- dropdown list controls: string (when editable) or index (when readonly)
- None: on failure
◆ GetFocusedField()
Get currently focused input field.
@return: None if no field is selected otherwise the control ID
◆ MoveField()
MoveField |
( |
| self, |
|
|
| ctrl, |
|
|
| x, |
|
|
| y, |
|
|
| w, |
|
|
| h ) |
Move/resize an input field
@return: False - no such fiel
◆ Open()
Opens a widget containing the compiled form.
◆ RefreshField()
RefreshField |
( |
| self, |
|
|
| ctrl ) |
Refresh a field
@return: False - no such control
◆ SetControlValue()
SetControlValue |
( |
| self, |
|
|
| ctrl, |
|
|
| value ) |
Set the control's value depending on its type
@param ctrl: Form control instance
@param value:
- embedded chooser: a 0-base indices list to select embedded chooser items
- multilinetext: a textctrl_info_t
- dropdown list: an integer designating the selection index if readonly
a string designating the edit control value if not readonly
@return: Boolean true on success
◆ SetFocusedField()
SetFocusedField |
( |
| self, |
|
|
| ctrl ) |
Set currently focused input field
@return: False - no such control
◆ ShowField()
ShowField |
( |
| self, |
|
|
| ctrl, |
|
|
| show ) |
Show or hide an input field
@return: False - no such control
◆ _FT_USHORT
◆ argtypes
◆ controls
◆ DefI64
◆ form
◆ FT_ADDR
◆ FT_ASCII
◆ FT_BIN
◆ FT_BUTTON
◆ FT_CHAR
◆ FT_CHKGRP
◆ FT_CHKGRP2
◆ FT_COLOR
◆ FT_DEC
◆ FT_DIR
◆ FT_DROPDOWN_LIST
str FT_DROPDOWN_LIST = 'b' |
|
static |
◆ FT_ECHOOSER
◆ FT_FILE
◆ FT_FORMCHG
◆ FT_HEX
◆ FT_HTML_LABEL
◆ FT_IDENT
◆ FT_INT64
◆ FT_MULTI_LINE_TEXT
str FT_MULTI_LINE_TEXT = 't' |
|
static |
◆ FT_OCT
◆ FT_RADGRP
◆ FT_RADGRP2
◆ FT_RAWHEX
◆ FT_SEG
◆ FT_SHEX
◆ FT_TYPE
◆ FT_UINT64
◆ modal [1/2]
◆ modal [2/2]
◆ openform_flags
◆ p_fa
◆ title
The documentation for this class was generated from the following file: