bec_widgets.applications.launch_window ====================================== .. py:module:: bec_widgets.applications.launch_window Attributes ---------- .. autoapisummary:: bec_widgets.applications.launch_window.MODULE_PATH bec_widgets.applications.launch_window.START_EMPTY_PROFILE_OPTION Classes ------- .. autoapisummary:: bec_widgets.applications.launch_window.LaunchTile bec_widgets.applications.launch_window.LaunchWindow Module Contents --------------- .. py:class:: LaunchTile(parent: qtpy.QtCore.QObject | None = None, icon_path: str | None = None, top_label: str | None = None, main_label: str | None = None, description: str | None = None, show_selector: bool = False, tile_size: tuple[int, int] | None = None) Bases: :py:obj:`bec_widgets.utils.round_frame.RoundedFrame` A custom QFrame with rounded corners and optional theme updates. The frame can contain any QWidget, however it is mainly designed to wrap PlotWidgets to provide a consistent look and feel with other BEC Widgets. .. py:method:: _fit_label_to_width(label: qtpy.QtWidgets.QLabel, max_width: int, min_pt: int = 10) Fit the label text to the specified maximum width by adjusting the font size. :param label: The label to adjust. :type label: QLabel :param max_width: The maximum width the label can occupy. :type max_width: int :param min_pt: The minimum font point size to use. :type min_pt: int .. py:attribute:: DEFAULT_SIZE :value: (250, 300) .. py:attribute:: action_button .. py:attribute:: description_label .. py:attribute:: icon_label .. py:attribute:: main_label .. py:attribute:: open_signal .. py:attribute:: spacer_bottom .. py:attribute:: spacer_top .. py:attribute:: tile_size :value: None .. py:attribute:: top_label .. py:class:: LaunchWindow(parent=None, gui_id: str = None, window_title='BEC Launcher', launch_gui_class: str = None, launch_gui_id: str = None, *args, **kwargs) Bases: :py:obj:`bec_widgets.widgets.containers.main_window.main_window.BECMainWindow` Mixin 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) :param client: The BEC client. :type client: BECClient, optional :param config: The connection configuration. :type config: ConnectionConfig, optional :param gui_id: The GUI ID. :type gui_id: str, optional :param theme_update: 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. :type theme_update: bool, optional .. py:method:: _default_launch_geometry() -> tuple[int, int, int, int] | None .. py:method:: _launch_auto_update(auto_update: str, geometry: tuple[int, int, int, int] | None = None) -> bec_widgets.widgets.containers.auto_update.auto_updates.AutoUpdates .. py:method:: _launch_custom_ui_file(ui_file: str | None) -> bec_widgets.widgets.containers.main_window.main_window.BECMainWindow Load a custom .ui file. If the top-level widget is a MainWindow subclass, instantiate it directly; otherwise, embed it in a UILaunchWindow. .. py:method:: _launch_widget(widget: type[bec_widgets.utils.bec_widget.BECWidget], geometry: tuple[int, int, int, int] | None = None) -> qtpy.QtWidgets.QWidget .. py:method:: _launcher_is_last_widget(connections: dict) -> bool Check if the launcher is the last widget in the application. .. py:method:: _open_auto_update() Open the auto update window. .. py:method:: _open_custom_ui_file() Open a file dialog to select a custom UI file and launch it. .. py:method:: _open_dock_area() Open Advanced Dock Area using the selected profile. .. py:method:: _open_widget() Open a widget from the available widgets. .. py:method:: _refresh_dock_area_profiles(preserve_selection: bool = True) -> None Refresh the dock-area profile selector, optionally preserving the selection. Defaults to Start Empty when no valid selection can be preserved. :param preserve_selection: Whether to preserve the current selection or not. :type preserve_selection: bool .. py:method:: _set_selector_to_default_profile(selector: qtpy.QtWidgets.QComboBox, profiles: list[str]) -> None Set the selector default. Preference order: 1) Start Empty option (if available) 2) Last used profile 3) First available profile :param selector: The combobox to set. :type selector: QComboBox :param profiles: List of available profiles. :type profiles: list[str] .. py:method:: _turn_off_the_lights(connections: dict) If there is only one connection remaining, it is the launcher, so we show it. Once the launcher is closed as the last window, we quit the application. .. py:method:: _update_available_auto_updates() -> dict[str, type[bec_widgets.widgets.containers.auto_update.auto_updates.AutoUpdates]] :staticmethod: Load all available auto updates from the plugin repository. .. py:method:: apply_theme(theme: str) Change the theme of the application. .. py:method:: closeEvent(event) Close the launcher window. .. py:method:: hide_launcher() Hide the launcher window. .. py:method:: launch(launch_script: str, name: str | None = None, geometry: tuple[int, int, int, int] | None = None, **kwargs) -> qtpy.QtWidgets.QWidget | None Launch the specified script. If the launch script creates a QWidget, it will be embedded in a BECMainWindow. If the launch script creates a BECMainWindow, it will be shown as a separate window. :param launch_script: The name of the script to be launched. :type launch_script: str :param name: The name of the dock area. :type name: str :param geometry: The geometry parameters to be passed to the dock area. :type geometry: tuple :returns: The created dock area. :rtype: QWidget .. py:method:: register_tile(name: str, icon_path: str | None = None, top_label: str | None = None, main_label: str | None = None, description: str | None = None, action_button: Callable | None = None, show_selector: bool = False, selector_items: list[str] | None = None) Register a tile in the launcher window. :param name: The name of the tile. :type name: str :param icon_path: The path to the icon. :type icon_path: str :param top_label: The top label of the tile. :type top_label: str :param main_label: The main label of the tile. :type main_label: str :param description: The description of the tile. :type description: str :param action_button: The action to be performed when the button is clicked. :type action_button: callable :param show_selector: Whether to show a selector or not. :type show_selector: bool :param selector_items: The items to be shown in the selector. :type selector_items: list[str] .. py:method:: showEvent(event) .. py:method:: show_launcher() Show the launcher window. .. py:attribute:: DEFAULT_LAUNCH_SIZE :value: (800, 600) .. py:attribute:: PLUGIN :value: False .. py:attribute:: RPC :value: True .. py:attribute:: TILE_SIZE :value: (250, 300) .. py:attribute:: USER_ACCESS :value: ['show_launcher', 'hide_launcher'] .. py:attribute:: available_auto_updates :type: dict[str, type[bec_widgets.widgets.containers.auto_update.auto_updates.AutoUpdates]] .. py:attribute:: available_widgets :type: dict[str, type[bec_widgets.utils.bec_widget.BECWidget]] .. py:attribute:: central_widget .. py:attribute:: dark_mode_button .. py:attribute:: register .. py:attribute:: spacer .. py:attribute:: tiles :type: dict[str, LaunchTile] .. py:attribute:: toolbar .. py:data:: MODULE_PATH .. py:data:: START_EMPTY_PROFILE_OPTION :value: 'Start Empty (No Profile)'