迁移 GUI 调用点
This commit is contained in:
@@ -125,6 +125,48 @@ class SignalService:
|
||||
def send_image(self, path: str) -> None:
|
||||
self.send_pattern(image_pattern(path))
|
||||
|
||||
# -- 过渡期 API(Phase 2)-----------------------------------
|
||||
# 现有 GUI 回调以"仅更新信号格式、不切换图案"的方式调用
|
||||
# ``ucd.apply_signal_format(color_space=..., color_format=..., bit_depth=...)``。
|
||||
# 新代码统一通过本方法走 SignalService;内部仍委托给底层
|
||||
# controller 的同名旧接口,迁移完成后将替换为纯净实现。
|
||||
|
||||
def update_signal_format(
|
||||
self,
|
||||
*,
|
||||
color_space: str,
|
||||
output_format: str,
|
||||
bit_depth: str,
|
||||
data_range: str = "Full",
|
||||
max_cll: int | None = None,
|
||||
max_fall: int | None = None,
|
||||
) -> bool:
|
||||
"""仅将信号格式 stage 到 SDK(沿用上一次的 timing),不切换图案。
|
||||
|
||||
UI 字符串先经域层解析做参数校验;解析失败抛 :class:`UcdConfigError`。
|
||||
"""
|
||||
# 解析仅做校验;当前实现走 raw controller 的旧 API
|
||||
_ = build_signal_format(
|
||||
color_space=color_space,
|
||||
output_format=output_format,
|
||||
bit_depth=bit_depth,
|
||||
data_range=data_range,
|
||||
)
|
||||
ctrl = getattr(self._dev, "raw_controller", None)
|
||||
if ctrl is None:
|
||||
raise UcdError("update_signal_format 暂仅支持 UCD323Device")
|
||||
with self._lock:
|
||||
return bool(
|
||||
ctrl.apply_signal_format(
|
||||
color_space=color_space,
|
||||
color_format=output_format,
|
||||
bit_depth=bit_depth,
|
||||
data_range=data_range,
|
||||
max_cll=max_cll,
|
||||
max_fall=max_fall,
|
||||
)
|
||||
)
|
||||
|
||||
# -- 透传给上层的查询 ---------------------------------------
|
||||
|
||||
@property
|
||||
|
||||
Reference in New Issue
Block a user