bec_widgets.applications.launch_window#
Attributes#
Classes#
A custom QFrame with rounded corners and optional theme updates. |
|
Mixin class for all BEC widgets, to handle cleanup |
Module Contents#
- 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:
bec_widgets.utils.round_frame.RoundedFrameA 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.
- _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.
- Parameters:
label (QLabel) – The label to adjust.
max_width (int) – The maximum width the label can occupy.
min_pt (int) – The minimum font point size to use.
- DEFAULT_SIZE = (250, 300)#
- action_button#
- description_label#
- icon_label#
- main_label#
- open_signal#
- spacer_bottom#
- spacer_top#
- tile_size = None#
- top_label#
- 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:
bec_widgets.widgets.containers.main_window.main_window.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.
- _default_launch_geometry() tuple[int, int, int, int] | None#
- _launch_auto_update(auto_update: str, geometry: tuple[int, int, int, int] | None = None) bec_widgets.widgets.containers.auto_update.auto_updates.AutoUpdates#
- _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.
- _launch_widget(widget: type[bec_widgets.utils.bec_widget.BECWidget], geometry: tuple[int, int, int, int] | None = None) qtpy.QtWidgets.QWidget#
- _launcher_is_last_widget(connections: dict) bool#
Check if the launcher is the last widget in the application.
- _open_auto_update()#
Open the auto update window.
- _open_custom_ui_file()#
Open a file dialog to select a custom UI file and launch it.
- _open_dock_area()#
Open Advanced Dock Area using the selected profile.
- _open_widget()#
Open a widget from the available widgets.
- _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.
- Parameters:
preserve_selection (bool) – Whether to preserve the current selection or not.
- _set_selector_to_default_profile(selector: qtpy.QtWidgets.QComboBox, profiles: list[str]) None#
Set the selector default.
- Preference order:
Start Empty option (if available)
Last used profile
First available profile
- Parameters:
selector (QComboBox) – The combobox to set.
profiles (list[str]) – List of available profiles.
- _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.
- static _update_available_auto_updates() dict[str, type[bec_widgets.widgets.containers.auto_update.auto_updates.AutoUpdates]]#
Load all available auto updates from the plugin repository.
- apply_theme(theme: str)#
Change the theme of the application.
- closeEvent(event)#
Close the launcher window.
- hide_launcher()#
Hide the launcher window.
- 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.
- Parameters:
launch_script (str) – The name of the script to be launched.
name (str) – The name of the dock area.
geometry (tuple) – The geometry parameters to be passed to the dock area.
- Returns:
The created dock area.
- Return type:
QWidget
- 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.
- Parameters:
name (str) – The name of the tile.
icon_path (str) – The path to the icon.
top_label (str) – The top label of the tile.
main_label (str) – The main label of the tile.
description (str) – The description of the tile.
action_button (callable) – The action to be performed when the button is clicked.
show_selector (bool) – Whether to show a selector or not.
selector_items (list[str]) – The items to be shown in the selector.
- showEvent(event)#
- show_launcher()#
Show the launcher window.
- DEFAULT_LAUNCH_SIZE = (800, 600)#
- PLUGIN = False#
- RPC = True#
- TILE_SIZE = (250, 300)#
- USER_ACCESS = ['show_launcher', 'hide_launcher']#
- available_auto_updates: dict[str, type[bec_widgets.widgets.containers.auto_update.auto_updates.AutoUpdates]]#
- available_widgets: dict[str, type[bec_widgets.utils.bec_widget.BECWidget]]#
- central_widget#
- dark_mode_button#
- register#
- spacer#
- tiles: dict[str, LaunchTile]#
- toolbar#
- MODULE_PATH#
- START_EMPTY_PROFILE_OPTION = 'Start Empty (No Profile)'#