Import Export Handler
app.ui.handlers.import_export_handlerImport / Export handler for detection and tracking layer data.
See Also
DetectionImportService— imports detection-layer dataTrackingExportService— exports tracking-layer data
Layer: Presentation. Context: Converts user actions and worker signals into application calls and UI feedback.
ImportExportHandler
Bases: QObject
Handles import and export operations for detection layers (A/B) and tracking layers (C/D).
Responsibilities
- Open
ImportExportDialogscoped to the appropriate layers when either "Import / Export" button is clicked. - Dispatch the user's choice to
Application.import_layerorApplication.export_layer. - Trigger a frame re-render after a successful import so the UI reflects the newly loaded data immediately.
- Show a success / error status message via the window's status bar.
Note
Signal flow:
right_panel.imp_exp_detections_button.clicked
└──> on_import_export_detections()
└──> _run_import_export(scope=[A, B], title="Detection")
right_panel.imp_exp_tracks_button.clicked
└──> on_import_export_tracks()
└──> _run_import_export(scope=[C, D], title="Tracking")
After a successful import the handler calls
controller.render_frame_for_session_id() so the video preview
updates without the user having to scrub the timeline.
After a successful export only a status-bar message is shown — no re-render is needed because the session data was not modified.
Consider future improvement: run the actual file I/O in a background QThread (similar to how DetectionWorker / TrackingWorker operate) so that very large files do not freeze the UI during deserialisation.
| PARAMETER | DESCRIPTION |
|---|---|
controller
|
Controller supplying import/export actions, the active window, and post-import rendering.
TYPE:
|
__init__(controller: UIController) -> None
on_import_export_detections() -> None
Open the Import / Export dialog scoped to detection layers A and B.
Triggered By:
Right panel imp_exp_detections_button.clicked
on_import_export_tracks() -> None
Open the Import / Export dialog scoped to tracking layers C and D.
Triggered By:
Right panel imp_exp_tracks_button.clicked