修复UCD调用异常、保存结果按钮异常

This commit is contained in:
xinzhu.yin
2026-06-15 10:58:51 +08:00
parent c8ad244c45
commit dc096a9805
6 changed files with 65 additions and 15 deletions

View File

@@ -1087,12 +1087,7 @@ def _show_list_context_menu(self: "PQAutomationApp", event):
_switch_to_session(self, sid, show_message=False, refresh_list=False)
has_selection = self.ai_image_current is not None
ucd = getattr(self, "ucd", None)
can_send = (
has_selection
and ucd is not None
and getattr(ucd, "status", False)
)
can_send = has_selection and self.is_ucd_connected
try:
self.ai_image_menu.entryconfigure(
0, state=("normal" if can_send else "disabled")
@@ -1120,8 +1115,7 @@ def _send_to_ucd(self: "PQAutomationApp"):
if not os.path.isfile(rec.image_path):
messagebox.showerror("错误", f"图片文件不存在:\n{rec.image_path}")
return
ucd = getattr(self, "ucd", None)
if ucd is None or not getattr(ucd, "status", False):
if not self.is_ucd_connected:
messagebox.showwarning("警告", "请先连接 UCD323 设备")
return