some refactoring and socket server added

This commit is contained in:
Ayzen
2026-04-08 18:43:29 +03:00
parent 202993325d
commit 1d7d0a756e
25 changed files with 3093 additions and 2527 deletions
@@ -9,6 +9,7 @@ from python_app.gui.runtime.history import build_run_history_signature, record_r
from python_app.hardware_full.librevna_service import LibreVnaService
from python_app.models.dataset_model import ComboKey, ResultCollection, SweepCollection
from python_app.models.run_config_model import RunConfigModel
from python_app.orchestration.gpr_locator import collection_has_gpr_payloads
from python_app.orchestration.preprocess_assets import (
PREPROCESS_ASSET_SPECS,
REQUIRED_PREPROCESS_ASSET_KEYS,
@@ -260,6 +261,7 @@ class AppWindowPipelineMixin:
self._log_error(report.format())
try:
self._drain_locator_speed_updates()
if self._raw_reader is not None:
self._read_all_raw()
self._read_all_preprocessed()
@@ -353,6 +355,11 @@ class AppWindowPipelineMixin:
break
if record_result_history(self._result_history, collection):
latest = collection
if (
self._processing_mode.currentText() == "gpr"
and collection_has_gpr_payloads(collection)
):
self._publish_locator_snapshot_from_collection(collection)
return latest
def _drain_rings_once_for_history(self) -> None:
@@ -452,3 +459,35 @@ class AppWindowPipelineMixin:
config,
self._live_processing_config(),
)
def _drain_locator_speed_updates(self) -> None:
"""Apply queued speed updates received by the embedded locator server."""
latest_speed = self._locator_service.drain_speed_updates()
if latest_speed is None:
return
self._apply_external_gpr_speed_update(0.0) # TODO: remove temporary stub and apply real locator client speed.
def _publish_locator_snapshot_from_collection(self, collection: ResultCollection) -> None:
"""Publish one locator snapshot from a GPR result collection."""
self._locator_service.publish_collection(
collection,
float(self._gpr_min_visible_pair_count.value()),
visible_bounds=self._gpr_visible_object_bounds(),
)
def _publish_locator_snapshot_from_latest_result(self) -> None:
"""Publish current locator-visible snapshot from latest cached GPR result."""
if self._processing_mode.currentText() != "gpr":
self._locator_service.publish_empty()
return
if not self._result_history:
self._locator_service.publish_empty()
return
latest = self._result_history[-1]
if not collection_has_gpr_payloads(latest):
self._locator_service.publish_empty()
return
self._publish_locator_snapshot_from_collection(latest)