# Архитектура GUI ## 1. Состав - `gui/main.py`: entrypoint приложения. - `gui/app_window.py`: компоновка миксинов и базовой инфраструктуры. - `gui/controllers/*`: orchestration-логика. - `gui/controllers/sections/*`: построение UI-групп (Pipeline, Processing, Radar, Switches и т.д.). - `gui/plotting/*`: чистая логика B-scan расчетов и cache helpers. - `gui/runtime/*`: runtime history/constraint helpers. - `gui/preprocess_dialog.py`: окно последовательного захвата calibration/reference. ## 2. Mixin роли - `AppWindowUiMixin`: сборка виджетов и layout. - `AppWindowConfigMixin`: сборка `RunConfigModel`, live settings и лимиты устройства. - `AppWindowPipelineMixin`: старт/стоп процессов, polling ring readers, history lifecycle. - `AppWindowPlotMixin`: выбор режима отрисовки и рендер. - `AppWindowPreprocessMixin`: workflow для calibration/reference capture. - `AppWindowSnapshotMixin`: сохранение runtime snapshot. ## 3. Состояния AppWindow Ключевые поля состояния: - readers: `_raw_reader`, `_pre_reader`, `_result_reader` - history: `_raw_history`, `_pre_history`, `_result_history` - bscan cache: `_bscan_history_by_combo`, `_bscan_depth_axis_by_combo`, `_bscan_render_signature` - single capture flags: `_single_capture_*` - radar limits: `_radar_limits` ## 4. UI composition Секции строятся через builders в `gui/controllers/sections`: - `build_pipeline_group` - `build_hardware_actions_group` - `build_data_actions_group` - `build_preprocess_summary_group` - `build_processing_group` - `build_radar_group` - `build_switch_group` ## 5. Рекомендации по расширению GUI - Не добавлять тяжелую математику в mixin-файлы. - Для новых параметров processing mode: - добавить поле в live config, - добавить controls в `processing_section`, - добавить обработку в plotting/runtime helpers.