Skip to content

main_menu_screen

anomaly_match_ui.screens.main_menu_screen

Main menu screen with ESA branding, navigation cards, and help.

MainMenuScreen(app)

Bases: BaseScreen

Welcome screen with navigation cards and header.

Parameters:

Name Type Description Default
app AnomalyMatchApp

The parent application instance used for navigation.

required
Source code in anomaly_match_ui/screens/main_menu_screen.py
def __init__(self, app: AnomalyMatchApp) -> None:
    super().__init__(app)

build()

Build and return the main menu layout.

Returns:

Type Description
Widget

The root VBox widget for the main menu screen.

Source code in anomaly_match_ui/screens/main_menu_screen.py
def build(self) -> widgets.Widget:
    """Build and return the main menu layout.

    Returns:
        The root VBox widget for the main menu screen.
    """
    header = HeaderWidget(self.app)

    # Large AM logo
    am_logo_src = load_am_logo_base64()
    logo_widget = widgets.HTML(
        value=(
            f'<div style="text-align:center; padding:32px 0 8px 0;">'
            f'<img src="../{am_logo_src}" style="height:120px;" alt="AnomalyMatch"/>'
            f"</div>"
        ),
    )

    # Navigation cards
    training_card = _make_card(
        title="Training",
        description=(
            "Label images, train the anomaly detection model, "
            "and evaluate results with active learning."
        ),
        icon_svg=load_icon_svg("training_icon.svg"),
        button_color=ESA_GREEN,
        on_click=lambda _: self.navigate_to("training_setup"),
    )

    prediction_card = _make_card(
        title="Prediction",
        description=(
            "Run the trained model on new data to find "
            "anomalies across large image collections."
        ),
        icon_svg=load_icon_svg("prediction_icon.svg"),
        button_color=ESA_BLUE_BRIGHT,
        on_click=lambda _: self.navigate_to("prediction_setup"),
    )

    card_row = HBox(
        [training_card, prediction_card],
        layout=widgets.Layout(
            justify_content="center",
            gap="32px",
            padding="24px 0",
        ),
    )

    return VBox(
        [header.widget, logo_widget, card_row],
        layout=widgets.Layout(
            background_color=BG_COLOR,
            border=f"1px solid {ESA_BLUE_DEEP}",
            min_height="400px",
            width="100%",
        ),
    )

on_enter()

Refresh the main menu when returning to it.

Source code in anomaly_match_ui/screens/main_menu_screen.py
def on_enter(self) -> None:
    """Refresh the main menu when returning to it."""
    self._widget = None