class InputForm(Gtk.Table): (source)
This class implements a table with input widgets. It takes care of constructing the widgets and lay them out as a well formatted input form.
This class can be accessed as a dict to get and set the values of the various input widgets by name. This makes it more or less transparent when getting and setting values from the form into the config or preferences.
Unknown Field: signal | |
last-activated (): this signal is emitted when the last widget in the form is activated, can be used to trigger a default response in a dialog. | |
input-valid-changes (): valid state the form changed |
Method | __contains__ |
Undocumented |
Method | __getitem__ |
Undocumented |
Method | __init__ |
Constructor. |
Method | __iter__ |
Undocumented |
Method | __setitem__ |
Undocumented |
Method | add_inputs |
Add input widgets to the form. |
Method | copy |
Copy the values of all widgets in the form into a normal dict @returns: a dict with widget values |
Method | depends |
No summary |
Method | focus_first |
Focus the first widget in the form |
Method | focus_next |
Focus the next input in the form |
Method | get_input_valid |
Get combined state of all sensitive widgets in the form @returns: True if all sensitive widgets have a valid input |
Method | items |
Undocumented |
Method | keys |
Undocumented |
Method | on_activate_widget |
Undocumented |
Method | set_default_activate |
No summary |
Method | update |
No summary |
Class Variable | __gsignals__ |
Undocumented |
Instance Variable | notebook |
the Notebook object, used e.g. for completion in PageEntry inputs |
Instance Variable | widgets |
a dict with the input widgets by name. Use this to access the widgets directly (e.g. to wire more signals). |
Method | _check_input_valid |
Undocumented |
Method | _focus_next |
Undocumented |
Method | _get_radiogroup |
Undocumented |
Instance Variable | _default_activate |
Undocumented |
Instance Variable | _input_valid |
Undocumented |
Instance Variable | _keys |
Undocumented |
Instance Variable | _widgets |
Undocumented |
Parameters | |
inputs | list with input definitions, see add_inputs() for details |
values | initial values for the inputs |
depends | dict with dependencies between widgets, see depends() for details |
notebook | a Notebook object, e.g. for completion in PageEntry inputs |
Add input widgets to the form.
Inputs are defined by 3-tuples or 4-tuples of:
The following input types are supported:
InputEntry
)InputEntry
)Path
(PageEntry
)Path
(NamespaceEntry
)LinkEntry
)Folder
object (FolderEntry
)File
object for an existing file (FileEntry
)The "int" and "choice" options need an extra argument to specify the allowed inputs. For "int" this should be a 2-tuple with the minimum and maximum values. For 'choice' it should be a tuple or list with the items to choose from. If the items in the list are 2-tuples they are considered pairs of a key and a user readable label.
The input type "option"' can be used to have groups of checkboxes. In this case the name should exist of two parts separated by a ':', first part is the group name and the second part the key for this option. This way multiple options of the same group can be specified as separate widgets. Only the group name will show up as a key in the form, and the value will be the option name of the selected radio button. So you can have names like "select:all" and "select:page" which will result in two radiobuttons. The form will have a key "select" which has either a value "all" or a value "page".
The "page", "namespace" and "link" types support an optional extra argument which gives the reference Path
for resolving relative paths. This also requires the notebook to be set.
A string in the input list will result in a label in the form, using markup.
A None or '' value in the input list will result in additional row spacing in the form.
Make one of the inputs depend on another widget. This means that e.g. the "subject" widget will become insensitive when the "object" widget is made insensitive. Also hiding the "object" will result in the "subject" being hidden as well.
If the "object" has an active state (e.g. if it is an checkbox or a radio option) the "subject" will only be sensitive when the "object" is active. This is useful e.g. when you want a text input that is only sensitive when a specific radio box is selected.
Parameters | |
subject | the name of the subject widget |
object | the name of the object widget |
Returns | |
True if all sensitive widgets have a valid input |
Parameters | |
name | the name or None |
Parameters | |
map | a dict with new values for the widgets |