Skip to content

base_screen

anomaly_match_ui.screens.base_screen

Base screen class for the modular UI architecture.

BaseScreen(app)

Bases: ABC

Abstract base class for all UI screens.

Each screen owns a widget tree built lazily on first access. Navigation between screens is handled via the parent app reference.

Parameters:

Name Type Description Default
app AnomalyMatchApp

The parent application instance used for navigation.

required
Source code in anomaly_match_ui/screens/base_screen.py
def __init__(self, app: AnomalyMatchApp) -> None:
    self.app = app
    self._widget: widgets.Widget | None = None

widget property

Lazy-built root widget for this screen.

build() abstractmethod

Build and return the screen's root widget.

Returns:

Type Description
Widget

The root ipywidget for this screen.

Source code in anomaly_match_ui/screens/base_screen.py
@abstractmethod
def build(self) -> widgets.Widget:
    """Build and return the screen's root widget.

    Returns:
        The root ipywidget for this screen.
    """

on_enter()

Called when the screen becomes the active screen.

Source code in anomaly_match_ui/screens/base_screen.py
def on_enter(self) -> None:
    """Called when the screen becomes the active screen."""

on_leave()

Called when the screen is being navigated away from.

Source code in anomaly_match_ui/screens/base_screen.py
def on_leave(self) -> None:
    """Called when the screen is being navigated away from."""

navigate_to(screen_name, **kwargs)

Navigate to another screen via the app.

Parameters:

Name Type Description Default
screen_name str

The registered name of the target screen.

required
**kwargs Any

Extra keyword arguments forwarded to the screen factory.

{}
Source code in anomaly_match_ui/screens/base_screen.py
def navigate_to(self, screen_name: str, **kwargs: Any) -> None:
    """Navigate to another screen via the app.

    Args:
        screen_name: The registered name of the target screen.
        **kwargs: Extra keyword arguments forwarded to the screen factory.
    """
    self.app.navigate_to(screen_name, **kwargs)