Skip to content

Export Handler

app.ui.handlers.export_handler

View source code

Video export handler for exporting annotated videos.

See Also

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

ExportHandler

Bases: QObject

Manages video export operations (single session and batch).

Responsibilities
  • Handle single-session export with user file selection.
  • Handle batch export for multiple sessions with export dialog.
  • Manage export worker lifecycle and progress tracking.
  • Toggle blur and detection drawing settings.
  • Update UI with export progress and completion status.
Note

Signal flow: Receives signals from right panel (blur toggle, detection drawing toggle). Receives export button clicks from UI. Emits worker progress, success, and failure signals. Manages export worker and thread lifecycle.

Uses background worker threads for non-blocking export. Prevents overlapping exports. Tracks batch export failures and cancellations. Cleans up workers after completion via deleteLater().

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

has_export_all_worker: bool property

Return whether an all-session export worker has been assigned.

RETURNS DESCRIPTION
bool

True when an all-session export worker is available.

has_export_worker: bool property

Return whether a single-session export worker has been assigned.

RETURNS DESCRIPTION
bool

True when an export worker is available.

is_exporting: bool property

Return whether any export worker is active or awaiting GUI-thread cleanup.

RETURNS DESCRIPTION
bool

True until native thread completion has been handled on the GUI thread.

__init__(controller: UIController) -> None

controller: UIController supplying export operations, export workers, and progress/status widgets.

on_blur_strength_changed(value: float) -> None

Set the selected session's blur strength and refresh its preview.

PARAMETER DESCRIPTION
value

Requested Gaussian blur strength from the controls.

TYPE: float

Note

Triggered by right panel blur_strength_changed signal.

Action: Update session setting blur_strength to new value. Re-render frame with new blur strength.

on_blur_toggled(enabled: bool) -> None

Toggle blur effect on exported video.

Note

Triggered by right panel blur_toggled signal.

Action: Show/hide blur strength slider. Update session setting blur_enabled. Re-render frame to reflect change immediately.

PARAMETER DESCRIPTION
enabled

Whether Gaussian blur is enabled for video export.

TYPE: bool

Note

This master toggle also enables or disables the independent preview-blur control.

Example

handler.on_blur_toggled(True)

on_box_border_width_changed(value: int) -> None

Update preview-only box outline width.

PARAMETER DESCRIPTION
value

Outline width in pixels, constrained by the panel to 1..10.

TYPE: int

Note

This setting affects editor overlays only, not video export.

Example

handler.on_box_border_width_changed(3)

on_draw_boxes_changed(enabled: bool) -> None

Toggle box outlines and ID/label tags in the editor preview.

Note

Triggered by right panel draw_boxes_changed signal.

Action: Update session setting draw_boxes to enabled/disabled. Re-render the editor frame immediately; export rendering is unchanged.

on_export() -> None

Export current session video with annotations to file.

Note

Triggered by right panel export_btn.clicked.

Flow: on_export() [this slot] ├── Validate session is selected ├── Check if export already in progress ├── Validate session has tracking/detection results ├── Show file save dialog ├── Create ExportWorker with output path └──> Connect worker signals and start export

Validates: Session is selected (not None). No export currently in progress. Session has detection and/or tracking results to export. User provides valid output file path.

on_export_all() -> None

Batch export all open sessions with configurable output paths.

Note

Triggered by right panel export_all_btn.clicked or File menu action.

Flow: on_export_all() [this slot] ├── Validate videos are open ├── Check if export already in progress ├── Show batch export configuration dialog ├── Create ExportAllWorker with parameters └──> Connect worker signals and start batch export

User Configuration (via dialog): Output directory path. Filename prefix. Filename suffix.

Tracks: Failed session count (displayed in final message). Cancellation view_state (user stops batch).

on_preview_blur_changed(enabled: bool) -> None

Toggle live Gaussian blur in the editor independently of export blur.

PARAMETER DESCRIPTION
enabled

Whether to render blur in the editor when master blur is enabled.

TYPE: bool

Note

Export blur remains controlled by blur_enabled.

Example

handler.on_preview_blur_changed(True)

on_show_preview_mask_changed(enabled: bool) -> None

Toggle the editor overlay for the export blur footprint.

PARAMETER DESCRIPTION
enabled

Whether to show the semi-transparent alpha mask.

TYPE: bool

Note

The overlay is an editor aid and is not written into exported frames.

Example

handler.on_show_preview_mask_changed(True)

stop_exports(wait: bool = False) -> None

Request cancellation of active exports and optionally wait for workers to finish.

PARAMETER DESCRIPTION
wait

Whether to block until each active worker has stopped.

TYPE: bool DEFAULT: False