Skip to content

State

state

Defines a mutable cross-panel state for the GUI

Usage
  • Stores the user's configuration so that the UI doesn't have to re-load the .env on every panel

  • Holds the UI's internal state, such as whether or not an action is happening (busy)

  • Holds objects that should be accessible from any panel, such as the callback function to display a toast notification on the application-scoped NotificationBar (notify)

AppState dataclass

The GUI's Current Working State

Attributes:

Name Type Description
notify Callable[[str, str], None]

The callback function attached to the application-scoped NotificationBar that triggers the display of a toast notification when called

set_busy Callable[[bool], None]

The callback function that locks/unlocks the navigation and panel buttons while a long-running action is in progress to prevent the user from changing the configuration or navigating away mid-action

backend Backend

The chosen mirumoji transcription backend

source ImageSource

Whether to pull pre-built images or build locally

env_path Path

Path to the managed user configuration file (.env)

env dict[str, str]

Resolved environment variables (from env_path)

busy bool

Whether a long-running action is in progress

sync_dashboard Callable[[], None] | None

The callback function attached to the dashboard's configuration-display elements that updates the shown configuration based on the managed user configuration file whenver the dashboard is re-loaded by the main page

load_deployment(env)

Adopts the persisted backend / image-source choice from env

Values that are missing or unrecognised leave the current selection unchanged

Parameters:

Name Type Description Default
env Mapping[str, str]

The resolved environment values

required