让直播标定文件从传感器对话框进入打开链路。

对话框可选配置默认、原始力或浏览文件,并按配置条目写入 prefs;点运行时把 cal_path(Finger 含 device_id)交给 worker,采集中则热更新。对话框与打开链路单测通过。
This commit is contained in:
ykcheungab
2026-10-08 16:37:26 +08:00
parent 19ae1f4968
commit 3d2fb0c4eb
9 changed files with 1006 additions and 54 deletions
@@ -235,6 +235,9 @@ class FingerAcquisitionWorker(RecordSinkMixin):
self._end_reason: str | None = None
self._phase: str = "idle"
self._pending_calibration: str | None = None
#: Path and device serial for the **next** ``start()`` (live open kwargs).
self._session_cal_path: str | None = None
self._session_device_id: str | None = None
#: A zeroing requested from another thread, applied by this one.
self._pending_reset: bool = False
self._mono_t0: float = 0.0
@@ -305,6 +308,8 @@ class FingerAcquisitionWorker(RecordSinkMixin):
video_source: str | int,
*,
config_ref: str | Path,
cal_path: str | Path | None = None,
device_id: str | None = None,
) -> FixedCameraMode:
# Non-blocking: a previous session that is stuck opening must never hold
# the caller (the GUI thread) hostage.
@@ -317,6 +322,12 @@ class FingerAcquisitionWorker(RecordSinkMixin):
self._mode = mode
self._video_source = video_source
self._export_dir = resolve_finger_export_dir(config_ref)
self._session_cal_path = (
None if cal_path is None or not str(cal_path).strip() else str(cal_path)
)
self._session_device_id = (
None if device_id is None or not str(device_id).strip() else str(device_id)
)
with self._lock:
self._latest = None
self._end_reason = None
@@ -564,6 +575,12 @@ class FingerAcquisitionWorker(RecordSinkMixin):
}
if self._export_dir is not None:
open_kw["export_dir"] = str(self._export_dir)
if self._session_cal_path is not None:
# Same open path as the offline analysis pass: the operator's file,
# and the serial they confirmed when the file needs one.
open_kw["cal_path"] = self._session_cal_path
if self._session_device_id:
open_kw["device_id"] = self._session_device_id
runtime = FingerRuntime.open(**open_kw)
with self._lock:
self._runtimes[session] = runtime
@@ -730,6 +730,8 @@ class SdkAcquisitionWorker(RecordSinkMixin):
self._end_reason: str | None = None
self._phase: str = "idle"
self._pending_calibration: str | None = None
#: Path for the **next** ``start()`` (overrides the bundle default when set).
self._session_cal_path: str | None = None
#: A zeroing requested from another thread, applied by this one.
self._pending_reset: bool = False
#: Monotonic origin for ``SdkPacket.mono_t``, reset per session.
@@ -820,9 +822,12 @@ class SdkAcquisitionWorker(RecordSinkMixin):
video_source: str | int,
*,
config_ref: str | Path,
cal_path: str | Path | None = None,
device_id: str | None = None,
) -> FixedCameraMode:
# Non-blocking: a previous session that is stuck opening the device must
# never hold the caller (the GUI thread) hostage.
del device_id # box/mini open path has no Finger-style serial check
self.stop()
previous = self._thread
ok, detail = orisys_importable()
@@ -831,6 +836,9 @@ class SdkAcquisitionWorker(RecordSinkMixin):
mode = load_fixed_mode(config_ref)
self._mode = mode
self._video_source = video_source
self._session_cal_path = (
None if cal_path is None or not str(cal_path).strip() else str(cal_path)
)
with self._lock:
self._latest = None
self._end_reason = None
@@ -1087,12 +1095,14 @@ class SdkAcquisitionWorker(RecordSinkMixin):
is_file = _is_file_source(source)
try:
self._status(f"Opening Orisys Sensor ({mode.label()})…")
sensor = orisys.Sensor(
source,
config_name=mode.config_ref,
verbose=False,
backend="auto",
)
open_kw: dict = {
"config_name": mode.config_ref,
"verbose": False,
"backend": "auto",
}
if self._session_cal_path is not None:
open_kw["cal_path"] = self._session_cal_path
sensor = orisys.Sensor(source, **open_kw)
with self._lock:
self._sensors[session] = sensor
if self._stop.is_set() or session != self._session_id: