新增功能
This commit is contained in:
@@ -72,7 +72,7 @@ WIN_TITLE = f"甄养堂 · 企微客服助手 v{APP_VERSION}"
|
||||
AUTO_REPLY_TEXT = "在的,您慢慢说,我这边看着呢。"
|
||||
POLL_INTERVAL = 2.0
|
||||
MOUSE_IDLE_ENABLED = True
|
||||
MOUSE_IDLE_SECONDS = 20.0
|
||||
MOUSE_IDLE_SECONDS = 5.0
|
||||
|
||||
# 暖白与医疗绿组成的浅色主题,保持长时间使用时的清晰度与舒适度。
|
||||
BG = "#F2F6F3"
|
||||
@@ -200,9 +200,13 @@ from gui_runtime import ( # noqa: F401 # 供旧代码与测试通过 wechat_gu
|
||||
MESSAGE_BATCH_WINDOW_MAX_SECONDS,
|
||||
MESSAGE_BATCH_WINDOW_MIN_SECONDS,
|
||||
MESSAGE_BATCH_WINDOW_SECONDS,
|
||||
SEND_DELAY_SECONDS,
|
||||
SEND_MODE_AUTO,
|
||||
BotThread,
|
||||
LogQueue,
|
||||
normalize_message_batch_window_seconds,
|
||||
normalize_send_delay_seconds,
|
||||
normalize_send_mode,
|
||||
)
|
||||
|
||||
|
||||
@@ -489,6 +493,8 @@ class App(tk.Tk):
|
||||
"poll_interval": POLL_INTERVAL,
|
||||
"mouse_idle_enabled": MOUSE_IDLE_ENABLED,
|
||||
"mouse_idle_seconds": MOUSE_IDLE_SECONDS,
|
||||
"send_delay_seconds": SEND_DELAY_SECONDS,
|
||||
"send_mode": SEND_MODE_AUTO,
|
||||
"message_batch_window_seconds": MESSAGE_BATCH_WINDOW_SECONDS,
|
||||
}
|
||||
|
||||
@@ -505,6 +511,12 @@ class App(tk.Tk):
|
||||
reply = str(saved.get("auto_reply_text", settings["auto_reply_text"])).strip()
|
||||
poll = float(saved.get("poll_interval", settings["poll_interval"]))
|
||||
idle = float(saved.get("mouse_idle_seconds", settings["mouse_idle_seconds"]))
|
||||
send_delay = normalize_send_delay_seconds(
|
||||
saved.get("send_delay_seconds", settings["send_delay_seconds"])
|
||||
)
|
||||
send_mode = normalize_send_mode(
|
||||
saved.get("send_mode", settings["send_mode"])
|
||||
)
|
||||
batch_window = normalize_message_batch_window_seconds(
|
||||
saved.get(
|
||||
"message_batch_window_seconds",
|
||||
@@ -520,6 +532,8 @@ class App(tk.Tk):
|
||||
saved.get("mouse_idle_enabled", settings["mouse_idle_enabled"])
|
||||
),
|
||||
"mouse_idle_seconds": idle,
|
||||
"send_delay_seconds": send_delay,
|
||||
"send_mode": send_mode,
|
||||
"message_batch_window_seconds": batch_window,
|
||||
})
|
||||
except (TypeError, ValueError):
|
||||
@@ -553,6 +567,18 @@ class App(tk.Tk):
|
||||
try:
|
||||
poll = float(self._poll_var.get().strip())
|
||||
idle = float(self._idle_seconds_var.get().strip())
|
||||
send_delay = normalize_send_delay_seconds(
|
||||
getattr(self, "_runtime_settings", {}).get(
|
||||
"send_delay_seconds",
|
||||
SEND_DELAY_SECONDS,
|
||||
)
|
||||
)
|
||||
send_mode = normalize_send_mode(
|
||||
getattr(self, "_runtime_settings", {}).get(
|
||||
"send_mode",
|
||||
SEND_MODE_AUTO,
|
||||
)
|
||||
)
|
||||
batch_window = float(self._batch_window_var.get().strip())
|
||||
if (
|
||||
poll <= 0
|
||||
@@ -575,6 +601,8 @@ class App(tk.Tk):
|
||||
"poll_interval": poll,
|
||||
"mouse_idle_enabled": bool(self._mouse_idle_var.get()),
|
||||
"mouse_idle_seconds": idle,
|
||||
"send_delay_seconds": send_delay,
|
||||
"send_mode": send_mode,
|
||||
"message_batch_window_seconds": batch_window,
|
||||
}
|
||||
if settings != self._last_runtime_settings:
|
||||
@@ -594,6 +622,8 @@ class App(tk.Tk):
|
||||
thread = getattr(self, "_thread", None)
|
||||
if thread is not None and thread.is_alive():
|
||||
thread.set_message_batch_window_seconds(batch_window)
|
||||
thread.set_send_delay_seconds(send_delay)
|
||||
thread.set_send_mode(send_mode)
|
||||
if not silent and hasattr(self, "_runtime_save_status"):
|
||||
self._runtime_save_status.configure(
|
||||
text=f"已自动保存 {time.strftime('%H:%M:%S')}",
|
||||
@@ -3806,6 +3836,12 @@ class App(tk.Tk):
|
||||
mouse_idle_enabled=self._mouse_idle_var.get(),
|
||||
mouse_idle_seconds=idle_seconds,
|
||||
message_batch_window_seconds=batch_window_seconds,
|
||||
send_delay_seconds=normalize_send_delay_seconds(
|
||||
self._runtime_settings.get("send_delay_seconds", SEND_DELAY_SECONDS)
|
||||
),
|
||||
send_mode=normalize_send_mode(
|
||||
self._runtime_settings.get("send_mode", SEND_MODE_AUTO)
|
||||
),
|
||||
)
|
||||
self._running = True
|
||||
self._start_time = time.time()
|
||||
|
||||
Reference in New Issue
Block a user