bec_widgets.widgets.containers.main_window.main_window#
Attributes#
Classes#
Mixin class for all BEC widgets, to handle cleanup |
|
Mixin class for all BEC widgets, to handle cleanup |
Module Contents#
- class BECMainWindow(parent=None, window_title: str = 'BEC', **kwargs)#
Bases:
bec_widgets.utils.bec_widget.BECWidget,qtpy.QtWidgets.QMainWindowMixin class for all BEC widgets, to handle cleanup
Base class for all BEC widgets. This class should be used as a mixin class for all BEC widgets, e.g.:
>>> class MyWidget(BECWidget, QWidget): >>> def __init__(self, parent=None, client=None, config=None, gui_id=None): >>> super().__init__(parent=parent, client=client, config=config, gui_id=gui_id)
- Parameters:
client (BECClient, optional) – The BEC client.
config (ConnectionConfig, optional) – The connection configuration.
gui_id (str, optional) – The GUI ID.
theme_update (bool, optional) – Whether to subscribe to theme updates. Defaults to False. When set to True, the widget’s apply_theme method will be called when the theme changes.
- _add_client_info_label()#
Add a client info label to the status bar. This label will display messages from the BEC dispatcher.
- _add_notification_indicator()#
Add the notification indicator to the status bar and hook the signals.
- _add_scan_progress_bar()#
- _add_separator(separate_object: bool = False) qtpy.QtWidgets.QWidget | None#
Add a vertically centred separator to the status bar or just return it as a separate object.
- _get_launcher_from_qapp()#
Get the launcher from the QApplication instance.
- _init_bec_icon()#
- _init_status_bar_widgets()#
Prepare the BEC specific widgets in the status bar.
- _init_ui()#
- _position_notification_centre()#
Keep the notification panel at a fixed margin top-right.
Setup the menu bar for the main window.
- _show_launcher()#
Show the launcher if it exists.
- _show_widget_hierarchy_dialog()#
- change_theme(theme: str)#
Change the theme of the application and propagate it to widgets.
- Parameters:
theme (str) – Either “light” or “dark”.
- cleanup()#
Cleanup the widget.
- display_app_id()#
Display the app ID in the status bar.
- display_client_message(msg: dict, meta: dict)#
Display a client message in the status bar.
- Parameters:
msg (dict) – The message to display, should contain:
meta (dict) – Metadata about the message, usually empty.
- event(event)#
- fetch_theme() str#
- load_ui(ui_file)#
- resizeEvent(event)#
- setCentralWidget(widget: qtpy.QtWidgets.QWidget, qt_default: bool = False)#
Re‑implement QMainWindow.setCentralWidget so that the main content widget always lives on the lower layer of the stacked layout that hosts our notification overlays.
- Parameters:
widget – The widget that should become the new central content.
qt_default – When True the call is forwarded to the base class so that Qt behaves exactly as the original implementation (used during __init__ when we first install
self._full_content).
- PLUGIN = True#
- RPC = True#
- SCAN_PROGRESS_HEIGHT = 12#
- SCAN_PROGRESS_WIDTH = 100#
- notification_broker#
- notification_centre#
- status_bar#
- class BECMainWindowNoRPC(parent=None, window_title: str = 'BEC', **kwargs)#
Bases:
BECMainWindowMixin class for all BEC widgets, to handle cleanup
Base class for all BEC widgets. This class should be used as a mixin class for all BEC widgets, e.g.:
>>> class MyWidget(BECWidget, QWidget): >>> def __init__(self, parent=None, client=None, config=None, gui_id=None): >>> super().__init__(parent=parent, client=client, config=config, gui_id=gui_id)
- Parameters:
client (BECClient, optional) – The BEC client.
config (ConnectionConfig, optional) – The connection configuration.
gui_id (str, optional) – The GUI ID.
theme_update (bool, optional) – Whether to subscribe to theme updates. Defaults to False. When set to True, the widget’s apply_theme method will be called when the theme changes.
- PLUGIN = False#
- RPC = False#
- MODULE_PATH#