bec_widgets.applications.main_app#

Classes#

BECMainApp

Mixin class for all BEC widgets, to handle cleanup

Functions#

main()

Main function to run the BEC main application, exposed as a script entry point through

Module Contents#

class BECMainApp(parent=None, *args, anim_duration: int = ANIMATION_DURATION, show_examples: bool = False, **kwargs)#

Bases: 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)
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_guided_tour_to_menu()#

Add a ‘Guided Tour’ action to the Help menu.

_add_views()#
_on_view_selected(vid: str) None#
_setup_guided_tour()#

Setup the guided tour for the main application. Registers key UI components and delegates to views for their internal components.

add_dark_mode_item(id: str = 'dark_mode', position: int | None = None)#
add_section(title: str, id: str, position: int | None = None)#
add_separator()#
add_view(*, icon: str, title: str, view_id: str | None = None, widget: qtpy.QtWidgets.QWidget, mini_text: str | None = None, position: int | None = None, from_top: bool = True, toggleable: bool = True, exclusive: bool = True) bec_widgets.applications.navigation_centre.side_bar_components.NavigationItem#

Register a view in the stack and create a matching nav item in the sidebar.

Parameters:
  • icon (str) – Icon name for the nav item.

  • title (str) – Title for the nav item.

  • view_id (str, optional) – Unique ID for the view/item. If omitted, uses mini_text; if mini_text is also omitted, uses title.

  • widget (QWidget) – The widget to add to the stack.

  • mini_text (str, optional) – Short text for the nav item when sidebar is collapsed.

  • position (int, optional) – Position to insert the nav item.

  • from_top (bool, optional) – Whether to count position from the top or bottom.

  • toggleable (bool, optional) – Whether the nav item is toggleable.

  • exclusive (bool, optional) – Whether the nav item is exclusive.

Returns:

The created navigation item.

Return type:

NavigationItem

cleanup()#

Cleanup the widget.

set_current(id: str) None#
start_guided_tour()#

Public method to start the guided tour. This can be called programmatically or connected to a menu/button action.

PLUGIN = False#
RPC = False#
guided_tour#
sidebar#
stack#
main()#

Main function to run the BEC main application, exposed as a script entry point through pyproject.toml.