bec_widgets.applications.views.view =================================== .. py:module:: bec_widgets.applications.views.view Classes ------- .. autoapisummary:: bec_widgets.applications.views.view.ViewBase bec_widgets.applications.views.view.ViewTourSteps bec_widgets.applications.views.view.WaveformViewInline bec_widgets.applications.views.view.WaveformViewPopup Module Contents --------------- .. py: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: :py:obj:`bec_widgets.BECWidget`, :py:obj:`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. :param content: The actual view widget to display. :type content: QWidget :param parent: Parent widget. :type parent: QWidget | None :param view_id: Optional view view_id, useful for debugging or introspection. :type view_id: str | None :param title: Optional human-readable title. :type title: str | None 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:: activate() -> None Switch the parent application to this view. .. py:method:: cleanup() Cleanup the widget. .. py:method:: on_enter() -> None Called after the view becomes current/visible. Default implementation does nothing. Override in subclasses. .. py:method:: on_exit() -> bool Called before the view is switched away/hidden. Return True to allow switching, or False to veto. Default implementation allows switching. .. py:method:: register_tour_steps(guided_tour, main_app) -> ViewTourSteps | None Register this view's components with the guided tour. :param guided_tour: The GuidedTour instance to register with. :param 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. :rtype: ViewTourSteps | None Override this method in subclasses to register view-specific components. .. py:method:: set_content(content: qtpy.QtWidgets.QWidget) -> None Replace the current content widget with a new one. .. py:attribute:: PLUGIN :value: False .. py:attribute:: RPC :value: True .. py:attribute:: RPC_CONTENT_ATTR :value: 'content' .. py:attribute:: RPC_CONTENT_CLASS :type: type[qtpy.QtWidgets.QWidget] | None :value: None .. py:attribute:: USER_ACCESS :value: ['activate'] .. py:attribute:: content :type: qtpy.QtWidgets.QWidget | None :value: None .. py:attribute:: view_id :value: None .. py:attribute:: view_title :value: None .. py:class:: ViewTourSteps(/, **data: Any) Bases: :py:obj:`pydantic.BaseModel` Model representing tour steps for a view. .. attribute:: view_title The human-readable title of the view. .. attribute:: 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. .. py:attribute:: step_ids :type: List[str] .. py:attribute:: view_title :type: str .. py:class:: WaveformViewInline(parent=None, *args, **kwargs) Bases: :py:obj:`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. :param content: The actual view widget to display. :type content: QWidget :param parent: Parent widget. :type parent: QWidget | None :param view_id: Optional view view_id, useful for debugging or introspection. :type view_id: str | None :param title: Optional human-readable title. :type title: str | None 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:: _apply_settings_and_show_waveform() .. py:method:: _exit_reply(yes: bool) .. py:method:: _show_waveform_without_changes() .. py:method:: on_enter() -> None Called after the view becomes current/visible. Default implementation does nothing. Override in subclasses. .. py:method:: on_exit() -> bool Called before the view is switched away/hidden. Return True to allow switching, or False to veto. Default implementation allows switching. .. py:attribute:: confirm_page .. py:attribute:: device_edit .. py:attribute:: entry_edit .. py:attribute:: settings_page .. py:attribute:: stack .. py:attribute:: waveform .. py:attribute:: waveform_page .. py:class:: WaveformViewPopup(parent=None, *args, **kwargs) Bases: :py:obj:`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. :param content: The actual view widget to display. :type content: QWidget :param parent: Parent widget. :type parent: QWidget | None :param view_id: Optional view view_id, useful for debugging or introspection. :type view_id: str | None :param title: Optional human-readable title. :type title: str | None 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:: on_enter() -> None Called after the view becomes current/visible. Default implementation does nothing. Override in subclasses. .. py:method:: on_exit() -> bool Called before the view is switched away/hidden. Return True to allow switching, or False to veto. Default implementation allows switching. .. py:attribute:: waveform