taurus.qt.qtgui.util

This package provides a set of taurus wiget utilities like color management, configuration, actions.

Classes

class ActionFactory(*p, **k)[source]

A Singleton class designed to provide Action related objects.

(more info)

class AttributeAllConfigAction(parent=None)[source]

(more info)

class AttributeHistoryAction(parent=None)[source]

(more info)

class AttributeImageDisplayAction(parent=None)[source]

(more info)

class AttributeMenu(parent)[source]

(more info)

class AttributeMonitorDeviceAction(parent=None)[source]

(more info)

class ConfigurationMenu(parent)[source]

(more info)

class DropDebugger(parent=None)[source]

A simple utility for debugging drag&drop. This widget will accept drops and show a pop-up with the contents of the MIME data passed in the drag&drop

(more info)

class ExternalAppAction(cmdargs, text=None, icon=None, parent=None, interactive=True)[source]

An specialized QAction for launching external applications

Signals: apart of those from QAction, it emits a “cmdArgsChanged” signal with the current cmdArgs list as its argument.

(more info)

class Grabber(widget, fileName)[source]

(more info)

class PintValidator[source]

A QValidator for pint Quantities

(more info)

class QtColorPalette(dat, int_decoder_dict)[source]

(more info)

class SeparatorAction(parent=None)[source]

(more info)

class TaurusAction(parent)[source]

Base class for Taurus Actions

(more info)

class TaurusMenu(parent)[source]

Base class for Taurus Menus

(more info)

class TaurusWidgetFactory(*p, **k)[source]

The TaurusWidgetFactory is a utility class that provides information about all Qt widgets (Taurus and non Taurus) that are found in the current taurus distribution. TaurusWidgetFactory is a singleton class so you can freely create new instances since they will all reference the same object. Usage:

from taurus.qt.qtgui.util import TaurusWidgetFactory

wf = TaurusWidgetFactory()
print(wf.getTaurusWidgetClassNames())

(more info)

Functions

getWidgetsOfType(widget, class_or_type_or_tuple)[source]

Returns all widgets in a hierarchy of a certain type

Parameters:
  • widget (Qt.QWidget) – the widget to be inspected

  • class-or-type-or-tuple (type class or a tuple of type classes) – type to be checked

Returns:

a sequence containning all widgets in the hierarchy that match the given type

Return type:

seq<Qt.QWidget>

grabWidget(widget, fileName, period=None)[source]

Grabs the given widget into the given image filename. If period is not given (or given with None) means grab immediately once and return. If period is given and >0 means grab the image every period seconds

Parameters:
  • widget (Qt.QWidget) – the qt widget to be grabbed

  • fileName (str) – the name of the image file

  • period (float) – period (seconds)

loadUi(obj, filename=None, path=None, with_ui=None)[source]

Loads a QtDesigner .ui file into the given widget. If no filename is given, it tries to load from a file name which is the widget class name plus the extension “.ui” (example: if your widget class is called MyWidget it tries to find a MyWidget.ui). If path is not given it uses the directory where the python file which defines the widget is located plus a ui directory (example: if your widget is defined in a file /home/homer/workspace/taurusgui/my_widget.py then it uses the path /home/homer/workspace/taurusgui/ui)

Parameters:
  • filename (str) – the QtDesigner .ui file name [default: None, meaning calculate file name with the algorithm explained before]

  • path (str) – directory where the QtDesigner .ui file is located [default: None, meaning calculate path with algorithm explained before]

  • with_ui (bool) – if True, the objects defined in the ui file will be accessible as submembers of an ui member of the widget. If False, such objects will directly be members of the widget.

UILoadable(klass=None, with_ui=None)[source]

A class decorator intended to be used in a Qt.QWidget to make its UI loadable from a predefined QtDesigner UI file. This decorator will add a loadUi() method to the decorated class and optionaly a property with a name given by with_ui parameter.

The folowing example assumes the existence of the ui file <my_widget_dir>/ui/MyWidget.ui which is a QWidget panel with at least a QPushButton with objectName my_button

from taurus.external.qt import Qt
from taurus.qt.qtgui.util.ui import UILoadable

@UILoadable
class MyWidget(Qt.QWidget):

    def __init__(self, parent=None):
        Qt.QWidget.__init__(self, parent)
        self.loadUi()
        self.my_button.setText("This is MY button")

Another example using a superUI.ui file in the same directory as the widget. The widget UI components can be accessed through the widget member _ui

import os.path

from taurus.external.qt import Qt
from taurus.qt.qtgui.util.ui import UILoadable

@UILoadable(with_ui="_ui")
class MyWidget(Qt.QWidget):

    def __init__(self, parent=None):
        Qt.QWidget.__init__(self, parent)
        self.loadUi(
            filename="superUI.ui",
            path=os.path.dirname(__file__)
        )
        self._ui.my_button.setText("This is MY button")
Parameters:

with_ui (str) – assigns a member to the decorated class from which you can access all UI components [default: None, meaning no member is created]

Variables

QT_ATTRIBUTE_QUALITY_PALETTE
QT_DEVICE_STATE_PALETTE