A dialog is a window displayed inside the PyDADL application's workspace. Dialog XML files are located in the ui_xml directory, you can arrange you XML files in multiple sub directories.
The root element of a dialog XML file is the dialog tag. This tag can hold the following attributes :
The sub tag widget is the base element of a dialog. Widgets are laid out in a grid. Container widgets can have child widgets. This tag can hold the following attributes :
|Widget's type||Widget's class||Widget's description|
|button||Simple widgets||Push button.|
|check||Simple widgets||Check box.|
|date||Simple widgets||Date selector.|
|file||Simple widgets||File or folder selector.|
|label||Simple widgets||Label display.|
|line||Simple widgets||Single line edit.|
|pixmap||Simple widgets||Image display.|
|progress||Simple widgets||Progress bar.|
|radio||Simple widgets||Radio button.|
|rule||Simple widgets||Simple rule.|
|slider||Simple widgets||Slider widget.|
|spin||Simple widgets||Spin box.|
|text||Simple widgets||Multi line text edit.|
|time||Simple widgets||Time selector.|
|combo||Complex widgets||Combo box.|
|list||Complex widgets||List display.|
|table||Complex widgets||Table display.|
|tree||Complex widgets||Tree display.|
|grid||Container widgets||Invisible grid.|
|group||Container widgets||Group box.|
|scroll||Container widgets||Scroll area.|
|split||Container widgets||Split area.|
|stack||Container widgets||Widgets stack|
|tabs||Container widgets||Tabs display.|
|dummy||other widgets||Dummy widget.|
|custom||other widgets||Custom class widget.|
|spacer||other widgets||Blank space.|
Table 4.1. PyDADL widgets
The sub tag page can only be declared inside a widget tag with type of stack or tabs. Pages hold widgets inside as dialog does. The attributes of page tag are :
The sub tag style is used to specify a style sheet for the dialog. See Qt documentation for more details about style sheet syntaxes.
The sub tag connection is used to connect widget's signals to Python code that you write inside this tag. there are Qt signals and PyDADL signals. Let's assume you have a widget named line_edit_1 of type line, which correspond to a QLineEdit Qt class, to connect the Qt signal cursorPositionChanged ( int old, int new ) you could write :
<connection widget='line_edit_1' signal='cursorPositionChanged(int, int)'> ...PYTHON CODE... </connection>
The two int arguments will be available via the Args list, the first int is Args and the second is Args.
You could also write the connection tag like this :
<connection widget='line_edit_1' signal='cursorPositionChanged(old=int, new=int)'> ...PYTHON CODE... </connection>
In this case, the two int variables will also be available via the variables named old and new.
To connect the PyDADL signal cellChanged(row_id, col_id, data) of a tree widget you could write :
<connection widget='tree_1' signal='cellChanged'> ...PYTHON CODE... </connection>
<connection widget='tree_1' signal='cellChanged(row=, col=, data=)'> ...PYTHON CODE... </connection>
In both cases the three signal's arguments will be available via the Args list. In the second case, the variables row, col and data will also be defined.
It is possible to connect more than one signal to the same Python code using widgetN and signalN attributes :
<connection widget='tree_1' signal='cellChanged' widget0='tree_2' signal0='cellChanged' widget1='line_1' signal1='changed'> ...PYTHON CODE... </connection>
The sub tag callback is used to write code that will be executed when applying the dialog, either by clicking on "Ok" button or "Apply" button. Widgets values are accessible via a variable named Values which is a dict, the dict's keys are formed by widgets names. There are also global variables defined that correspond to the widgets names.
The sub tag init can be used to write Python code that will be executed on dialog loading.
The sub tag post_show is similar to init tag, the difference is that the code writing here will be executed after showing the dialog, it can be usefull for actions that must be done on visible widgets.
The sub tag cleanup can be used to write Python code that will be executed when closing the dialog.
The sub tag code can be used to declare Python functions or objects, those objects will be available as global objects in other code tags.
The sub tags thread and event can be used for threading. They are used like in Application XML.
In all Python code blocks there is a variable named d which is a reference to the dialog object. See Section 4.4, “Dialog/Wizard classes” for more details.
|Since Python uses indentation for delimiting blocks, you must start all you code blocks from the beginning of the line.|