Skip to content

Dialogue Handler

app.ui.handlers.dialogue_handler

View source code

Dialog management handler for UI interactions.

See Also

Layer: Presentation. Context: Converts user actions and worker signals into application calls and UI feedback.

DialogueHandler

Bases: QObject

Creates and manages modal dialogs for user interactions.

Responsibilities
  • Create and return edit detection dialog with initial values.
  • Create and return model change warning dialog.
  • Pass dialog instances to callers for execution and data retrieval.
Note

Factory pattern: creates dialogs without managing lifecycle. Caller is responsible for executing dialog and handling results. Centralizes dialog creation logic.

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

__init__(controller: UIController)

controller: UIController supplying the parent window and application queries needed to construct dialogs.

handle_edit_annotation_dialogue(initial_label: str, initial_bbox_xyxy: tuple[int, int, int, int]) -> EditAnnotationDialog

Create edit detection dialog with initial label and coordinates.

PARAMETER DESCRIPTION
initial_label

The label text to pre-populate.

TYPE: str

initial_bbox_xyxy

Tuple (x1, y1, x2, y2) of detection coordinates.

TYPE: tuple[int, int, int, int]

RETURNS DESCRIPTION
EditAnnotationDialog

A EditAnnotationDialog instance ready to execute. Caller must call .exec() and then .get_annotation_data() to retrieve results.

TYPE: EditAnnotationDialog

handle_model_change_warning_dialogue(s_id: SessionId) -> ModelChangeWarningDialog

Create model change warning dialog for the session.

PARAMETER DESCRIPTION
s_id

Session ID (for context, if needed).

TYPE: SessionId

RETURNS DESCRIPTION
ModelChangeWarningDialog

A ModelChangeWarningDialog instance ready to execute. Caller must call .exec() and then .get_results() to retrieve (keep_manual, dont_ask_again) tuple.

TYPE: ModelChangeWarningDialog