fix: 剪贴板hash去重 + 双击ESC急停 + 截图日志完善
1. 剪贴板hash去重: _read_via_clipboard_once计算md5(content), 同平台内容未变则跳过,防止QQ读到微信遗留的过时剪贴板数据 答非所问(跨平台stale数据)问题修复 2. 双击ESC急停: _esc_check_loop daemon线程每150ms轮询ESC键, 两次ESC间隔<500ms触发_emergency_stop: 设置_running=False、 杀死EasyOCR子进程、清空发送锁、回调GUI更新状态、 用户可点击开关重新启动。急停后不退出程序。 3. 截图日志完善: - 日志打印完整路径(用户可直接定位) - 统一keep=60(QQ+微信共享清理池,双平台不互删) - 移除微信冗余二次保存(wechat_ocr_*重复save) - 修复silent except→打出save失败日志
This commit is contained in:
@@ -43,6 +43,7 @@ class MsgBotApp(ctk.CTk):
|
||||
wechat=self.cfg.get("wechat_enabled", True),
|
||||
qq=self.cfg.get("qq_enabled", False),
|
||||
)
|
||||
self.monitor.set_emergency_callback(self._on_emergency_stop)
|
||||
|
||||
# 自动回复
|
||||
self.ar = AutoReply(self.monitor)
|
||||
@@ -392,6 +393,21 @@ class MsgBotApp(ctk.CTk):
|
||||
self._log_text.delete("1.0", "end")
|
||||
self._log_text.configure(state="disabled")
|
||||
|
||||
# ── 急停回调 ──
|
||||
|
||||
def _on_emergency_stop(self):
|
||||
"""双击 ESC 急停的回调(从 daemon 线程调用,日志队列安全)。"""
|
||||
self._log_queue.put("⚠️⚠️⚠️ 双击ESC急停!消息监控已强制终止")
|
||||
# 安全更新 toggle 状态(主线程 after 调度)
|
||||
self.after(0, self._update_stop_ui)
|
||||
|
||||
def _update_stop_ui(self):
|
||||
"""主线程更新急停后的 UI。"""
|
||||
self.monitor.stop()
|
||||
self._toggle_btn.deselect()
|
||||
self._status_label.configure(text="⏸ 急停")
|
||||
self._log_queue.put("🔄 可点击「启用监控」重新启动")
|
||||
|
||||
# ── 窗口关闭 ──
|
||||
|
||||
def _on_close(self):
|
||||
|
||||
Reference in New Issue
Block a user