ui-elements (GUI)

uiItem-Class

class itom.uiItem
call(slotOrPublicMethod[, argument1, argument2, ...]) → calls any public slot of this widget or any accessible public method.
Parameters :

slotOrPublicMethod : {str}

name of the slot or method

arguments : {various types}, optional

Here you must indicate every argument, that the definition of the slot indicates. The type must be convertable into the requested C++ based argument type.

Notes

Use this method, to invoke any public slot or wrapped method of the underlying uiItem. For instance, see the Qt-help for slots of the widget of element you are wrapping by this instance of uiItem.

connect(signalSignature, callableMethod) → connects the signal of the widget with the given callable python method
Parameters :

signalSignature : {str}

This must be the valid signature, known from the Qt-method connect (e.g. ‘clicked(bool)’)

callableMethod : {python method or function}

valid method or function that is called if the signal is emitted.

Notes

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.

disconnect(signalSignature, callableMethod) → disconnects a connection which must have been established with exactly the same parameters.
Parameters :

signalSignature : {str}

callableMethod : {python method or function}

Notes

doctodo

getAttribute(attributeNumber) → returns specified attribute of corresponding widget.
Parameters :attributeNumber : {int}

Notes

doctodo

getProperty(propertyName | listOfPropertyNames) -> returns tuple of requested properties (single property or tuple of properties)

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}

Name of one property or sequence (tuple,list...) of property names

Returns :

returns the value of one single property or a list of values, if a sequence of names is given as parameter. :

See also

setProperty

Notes

doctodo

getPropertyInfo([propertyName]) → returns information about the property 'propertyName' of this widget or all properties, if no name indicated.
Parameters :propertyName : {tuple}, optional

Notes

doctodo

getWindowFlags(flags) → gets window flags of corresponding widget.

The flags-value is an or-combination of the enumeration Qt::WindowFlag. See Qt documentation for more information.

invokeKeyboardInterrupt(signalSignature) → connects the given signal with a slot immediately invoking a python interrupt signal.
Parameters :

signalSignature : {str}

This must be the valid signature, known from the Qt-method connect (e.g. ‘clicked(bool)’)

See also

connect

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

setAttribute(attributeNumber, value) → sets attribute of corresponding widget.
Parameters :

attributeNumber : {int}

value : {bool}

Notes

doctodo

setProperty(propertyDict) → each property in the parameter dictionary is set to the dictionaries value.
Parameters :

propertyDict : {dict}

Dictionary with properties (keyword) and the values that should be set.

See also

getProperty

setWindowFlags(flags) → sets window flags of corresponding widget.
Parameters :

flags : {int}

window flags to set (or-combination, see Qt::WindowFlags) :

ui-Class

class itom.ui

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}

path to user interface file (*.ui), absolute or relative to current directory

type : {int}, optional

display type:
  • 0 (ui.TYPEDIALOG): ui-file is embedded in auto-created dialog (default),
  • 1 (ui.TYPEWINDOW): ui-file is handled as main window,
  • 2 (ui.TYPEDOCKWIDGET): ui-file is handled as dock-widget and appended to the main-window dock area

dialogButtonBar : {int}, optional

Only for type ui.TYPEDIALOG (0). Indicates whether buttons should automatically be added to the dialog:
  • 0 (ui.BUTTONBAR_NO): do not add any buttons (default)
  • 1 (ui.BUTTONBAR_HORIZONTAL): add horizontal button bar
  • 2 (ui.BUTTONBAR_VERTICAL): add vertical button bar

dialogButtons : {dict}, optional

every dictionary-entry is one button. key is the role, value is the button text

childOfMainWindow : {bool}, optional

for type TYPEDIALOG and TYPEWINDOW only. Indicates whether window should be a child of itom main window (default: True)

deleteOnClose : {bool}, optional

Indicates whether window should be deleted if user closes it or if it is hidden (default: Hidden, False)

static createNewPluginWidget(widgetName[, mandparams, optparams]) → creates widget defined by any algorithm plugin and returns the instance of type 'ui'
Parameters :

widgetName : {}

name algorithm widget parameters to pass to the plugin. The parameters are parsed and unnamed parameters are used in their incoming order to fill first mandatory parameters and afterwards optional parameters. Parameters may be passed with name as well but after the first named parameter no more unnamed parameters are allowed.

Notes

doctodo

static getDouble(title, label, defaultValue[, min, max, decimals=3]) → shows a dialog to get a double value from the user
Parameters :

title : {str}

is the dialog title

label : {str}

is the label above the spin box

defaultValue : {double}, optional

is the default value in the spin box

min : {double}, optional

default = -2147483647.0 is the allowed minimal value

max : {double}, optional

default = 2147483647.0 is the allowed maximal value

decimals : {int}, optional

the maximum number of decimal places (default: 1)

Returns :

A tuple where the first value contains the current double value. The second value is True if the dialog has been accepted, else False. :

See also

getInt, getText, getItem

static getExistingDirectory(caption, startDirectory[, options, parent]) → opens a dialog to choose an existing directory
Parameters :

caption : {str}

is the caption of this dialog

startDirectory : {str}

is the start directory

options : {int}, optional

is an or-combination of the following options (see ‘QFileDialog::Option’):
  • 1: ShowDirsOnly [default]
  • 2: DontResolveSymlinks
  • ... (for others see Qt-Help)

parent : {ui}, optional

is a parent dialog or window, this dialog becomes modal.

Returns :

The selected directory is returned as absolute path or None if the dialog has been rejected. :

static getInt(title, label, defaultValue[, min, max, step=1]) → shows a dialog to get an integer value from the user
Parameters :

title : {str}

is the dialog title

label : {str}

is the label above the spinbox

defaultValue : {int}, optional

is the default value in the spinbox

min : {int}, optional

is the allowed minimal value (default: -2147483647)

max : {int}, optional

is the allowed maximal value (default: 2147483647)

step : {int}, optional

is the step size if user presses the up/down arrow (default: 1)

Returns :

A tuple where the first value contains the current integer value. The second value is True if the dialog has been accepted, else False. :

static getItem(title, label, stringList[, currentIndex=0, editable=True]) → shows a dialog to let the user select an item from a string list
Parameters :

title : {str}

is the dialog title

label : {str}

is the label above the text box

stringList : {tuple or list}, optional

is a list or tuple of possible string values

currentIndex : {int}, optional

defines the preselected value index (default: 0)

editable : {bool}, optional

defines whether new entries can be added (True) or not (False, default)

Returns :

A tuple where the first value contains the current active or typed string value. The second value is True if the dialog has been accepted, else False. :

See also

getInt, getDouble, getText

static getOpenFileName([caption, startDirectory, filters, selectedFilterIndex, options, parent]) → opens dialog for chosing an existing file.
Parameters :

caption : {str}, optional

This is the optional title of the dialog, default: no title

startDirectory {str}, optional :

optional, if not indicated currentDirectory will be taken

filters : {str}, optional

default = 0 possible filter list, entries should be separated by ;; , e.g. ‘Images (.png *.jpg);;Text files (.txt)’

selectedFilterIndex : {int}, optional

is the index of filters which is set by default (0 is first entry)

options : {int}, optional

default = 0 or-combination of enum values QFileDialog::Options

parent : {ui}, optional

is the parent widget of this dialog

Returns :

filename as string or None if dialog has been aborted. :

See also

getSaveFileName

static getSaveFileName([caption, startDirectory, filters, selectedFilterIndex, options, parent]) → opens dialog for chosing a file to save.
Parameters :

caption : {str}, optional

This is the title of the dialog

startDirectory : {String}, optional

if not indicated, the current working directory will be taken

filters : {str}, optional

possible filter list, entries should be separated by ;; , e.g. ‘Images (.png *.jpg);;Text files (.txt)’

selectedFilterIndex : {int}, optional

default = 0 is the index of filters which is set by default (0 is first entry)

options : {int}, optional

default = 0 or-combination of enum values QFileDialog::Options

parent : {ui}, optional

is the parent widget of this dialog

Returns :

filename as string or None if dialog has been aborted. :

See also

getOpenFileName

static getText(title, label, defaultString) → opens a dialog in order to ask the user for a string
Parameters :

title : {str}

is the dialog title

label : {str}

is the label above the text box

defaultString : {str}

is the default string in the text box

Returns :

A tuple where the first value contains the current string value. The second value is True if the dialog has been accepted, else False. :

See also

getInt, getDouble, getItem

hide() → hides initialized UI-Dialog

Notes

doctodo

isVisible() → returns true if dialog is still visible
Returns :dialog visible : {bool}

Notes

doctodo

static msgCritical(title, text[, buttons, defaultButton, parent]) → opens a critical message box
Parameters :

title : {str}

is the message box title

text : {str}

is the message text

buttons : {int}, optional

is an or-combination of ui.MsgBox[...]-constants indicating the buttons to display. Use | for the or-combination.

defaultButton : {int}, optional

is a value of ui.MsgBox[...] which indicates the default button

parent : {ui}, optional

is the parent dialog of the message box.

Notes

doctodo

static msgInformation(title, text[, buttons, defaultButton, parent]) → opens an information message box
Parameters :

title : {str}

is the message box title

text : {str}

is the message text

buttons : {int}, optional

is an or-combination of ui.MsgBox[...]-constants indicating the buttons to display. Use | for the or-combination.

defaultButton : {int}, optional

is a value of ui.MsgBox[...] which indicates the default button

parent : {ui}, optional

is the parent dialog of the message box.

Notes

doctodo

static msgQuestion(title, text[, buttons, defaultButton, parent]) → opens a question message box
Parameters :

title : {str}

is the message box title

text : {str}

is the message text

buttons : {int}, optional

is an or-combination of ui.MsgBox[...]-constants indicating the buttons to display. Use | for the or-combination.

defaultButton : {int}, optional

is a value of ui.MsgBox[...] which indicates the default button

parent : {ui}, optional

is the parent dialog of the message box.

static msgWarning(title, text[, buttons, defaultButton, parent]) → opens a warning message box
Parameters :

title : {str}

is the message box title

text : {str}

is the message text

buttons : {int}, optional

is an or-combination of ui.MsgBox[...]-constants indicating the buttons to display. Use | for the or-combination.

defaultButton : {int}, optional

is a value of ui.MsgBox[...] which indicates the default button

parent : {ui}, optional

is the parent dialog of the message box.

Notes

doctodo

show(modal) → shows initialized UI-Dialog
Parameters :

modal : {int}

  • 0: non-modal (default)
  • 1: modal (python waits until dialog is hidden)
  • 2: modal (python returns immediately)

timer-Class

class itom.timer

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}

time out interval in ms

callbackFunc: {function or method} :

Python function that should be called when timer event raises

argTuple: {tuple}, optional :

tuple of parameters passed as arguments to the callback function

isActive() → returns timer status
Returns :

status : {bool}

True if the timer is running, otherwise False.

setInterval(interval) → sets timer interval in [ms]

This method sets the timeout interval in milliseconds. The timer calls the callback function continuously after this interval (if started)

start() → starts timer

Starts or restarts the timer with its timeout interval. If the timer is already running, it will be stopped and restarted.

stop() → stops timer

Table Of Contents

Previous topic

plotItem

Next topic

dataObject

This Page