bec_widgets.applications.views.view#

Classes#

ViewBase

Wrapper for a content widget used inside the main app's stacked view.

ViewTourSteps

Model representing tour steps for a view.

WaveformViewInline

Wrapper for a content widget used inside the main app's stacked view.

WaveformViewPopup

Wrapper for a content widget used inside the main app's stacked view.

Module Contents#

class ViewBase(parent: qtpy.QtWidgets.QWidget | None = None, content: qtpy.QtWidgets.QWidget | None = None, *, view_id: str | None = None, title: str | None = None, **kwargs)#

Bases: bec_widgets.BECWidget, qtpy.QtWidgets.QWidget

Wrapper for a content widget used inside the main app’s stacked view.

Subclasses can implement on_enter and on_exit to run custom logic when the view becomes visible or is about to be hidden.

Parameters:
  • content (QWidget) – The actual view widget to display.

  • parent (QWidget | None) – Parent widget.

  • view_id (str | None) – Optional view view_id, useful for debugging or introspection.

  • title (str | None) – Optional human-readable title.

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.

activate() None#

Switch the parent application to this view.

cleanup()#

Cleanup the widget.

on_enter() None#

Called after the view becomes current/visible.

Default implementation does nothing. Override in subclasses.

on_exit() bool#

Called before the view is switched away/hidden.

Return True to allow switching, or False to veto. Default implementation allows switching.

register_tour_steps(guided_tour, main_app) ViewTourSteps | None#

Register this view’s components with the guided tour.

Parameters:
  • guided_tour – The GuidedTour instance to register with.

  • main_app – The main application instance (for accessing set_current).

Returns:

A model containing the view title and step IDs,

or None if this view has no tour steps.

Return type:

ViewTourSteps | None

Override this method in subclasses to register view-specific components.

set_content(content: qtpy.QtWidgets.QWidget) None#

Replace the current content widget with a new one.

PLUGIN = False#
RPC = True#
RPC_CONTENT_ATTR = 'content'#
RPC_CONTENT_CLASS: type[qtpy.QtWidgets.QWidget] | None = None#
USER_ACCESS = ['activate']#
content: qtpy.QtWidgets.QWidget | None = None#
view_id = None#
view_title = None#
class ViewTourSteps(/, **data: Any)#

Bases: pydantic.BaseModel

Model representing tour steps for a view.

view_title#

The human-readable title of the view.

step_ids#

List of registered step IDs in the order they should appear.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

step_ids: List[str]#
view_title: str#
class WaveformViewInline(parent=None, *args, **kwargs)#

Bases: ViewBase

Wrapper for a content widget used inside the main app’s stacked view.

Subclasses can implement on_enter and on_exit to run custom logic when the view becomes visible or is about to be hidden.

Parameters:
  • content (QWidget) – The actual view widget to display.

  • parent (QWidget | None) – Parent widget.

  • view_id (str | None) – Optional view view_id, useful for debugging or introspection.

  • title (str | None) – Optional human-readable title.

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.

_apply_settings_and_show_waveform()#
_exit_reply(yes: bool)#
_show_waveform_without_changes()#
on_enter() None#

Called after the view becomes current/visible.

Default implementation does nothing. Override in subclasses.

on_exit() bool#

Called before the view is switched away/hidden.

Return True to allow switching, or False to veto. Default implementation allows switching.

confirm_page#
device_edit#
entry_edit#
settings_page#
stack#
waveform#
waveform_page#
class WaveformViewPopup(parent=None, *args, **kwargs)#

Bases: ViewBase

Wrapper for a content widget used inside the main app’s stacked view.

Subclasses can implement on_enter and on_exit to run custom logic when the view becomes visible or is about to be hidden.

Parameters:
  • content (QWidget) – The actual view widget to display.

  • parent (QWidget | None) – Parent widget.

  • view_id (str | None) – Optional view view_id, useful for debugging or introspection.

  • title (str | None) – Optional human-readable title.

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.

on_enter() None#

Called after the view becomes current/visible.

Default implementation does nothing. Override in subclasses.

on_exit() bool#

Called before the view is switched away/hidden.

Return True to allow switching, or False to veto. Default implementation allows switching.

waveform#