8.6.12. pymodaq_gui.qt_utils module

class pymodaq_gui.qt_utils.ThemeSignaller[source]

Bases: QObject

Emits theme_changed(theme) each time apply_theme() applies a theme.

Methods

theme_changed

staticMetaObject = PySide6.QtCore.QMetaObject("ThemeSignaller" inherits "QObject": Methods:   #4 type=Signal, signature=theme_changed(PyObject), parameters=PyObject )
theme_changed
class pymodaq_gui.qt_utils.WhiteCheckboxStyle[source]

Bases: QProxyStyle

Methods

drawPrimitive

drawPrimitive(element, option, painter, widget=None)[source]
staticMetaObject = PySide6.QtCore.QMetaObject("WhiteCheckboxStyle" inherits "QProxyStyle": )
pymodaq_gui.qt_utils.apply_styling_rules(app)[source]
pymodaq_gui.qt_utils.apply_theme(theme, style=None, app=None)[source]

Apply a qt_themes theme to the running application, at startup or at any time later.

Sets the application palette and style, re-applies PyMoDAQ’s custom rules (the style proxy making checkboxes visible on dark themes, which a new style would otherwise drop) and emits theme_signaller.theme_changed.

Widgets built from the palette repaint by themselves, and so do the icons of ActionManager actions and menus given by name and the pymodaq plots (they listen to theme_changed, see pymodaq_gui.plotting.plot_theme). Anything else whose colours were computed once from the theme should listen to theme_signaller.theme_changed.

Parameters:
  • theme (Union[str, Theme]) – A theme or the name of one (see qt_themes.get_themes())

  • style (str) – Qt style name. Defaults to the configured one (config('gui', 'style', 'style')[0])

  • app (QApplication) – Defaults to the running instance

Returns:

The applied theme, None if theme is an unknown name

Return type:

Optional[Theme]

pymodaq_gui.qt_utils.center_widget_on_screen_and_show(widget)[source]
pymodaq_gui.qt_utils.decode_data(encoded_data)[source]

Decode QbyteArrayData generated when drop items in table/tree/list view :param encoded_data: Encoded data of the mime data to be dropped :type encoded_data: QByteArray

Returns:

data – list of dict whose key is the QtRole in the Model, and the value a QVariant

Return type:

list

pymodaq_gui.qt_utils.mkQApp(name)[source]
pymodaq_gui.qt_utils.setLocale()[source]

defines the Locale to use to convert numbers to strings representation using language/country conventions Default is English and US

pymodaq_gui.qt_utils.start_qapplication(name='default_app')[source]
Return type:

QApplication