Skip to content

Application Adapter

app.application.adapters.application_adapter

View source code

Explicit adapter wrapping Application to ApplicationInterface.

Important Note

All methods of ApplicationAdapter are intended for use only by application services.

See Also

Layer: Application. Context: Adapts infrastructure implementations to application contracts.

ApplicationAdapter

Bases: UIApplicationInterface

Explicit adapter that wraps the top-level Application façade and exposes only the ApplicationInterface contract used by services and managers.

The Application class already satisfies ApplicationInterface via structural subtyping (Protocol), so this adapter is not required for runtime correctness. It exists to:

  • Provide an explicit, typed boundary between the application façade and the components that need only session access.
  • Make session-repository dependencies visible and mockable in tests without depending on the entire Application instance.
PARAMETER DESCRIPTION
app

Concrete application wrapped to expose the session operations required by application services.

TYPE: Application

active_session: Session | None property

Retrieve the currently active Session instance, or None if no session is active.

RETURNS DESCRIPTION
Session | None

The active session, or None if there is no active session.

active_session_id: SessionId | None property writable

Retrieve the SessionId of the currently active session, or None if none is active.

RETURNS DESCRIPTION
SessionId | None

The active session identifier, or None if none is active.

all_s_ids: Iterable[SessionId] property

Iterate over all SessionId instances currently managed by the application.

RETURNS DESCRIPTION
Iterable[SessionId]

Iterable view of the managed session identifiers.

__init__(app: Application) -> None

get_selected_detection_model_name(s_id: SessionId) -> str

Retrieve the name of the currently selected detection model for s_id.

PARAMETER DESCRIPTION
s_id

Identifier of the session whose model selection is queried.

TYPE: SessionId

RETURNS DESCRIPTION
str

Name of the selected detection model.

get_session_by_id(s_id: SessionId) -> Session

Fetch the Session instance identified by s_id.

PARAMETER DESCRIPTION
s_id

Identifier of the target session.

TYPE: SessionId

RETURNS DESCRIPTION
Session

The session identified by s_id.

initialize_active_session() -> None

Set the first available session as the active session.

open_video_from_path(path: str) -> None

Open a video file and create a new session from path.

PARAMETER DESCRIPTION
path

Filesystem path of the video to open.

TYPE: str

set_session_state_is_playing(s_id: SessionId, is_playing: bool) -> None

Set the playback view_state (playing/paused) for the session s_id.

PARAMETER DESCRIPTION
s_id

Identifier of the session whose playback state to update.

TYPE: SessionId

is_playing

True to play the session; False to pause it.

TYPE: bool

stop_all_playback() -> None

Stop playback for all active sessions.