Description:
_pythonGenericUI is a class to create a dialog window.
You can add buttons, checkBoxes, lineEdits,....
It is a primitive UI dialog.
Note: The blue boxes (Layouts) and springs (Spacers) are not visible in your dialog.
Usage Example:
myDialog= rrGlobal.getGenericUI()
myDialog.addItem(rrGlobal.genUIType.label,"infoLabel","")
myDialog.setText("infoLabel","Hello!\n This is a test UI.\n")
myDialog.addItem(rrGlobal.genUIType.lineEdit,"myEdit","")
myDialog.setText("myEdit","Preset Text")
myDialog.addItem(rrGlobal.genUIType.layoutH,"btnLayout","")
myDialog.addItem(rrGlobal.genUIType.closeButton,"Ok","btnLayout")
myDialog.addItem(rrGlobal.genUIType.closeButton,"Abort","btnLayout")
myDialog.execute()
editText=myDialog.text("myEdit");
print("The text is "+editText)
if (myDialog.value("Ok")==1):
print("OK was pressed")
if (myDialog.value("Abort")==1):
print("Abort was pressed")
del myDialog
enumeration rrGlobal.genUIType:
button |
A default button. After the dialog is closed, you can check if the button was pressed. |
closeButton |
Same as button, but it closes the dialog as well. |
lineEdit |
A line editor. |
checkBox |
A check Box. |
spin |
A spin box to enter numbers. |
browseFile |
A generic browse file dialog. |
browseDir |
A generic browse directory dialog. |
label |
A text label. |
dropdown |
A Dropdown list/ Combo Box. |
layoutH |
Horizontal Layout Layouts are used to group multiple objects. (blue boxes in example screenshot) |
layoutV |
Vertical Layout Layouts are used to group multiple objects. (blue boxes in example screenshot) |
spacerH |
Horizontal Spacer. A spacer is used to move everything else in a layout aside. (blue springs in example screenshot) |
spacerV |
Vertical Spacer. A spacer is used to move everything else in a layout aside. (blue springs in example screenshot) |
Class _pythonGenericUI functions:
Return Type |
Name |
Description |
|
addItem(const int &type, char * name, char * layout) |
Adds a new item. |
|
setText(char * name, char * text) |
Sets either the label of the UI item (Button, checkbox, ...) |
QString |
text(char * name) |
Get the text/caption/label of the item name. Used for lineEdits and dropDowns. |
|
addText(char * name, char * text) |
For dropdown only. |
|
setValueMin(char * name, int value) |
For spin only. |
|
setValueMax(char * name, int value) |
For spin only. |
|
setValue(char * name, int value) |
spin: sets the value. checkbox: 0: unchecked 1: checked button: 0: unpress button. 1: press button. |
int |
value(char * name) |
The result differs depending on the object: spin: get the current value button: 0: button was not pressed. 1: button was pressed. checkbox: 0:checked 1:unchecked browse: The user pressed the "browse" button. Note: The user can still have edited the filename without using the browse button. |
|
execute() |
Displays the dialog until a close button was pressed or the window was closed [X]. |