Skip to content

Bbox Selection State

app.ui.view_state.bbox_selection_state

View source code

Box selection state container.

Maintains the set of selected box keys for a given session and tab. This is the single source of truth for which boxes are currently selected.

See Also

Layer: Presentation. Context: Stores transient state used by presentation interactions.

BBoxSelectionState

Shared box-key selection container for a given session and tab.

Scoped by (session_id, tab_index) pair. Provides methods to query, update, and inspect the current selection.

Layer: Presentation. Context: Supports user interaction and delegates application work through presentation contracts.

__init__() -> None

clear() -> None

Clear the selection.

count() -> int

Return the number of selected boxes.

RETURNS DESCRIPTION
int

Number of currently selected box keys.

deselect(key: str) -> None

Remove a single box key from the selection.

PARAMETER DESCRIPTION
key

Key of the box to remove from the selection.

TYPE: str

get_selected_keys() -> list[str]

Return the list of currently selected box keys.

RETURNS DESCRIPTION
list[str]

List of selected box keys; ordering is unspecified.

has_selection() -> bool

Check if any boxes are selected.

RETURNS DESCRIPTION
bool

True when the selection contains at least one key.

invert(all_keys: list[str]) -> None

Invert selection: select what's not selected, deselect what is.

PARAMETER DESCRIPTION
all_keys

Complete set of keys eligible for selection.

TYPE: list[str]

is_selected(key: str) -> bool

Check if a box key is selected.

PARAMETER DESCRIPTION
key

Box key to check.

TYPE: str

RETURNS DESCRIPTION
bool

True if key is currently selected.

select(key: str) -> None

Add a single box key to the selection.

PARAMETER DESCRIPTION
key

Key of the box to select.

TYPE: str

select_all(keys: list[str]) -> None

Select all keys in the provided list.

PARAMETER DESCRIPTION
keys

Box keys to add to the current selection.

TYPE: list[str]

set_selection(keys: list[str]) -> None

Replace the entire selection with the given keys.

PARAMETER DESCRIPTION
keys

Box keys that should become the complete selection.

TYPE: list[str]

toggle(key: str) -> None

Toggle the selection state of a single box key.

PARAMETER DESCRIPTION
key

Key whose selected state should be toggled.

TYPE: str