fix dashboard mapping auto refresh

This commit is contained in:
Your Name committed 2026-06-23 01:47:39 +08:00
1 parent 8389f85124
commit e286cd46c8
1 file changed
+23 -3
+23 -3
View File
@@ -269,15 +269,35 @@ def build_wins(parent: tk.Misc, data: DashboardData, ctx: PageContext) -> None:
preview_panel(body, data.win_images[0] if data.win_images else None, "截图预览").grid(row=0, column=1, sticky="nsew", padx=(8, 0))
def _schedule_mapping_refresh(widget: tk.Misc, ctx: PageContext, interval_ms: int = 5000) -> None:
def tick() -> None:
try:
if not widget.winfo_exists():
return
except Exception:
return
refresh = ctx.action("refresh")
if refresh:
refresh()
try:
widget.after(interval_ms, tick)
except Exception:
pass
def build_mapping(parent: tk.Misc, data: DashboardData, ctx: PageContext) -> None:
section(parent, "映射表", "显示原始标题 / 刷新映射表 / 搜索 / 复制条目")
toolbar(parent, [("自动刷新(5s)", None, "soft"), ("刷新映射表", ctx.action("refresh"), "soft"), "显示原始标题", "清除", "复制条目"])
table_panel(parent, "运行时映射表", (
refresh = ctx.action("refresh")
toolbar(parent, [("自动刷新(5s)", refresh, "soft"), ("刷新映射表", refresh, "soft"), "显示原始标题", "清除", "复制条目"])
mapping_table = table_panel(parent, "运行时映射表", (
("pos", "位置", 70), ("title", "标题", 230), ("raw_title", "原始标题", 250),
("reserved", "预约", 64), ("has_fudai", "福袋", 64), ("value", "价值", 90),
("countdown", "倒计时", 90), ("participants", "人数", 74), ("copies", "份数", 70),
("button", "按钮", 120), ("task", "任务", 180), ("content", "内容", 220), ("updated", "更新时间", 160),
), data.mapping_rows, height=22).pack(fill="both", expand=True)
), data.mapping_rows, height=22)
mapping_table.pack(fill="both", expand=True)
_schedule_mapping_refresh(mapping_table, ctx)
def build_wifi_adb(parent: tk.Misc, data: DashboardData, ctx: PageContext) -> None: