uiItem(...) -> base class representing any widget of a graphical user interface
This class represents any widget (graphical, interactive element like a button or checkbox) on a graphical user interface. An instance of this class provides many functionalities given by the underlying Qt system. For instance, it is posible to call a public slot of the corresponding widget, connect signals to specific python methods or functions or change properties of the widget represeted by the instance.
The overall dialog or window as main element of a graphical user interface itself are instances of the class ui. However, they are derived from uiItem, since dialogs or windows internally are widgets as well.
Widgets placed at a user interface using the Qt Designer can be referenced by an uiItem instance by their specific objectName, assigned in the Qt Designer as well. As an example, a simple dialog with one button is created and the text of the button (objectName: btn) is set to OK:
dialog = ui('filename.ui', type=ui.TYPEDIALOG)
button = dialog.btn #here the reference to the button is obtained
button["text"] = "OK" #set the property text of the button
Information about available properties, signals and slots can be obtained using the method info() of uiItem.
Notes
It is not intended to directly instantiate this class. Either create a user interface using the class ui or obtain a reference to an existing widget (this is then an instance of uiItem) using the dot-operator of a parent widget or the entire user interface.
This method invokes (calls) a method of the underlying widget that is marked as public slot. Besides slots there are some public methods of specific widget classes that are wrapped by itom and therefore are callable by this method, too.
If only method is available, all arguments are tried to be cast to the requested types and the slot is called on conversion success. If the method has multiple overloaded possibilities in the underlying C++ classes, at first, it is intended to find the variant where all arguments can be strictly casted from Python types to the necessary C-types. If this fails, the next variant with a non-strict conversion is chosen.
Parameters: | slotOrPublicMethod : {str}
arguments : {various types}, optional
|
---|
See also
info
Notes
If you want to know all possible slots of a specific widget, see the Qt help or call the member info() of the widget.
This instance of uiItem wraps a widget, that is defined by a C++-class, that is finally derived from QWidget. See Qt-help for more information about the capabilities of every specific widget. Every widget can send various signals. Use this method to connect any signal to any callable python method (bounded or unbounded). This method must have the same number of arguments than the signal and the types of the signal definition must be convertable into a python object.
Parameters: | signalSignature : {str}
callableMethod : {python method or function}
|
---|
See also
Parameters: | signalSignature : {str} callableMethod : {python method or function} |
---|
Notes
doctodo
Widgets have specific attributes that influence their behaviour. These attributes are contained in the Qt-enumeration Qt::WidgetAttribute. Use this method to query the current status of one specific attributes.
Important attributes are:
Parameters: | attributeNumber : {int}
|
---|---|
Returns: | out : {bool}
|
See also
Use this method or the operator [] in order to get the value of one specific property of this widget or of multiple properties. Multiple properties are given by a tuple or list of property names. For one single property, its value is returned as it is. If the property names are passed as sequence, a sequence of same size is returned with the corresponding values.
Parameters: | property : {string, string-list}
|
---|---|
Returns: | out : {variant, sequence of variants}
|
See also
Parameters: | propertyName : {tuple}, optional |
---|
The flags-value is an or-combination of the enumeration Qt::WindowType. See Qt documentation for more information.
Returns: | flags {int}: :
|
---|
See also
Parameters: | signalSignature : {str}
|
---|
See also
Notes
If you use the connect method to link a signal with a python method or function, this method can only be executed if python is in an idle status. However, if you want raise the python interrupt signal if a specific signal is emitted, this interruption should be immediately invoked. Therefore
Widgets have specific attributes that influence their behaviour. These attributes are contained in the Qt-enumeration Qt::WidgetAttribute. Use this method to enable/disable one specific attribute.
Important attributes are:
Parameters: | attributeNumber : {int}
value : {bool}
|
---|
See also
Parameters: | propertyDict : {dict}
|
---|
See also
The window flags are used to set the type of a widget, dialog or window including further hints to the window system. This method is used to set the entire or-combination of all flags, contained in the Qt-enumeration Qt::WindowType.
The most important types are:
Further hints can be (among others):
If you simply want to change one hint, get the current set of flags using getWindowFlags, change the necessary bitmask and set it again using this method.
Parameters: | flags : {int}
|
---|
See also
Bases: itom.uiItem
ui(filename, [type, dialogButtonBar, dialogButtons, childOfMainWindow, deleteOnClose]) -> instance of user interface
The class ui wraps a user interface, externally designed and given by a ui-file. If your user interface is a dialog or window, chose ui.TYPEWINDOW as type, if the user interface is a widget (simplest case), chose ui.TYPEDIALOG and your widget will be embedded in a dialog, provided by itom. This dialog can be equiped with a button bar, whose buttons are already connected to itom internal methods. If you then show your dialog in a modal mode, itom knows which button has been clicked in order to accept or reject the dialog.
Parameters: | filename : {str}
type : {int}, optional
dialogButtonBar : {int}, optional
dialogButtons : {dict}, optional
childOfMainWindow : {bool}, optional
deleteOnClose : {bool}, optional
|
---|
Parameters: | widgetName : {}
|
---|
Notes
doctodo
Parameters: | title : {str}
label : {str}
defaultValue : {double}, optional
min : {double}, optional
max : {double}, optional
decimals : {int}, optional
|
---|---|
Returns: | out : {tuple (double, bool)}
|
Parameters: | caption : {str}
startDirectory : {str}
options : {int}, optional
parent : {ui}, optional
|
---|---|
Returns: | out : {str, None}
|
See also
Parameters: | title : {str}
label : {str}
defaultValue : {int}, optional
min : {int}, optional
max : {int}, optional
step : {int}, optional
|
---|---|
Returns: | out : {tuple (int, bool)}
|
Parameters: | title : {str}
label : {str}
stringList : {tuple or list}, optional
currentIndex : {int}, optional
editable : {bool}, optional
|
---|---|
Returns: | out : {tuple (str, bool)}
|
Parameters: | caption : {str}, optional
startDirectory {str}, optional :
filters : {str}, optional
selectedFilterIndex : {int}, optional
options : {int}, optional
parent : {ui}, optional
|
---|---|
Returns: | out : {str, None}
|
See also
This method creates a modal file dialog to let the user select a file name used for saving a file.
Parameters: | caption : {str}, optional
startDirectory : {String}, optional
filters : {str}, optional
selectedFilterIndex : {int}, optional
options : {int}, optional
parent : {ui}, optional
|
---|---|
Returns: | out : {str, None}
|
See also
Parameters: | title : {str}
label : {str}
defaultString : {str}
|
---|---|
Returns: | out : {tuple (str, bool)}
|
Returns: | visibility : {bool}
|
---|
Parameters: | title : {str}
text : {str}
buttons : {int}, optional
defaultButton : {int}, optional
parent : {ui}, optional
|
---|
See also
Parameters: | title : {str}
text : {str}
buttons : {int}, optional
defaultButton : {int}, optional
parent : {ui}, optional
|
---|
See also
Parameters: | title : {str}
text : {str}
buttons : {int}, optional
defaultButton : {int}, optional
parent : {ui}, optional
|
---|
See also
Parameters: | title : {str}
text : {str}
buttons : {int}, optional
defaultButton : {int}, optional
parent : {ui}, optional
|
---|
See also
timer(interval, callbackFunc, [argTuple]) -> new callback timer
Creates a timer object that continuously calls a python callback function or method with a certain interval. The timer is active after construction and stops when this instance is destroyed or stop() is called.
Parameters: | interval : {double}
callbackFunc: {function, method} :
argTuple: {tuple}, optional :
|
---|
Returns: | status : {bool}
|
---|
This method sets the timeout interval in milliseconds. The timer calls the callback function continuously after this interval (if started)
Parameters: | interval : {int}
|
---|
Starts or restarts the timer with its timeout interval. If the timer is already running, it will be stopped and restarted.