refactor(gui): reservation/high_value 用 setup_text_tab_with_refresh 复用 (452 → 450)

This commit is contained in:
Your Name committed 2026-05-30 18:37:12 +08:00
1 parent f75d3ae368
commit a6648c5ce8
2 files changed
+33 -15

No files matched your search

+20
View File
@@ -66,3 +66,23 @@ def setup_stats_tab(
ttk.Button(stats_top, text="刷新", command=refresh_stats).pack(side=LEFT)
return refresh_stats
def setup_text_tab_with_refresh(
tab: tk.Misc,
*,
refresh_impl: Callable[[tk.Text], None],
ScrolledText_cls: Any,
) -> Callable[[], None]:
"""``setup_simple_text_tab`` + 一个绑定到刷新按钮的 ``refresh_impl(text)`` 回调。
用于 reservation / high_value / ocr_results 等"刷新按钮 → 把内容写入 text"的简单 Tab。
返回零参数的 ``refresh()`` 给调用方调度。
"""
top, text = setup_simple_text_tab(tab, ScrolledText_cls=ScrolledText_cls)
def refresh() -> None:
refresh_impl(text)
ttk.Button(top, text="刷新", command=refresh).pack(side=LEFT)
return refresh