feat: 添加滑动坐标配置功能,优化滑动操作的灵活性

This commit is contained in:
Your Name committed 2026-01-16 19:18:37 +08:00
1 parent 8d31e0ba1a
commit ca77862a86
9 files changed
+361 -58

No files matched your search

+52 -15
View File
@@ -508,6 +508,11 @@ def main():
swipe_duration_ms_var = tk.IntVar(
value=int(cfg.get("swipe_duration_ms", 600) or 600)
)
# 滑动坐标配置
swipe_up_start_y_var = tk.IntVar(
value=int(cfg.get("swipe_up_start_y", 1200) or 1200)
)
swipe_up_end_y_var = tk.IntVar(value=int(cfg.get("swipe_up_end_y", 600) or 600))
# 推荐页养号:爱心/收藏/评论(基于图标模板匹配 + 坐标点击)
yg_enabled_var = tk.BooleanVar(value=bool(cfg.get("yanghao_enabled", True)))
@@ -1470,21 +1475,6 @@ def main():
side=LEFT, padx=(6, 0)
)
row4f = ttk.Frame(fudai_find_box)
row4f.pack(fill=X, padx=10, pady=(0, 8))
ttk.Label(row4f, text="滑动速度(毫秒):").pack(side=LEFT)
ttk.Spinbox(
row4f,
from_=100,
to=2000,
increment=50,
textvariable=swipe_duration_ms_var,
width=6,
).pack(side=LEFT)
ttk.Label(row4f, text="(滑动持续时间,默认600ms,值越大滑动越慢)").pack(
side=LEFT, padx=(6, 0)
)
row4c = ttk.Frame(fudai_find_box)
row4c.pack(fill=X, padx=10, pady=(0, 10))
ttk.Label(row4c, text="直播间检测阈值(白色像素比例):").pack(side=LEFT)
@@ -1500,6 +1490,49 @@ def main():
row4c, text="(0.0~1.0,默认0.8,多边形区域白色像素比例>=此值判定为在直播间)"
).pack(side=LEFT, padx=(6, 0))
# 鼠标配置
mouse_config_box = ttk.LabelFrame(debug_container, text="鼠标配置")
mouse_config_box.pack(fill=X, padx=10, pady=(0, 10))
mouse_r1 = ttk.Frame(mouse_config_box)
mouse_r1.pack(fill=X, padx=10, pady=(10, 8))
ttk.Label(mouse_r1, text="滑动速度(毫秒):").pack(side=LEFT)
ttk.Spinbox(
mouse_r1,
from_=100,
to=2000,
increment=50,
textvariable=swipe_duration_ms_var,
width=6,
).pack(side=LEFT)
ttk.Label(mouse_r1, text="(滑动持续时间,默认600ms,值越大滑动越慢)").pack(
side=LEFT, padx=(6, 0)
)
mouse_r2 = ttk.Frame(mouse_config_box)
mouse_r2.pack(fill=X, padx=10, pady=(0, 10))
ttk.Label(mouse_r2, text="上滑起始Y坐标:").pack(side=LEFT)
ttk.Spinbox(
mouse_r2,
from_=400,
to=2000,
increment=50,
textvariable=swipe_up_start_y_var,
width=6,
).pack(side=LEFT)
ttk.Label(mouse_r2, text="结束Y坐标:").pack(side=LEFT, padx=(10, 0))
ttk.Spinbox(
mouse_r2,
from_=200,
to=1800,
increment=50,
textvariable=swipe_up_end_y_var,
width=6,
).pack(side=LEFT)
ttk.Label(mouse_r2, text="(基准1080x2400,默认1200→600,距离600px)").pack(
side=LEFT, padx=(6, 0)
)
# 阶段诊断时间参数(用于调试)
diag_time_box = ttk.LabelFrame(debug_container, text="阶段诊断时间参数")
diag_time_box.pack(fill=X, padx=10, pady=(0, 10))
@@ -1965,6 +1998,8 @@ def main():
float(cfg.get("live_room_match_threshold", 0.8) or 0.8)
)
swipe_duration_ms_var.set(int(cfg.get("swipe_duration_ms", 600) or 600))
swipe_up_start_y_var.set(int(cfg.get("swipe_up_start_y", 1200) or 1200))
swipe_up_end_y_var.set(int(cfg.get("swipe_up_end_y", 600) or 600))
fudai_quiet_hours_enabled_var.set(
bool(cfg.get("fudai_quiet_hours_enabled", True))
)
@@ -2258,6 +2293,8 @@ def main():
live_room_match_threshold_var.get() or 0.8
)
cfg2["swipe_duration_ms"] = int(swipe_duration_ms_var.get() or 600)
cfg2["swipe_up_start_y"] = int(swipe_up_start_y_var.get() or 1200)
cfg2["swipe_up_end_y"] = int(swipe_up_end_y_var.get() or 600)
cfg2["fudai_quiet_hours_enabled"] = bool(fudai_quiet_hours_enabled_var.get())
cfg2["fudai_quiet_start_hour"] = int(fudai_quiet_start_hour_var.get() or 0)
cfg2["fudai_quiet_end_hour"] = int(fudai_quiet_end_hour_var.get() or 0)