删除所有外部旧引用
This commit is contained in:
@@ -176,6 +176,49 @@ class SignalService:
|
||||
def current_resolution(self) -> tuple[int, int]:
|
||||
return self._dev.current_resolution()
|
||||
|
||||
@property
|
||||
def is_connected(self) -> bool:
|
||||
"""UCD 设备是否已打开。供 GUI 做前置校验。"""
|
||||
ctrl = getattr(self._dev, "raw_controller", None)
|
||||
return bool(ctrl and getattr(ctrl, "status", False))
|
||||
|
||||
# -- 过渡期 API(Phase 5):config 驱动的写入 -----------------
|
||||
# 现有 GUI / Service 通过 ``PQConfig`` 对象描述当次测试参数,
|
||||
# 由 :class:`UCDController.set_ucd_params` 翻译为色彩/Timing/Pattern。
|
||||
# 在配置层重构落地前,这两个方法作为 SignalService 的统一入口,
|
||||
# 让上层不再直接接触 ``self.app.ucd``。
|
||||
|
||||
def apply_config(self, config) -> bool:
|
||||
"""按 :class:`PQConfig` 写入色彩 / Timing / 当前 Pattern(不 apply 输出)。"""
|
||||
ctrl = getattr(self._dev, "raw_controller", None)
|
||||
if ctrl is None:
|
||||
raise UcdError("apply_config 暂仅支持 UCD323Device")
|
||||
with self._lock:
|
||||
return bool(ctrl.set_ucd_params(config))
|
||||
|
||||
def send_pattern_params(self, params) -> bool:
|
||||
"""以 ``params`` 更新当前 pattern 的参数并 apply。"""
|
||||
ctrl = getattr(self._dev, "raw_controller", None)
|
||||
if ctrl is None:
|
||||
raise UcdError("send_pattern_params 暂仅支持 UCD323Device")
|
||||
with self._lock:
|
||||
return bool(ctrl.send_current_pattern_params(params))
|
||||
|
||||
def apply_and_run(self, config, pattern_params) -> bool:
|
||||
"""``set_ucd_params`` + ``set_pattern`` + ``run`` 的复合操作。
|
||||
|
||||
服务于 custom_template_panel 单步流程。
|
||||
"""
|
||||
ctrl = getattr(self._dev, "raw_controller", None)
|
||||
if ctrl is None:
|
||||
raise UcdError("apply_and_run 暂仅支持 UCD323Device")
|
||||
with self._lock:
|
||||
if not ctrl.set_ucd_params(config):
|
||||
return False
|
||||
if not ctrl.set_pattern(ctrl.current_pattern, pattern_params):
|
||||
return False
|
||||
return bool(ctrl.run())
|
||||
|
||||
|
||||
__all__ = [
|
||||
"SignalService",
|
||||
|
||||
Reference in New Issue
Block a user