8.5.8.3. pymodaq_gui.utils.custom_app module

class pymodaq_gui.utils.custom_app.CustomApp(parent=None, tree=None, title=None, toolbar=None, create_app_toolbar=True, add_toolbar_break=True, create_app_menu=False)[source]

Bases: QObject, ActionManager, ParameterManager

Base Class to ease the implementation of User Interfaces

Inherits the MixIns ActionManager and ParameterManager classes. You have to subclass some methods and make concrete implementation of a given number of methods:

Other methods to reimplement, related to Parameter management

  • value_changed: non mandatory, see pymodaq.utils.managers.parameter_manager.ParameterManager

  • child_added: non mandatory, see pymodaq.utils.managers.parameter_manager.ParameterManager

  • param_deleted: non mandatory, see pymodaq.utils.managers.parameter_manager.ParameterManager

Depending on the object type, the mainwindow and dockarea attributes may be None

if parent is:

  • None or QWidget, the attributes will be
    • parent = QWidget

    • maindow = None

    • dockarea = None

  • DockArea, the attributes will be
    • parent = DockArea

    • maindow = QMainWindow

    • dockarea = DockArea

  • QMainWindow, the attributes will be
    • parent = QMainWindow

    • maindow = QMainWindow

    • dockarea = None

title

Get/set the app title

Type:

str

parent
Type:

QWidget, QMainWindow or DockArea

mainwindow

the parent QMainWindow

Type:

QMainWindow

dockarea

The underlying DockArea (as central widget of the QMainWindow)

Type:

DockArea

menubar

The QMainWindow menubar

Type:

QMenuBar

statusbar

The QMainWindow statusbar

Type:

QStatusBar

splash_sc

A splash screen to be used to display information

Type:

QSplashScreen

get_theme[source]

Returns the current QApplication theme, see qt_themes package

Type:

method

Parameters:

parent (Union[DockArea, QMainWindow, QWidget])

tree: ParameterTree

an optional Custom ParameterTree

title: str

The title of the Application instance

toolbar: QTtWidgets.QToolbar

a toolbar from another parent application

create_app_toolbar: bool

If True (default) will create a default toolbar with the name of the application as reference and title

add_toolbar_break: bool

If True, will add a break in the QToolbarArea before adding the toolbar

create_app_menu: bool

If True (default is False) will create a default menu in the menubar with the name of the application as reference and title

See also

pymodaq.utils.managers.action_manager.ActionManager, pymodaq.utils.managers.parameter_manager.ParameterManager

Attributes:
menubar
splash_sc
statusbar
title

Methods

connect_things()

Connect actions and/or other widgets signal to methods

do_things_after_ui_setup()

Method to be reimplemented in order to do things after the UI setup

get_local_folder([user])

Create a local User or system wide folder to store things about this extension

quit_fun()

Method to be reimplemented in order to define a custom quit function

setup_actions()

Method where to create actions.

setup_docks()

deprecated, see setup_docks_and_widgets

setup_docks_and_widgets()

Method to be reimplemented to set up the docks layout and/or widgets

setup_menu([menubar])

Deprecated, use setup_menus_and_toolbars

setup_menus_and_toolbars([menubar])

Non-mandatory method to be subclassed in order to create menus and toolbars

update_status(message[, wait_time])

Show the message in the status bar with a delay of wait_time ms.

get_theme

log_signal

setup_ui

classmethod get_local_folder(user=False)[source]

Create a local User or system wide folder to store things about this extension

Return type:

Path

static get_theme(name=None)[source]
Return type:

Theme

connect_things()[source]

Connect actions and/or other widgets signal to methods

To be reimplemented

do_things_after_ui_setup()[source]

Method to be reimplemented in order to do things after the UI setup

quit_fun()[source]

Method to be reimplemented in order to define a custom quit function

setup_actions()[source]

Method where to create actions.

To be reimplemented

Examples

>>> self.add_action('grab', 'Grab', 'camera', "Grab from camera", checkable=True, menu='file_menu')
>>> self.add_action('load', 'Load', 'Open', "Load target file (.h5, .png, .jpg) or data from camera", checkable=False)
>>> self.add_action('save', 'Save' 'SaveAs', "Save current data", checkable=False)

>>>self.affect_to(‘load’, ‘file_menu’) >>>self.affect_to(‘save’, ‘file_menu’)

setup_docks()[source]

deprecated, see setup_docks_and_widgets

setup_docks_and_widgets()[source]

Method to be reimplemented to set up the docks layout and/or widgets

Examples

>>>self.docks[‘ADock’] = gutils.Dock(‘ADock name’) >>>self.dockarea.addDock(self.docks[‘ADock’]) >>>self.docks[‘AnotherDock’] = gutils.Dock(‘AnotherDock name’) >>>self.dockarea.addDock(self.docks[‘AnotherDock’’’], ‘bottom’, self.docks[‘ADock’])

setup_menu(menubar=None)[source]

Deprecated, use setup_menus_and_toolbars

setup_menus_and_toolbars(menubar=None)[source]

Non-mandatory method to be subclassed in order to create menus and toolbars

create menu and toolbar for actions defined in setup_actions, for instance:

Examples

>>>file_menu = self.add_menu(‘file_menu’, ‘File’, self.menubar) >>>submenu = self.add_menu(‘submenu’, ‘ASubMenu’, ‘file_menu’) >>>file_toolbar = self.add_toolbar(‘file_toolbar’, ‘File’, self.mainwindow)

See also

pymodaq.utils.managers.action_manager.ActionManager

setup_ui()[source]
update_status(message, wait_time=None)[source]

Show the message in the status bar with a delay of wait_time ms.

dockarea: DockArea
docks: Dict[str, Dock]
mainwindow: QMainWindow
property menubar
params = []
property splash_sc: QSplashScreen
property statusbar: QStatusBar | None
property title: str