mpylab.gui.qt module¶
Opt-in Qt branding, native menu actions and nonmodal application information.
- class mpylab.gui.qt.AboutDialog(*args: Any, **kwargs: Any)
Bases:
QDialogReusable, nonmodal application information with palette-aware artwork.
- Parameters:
identity (ApplicationIdentity) – Application and artwork metadata.
parent (QWidget, optional) – Owning tool window.
tool_name (str, optional) – Additional tool name inside the dialog for a shared application identity.
- changeEvent(event)
Refresh artwork after a palette change.
- Parameters:
event (QEvent) – Qt widget change event.
- mpylab.gui.qt.application_icon(identity=ApplicationIdentity(name='MPyLab', version='1.0.33', description='Graph-based laboratory measurements and device test tools.', resource_package='mpylab.gui', resource_directory=('resources', 'branding'), documentation_url='https://mpylab-75fcff.gp.hrz.tu-chemnitz.de/', project_url='https://gitlab.hrz.tu-chemnitz.de/chair-of-electromagnetic-theory-and-compatibility-at-tu-dresden/mpylab/mpylab', author='Hans Georg Krauthäuser', license_name='GPL-3.0-or-later', tagline='Graph-Based Lab Measurements'))
Load an icon from installed package resources.
- Parameters:
identity (ApplicationIdentity, optional) – Application and artwork metadata; defaults to MPyLab.
- Returns:
Application icon with a neutral background.
- Return type:
QIcon
- Raises:
FileNotFoundError – The application did not package the requested artwork.
ValueError – Packaged icon data cannot be decoded.
- mpylab.gui.qt.create_application(argv, identity=ApplicationIdentity(name='MPyLab', version='1.0.33', description='Graph-based laboratory measurements and device test tools.', resource_package='mpylab.gui', resource_directory=('resources', 'branding'), documentation_url='https://mpylab-75fcff.gp.hrz.tu-chemnitz.de/', project_url='https://gitlab.hrz.tu-chemnitz.de/chair-of-electromagnetic-theory-and-compatibility-at-tu-dresden/mpylab/mpylab', author='Hans Georg Krauthäuser', license_name='GPL-3.0-or-later', tagline='Graph-Based Lab Measurements'))
Create or reuse QApplication with identity established before Cocoa starts.
- Parameters:
argv (sequence of str) – Qt command-line arguments including the executable name.
identity (ApplicationIdentity, optional) – Application and artwork metadata; defaults to MPyLab.
- Returns:
Existing application or a newly initialized one.
- Return type:
QApplication
Notes
Existing host applications retain their identity and dialog preferences. On macOS a new application uses Qt dialogs to avoid the native NSAlert rendering crash observed with Qt 6.11.2 on the development Mac. Native menus remain enabled. No interpreter or system files are modified.
- mpylab.gui.qt.install_branding(window, identity=ApplicationIdentity(name='MPyLab', version='1.0.33', description='Graph-based laboratory measurements and device test tools.', resource_package='mpylab.gui', resource_directory=('resources', 'branding'), documentation_url='https://mpylab-75fcff.gp.hrz.tu-chemnitz.de/', project_url='https://gitlab.hrz.tu-chemnitz.de/chair-of-electromagnetic-theory-and-compatibility-at-tu-dresden/mpylab/mpylab', author='Hans Georg Krauthäuser', license_name='GPL-3.0-or-later', tagline='Graph-Based Lab Measurements'), *, menu_bar=None, about_action=None, quit_action=None)
Add project identity, About and Quit without replacing a close handler.
- Parameters:
window (QWidget) – Tool window with an existing layout, or QMainWindow.
identity (ApplicationIdentity, optional) – Application and artwork metadata; defaults to MPyLab.
menu_bar (QMenuBar, optional) – Existing menu bar. Otherwise use or create the window’s menu bar.
about_action (QAction, optional) – Existing About action with no connected About callback.
quit_action (QAction, optional) – Existing Quit action already connected to the window’s close handler.
- Returns:
Window-owned controller exposing about_action, quit_action and dialog. Repeated installation returns the same controller without adding menus.
- Return type:
QObject
- Raises:
ValueError – A plain QWidget has no layout yet or an artwork resource is invalid.
FileNotFoundError – The application did not package its artwork.
Notes
New Quit actions call window.close(), never QApplication.quit(). This keeps existing RF-off, worker shutdown, confirmation and autosave paths intact.