refactor(gui): 抽右侧主 Notebook + 实时工具栏到 components/main_notebook (1444 → 1417)
This commit is contained in:
1 parent
3a7a7a3b75
commit
e314161b6c
2 files changed
+129
-46
No files matched your search
+19
-46
@@ -101,6 +101,7 @@ from gui.components.actions_log_toolbar import setup_actions_log_toolbar
|
||||
from gui.components.simple_tabs import setup_simple_text_tab
|
||||
from gui.components.preview_tab import setup_preview_tab
|
||||
from gui.components.keywords_tab import setup_keywords_tab
|
||||
from gui.components.main_notebook import setup_main_notebook
|
||||
|
||||
# 导入日志颜色配置模块
|
||||
try:
|
||||
@@ -1095,57 +1096,29 @@ def main():
|
||||
actions = ttk.Frame(right)
|
||||
|
||||
# 右侧:Notebook(日志 / 截图预览 / 统计信息 / 预约队列 / 高价值房间)
|
||||
notebook = ttk.Notebook(right)
|
||||
|
||||
# 实时状态工具栏(固定在 Notebook 上方,始终可见)
|
||||
show_actions_var = tk.BooleanVar(value=True)
|
||||
show_screenshot_var = tk.BooleanVar(value=False)
|
||||
auto_scroll_var = tk.BooleanVar(value=True)
|
||||
|
||||
realtime_tools = ttk.Frame(right)
|
||||
realtime_tools.pack(fill=X, padx=8, pady=(4, 0))
|
||||
ttk.Checkbutton(realtime_tools, text="显示动作流", variable=show_actions_var).pack(
|
||||
side=LEFT, padx=(0, 8)
|
||||
)
|
||||
ttk.Checkbutton(realtime_tools, text="显示截图", variable=show_screenshot_var).pack(
|
||||
side=LEFT, padx=(0, 8)
|
||||
)
|
||||
ttk.Checkbutton(realtime_tools, text="自动滚动", variable=auto_scroll_var).pack(
|
||||
side=LEFT, padx=(0, 8)
|
||||
)
|
||||
# forward-declare handler to satisfy linters; real function defined later
|
||||
_open_realtime_viewer_impl = None
|
||||
|
||||
realtime_view_btn = ttk.Button(
|
||||
realtime_tools,
|
||||
text="实时查看",
|
||||
width=10,
|
||||
command=lambda: (
|
||||
_main_nb = setup_main_notebook(
|
||||
right,
|
||||
on_open_realtime_viewer=lambda: (
|
||||
_open_realtime_viewer_impl()
|
||||
if callable(_open_realtime_viewer_impl)
|
||||
else None
|
||||
),
|
||||
)
|
||||
realtime_view_btn.pack(side=LEFT, padx=(8, 0))
|
||||
|
||||
log_tab = ttk.Frame(notebook)
|
||||
preview_tab = ttk.Frame(notebook)
|
||||
stats_tab = ttk.Frame(notebook)
|
||||
reservation_tab = ttk.Frame(notebook)
|
||||
high_value_tab = ttk.Frame(notebook)
|
||||
actions_log_tab = ttk.Frame(notebook)
|
||||
realtime_tab = ttk.Frame(notebook)
|
||||
ocr_results_tab = ttk.Frame(notebook)
|
||||
win_record_tab = ttk.Frame(notebook)
|
||||
notebook.add(log_tab, text="运行日志")
|
||||
notebook.add(preview_tab, text="截图预览")
|
||||
notebook.add(stats_tab, text="统计信息")
|
||||
notebook.add(reservation_tab, text="预约队列")
|
||||
notebook.add(high_value_tab, text="高价值房间")
|
||||
notebook.add(actions_log_tab, text="行为日志")
|
||||
notebook.add(realtime_tab, text="实时状态")
|
||||
notebook.add(ocr_results_tab, text="OCR结果")
|
||||
notebook.add(win_record_tab, text="中奖记录")
|
||||
notebook = _main_nb.notebook
|
||||
log_tab = _main_nb.log_tab
|
||||
preview_tab = _main_nb.preview_tab
|
||||
stats_tab = _main_nb.stats_tab
|
||||
reservation_tab = _main_nb.reservation_tab
|
||||
high_value_tab = _main_nb.high_value_tab
|
||||
actions_log_tab = _main_nb.actions_log_tab
|
||||
realtime_tab = _main_nb.realtime_tab
|
||||
ocr_results_tab = _main_nb.ocr_results_tab
|
||||
win_record_tab = _main_nb.win_record_tab
|
||||
show_actions_var = _main_nb.show_actions_var
|
||||
show_screenshot_var = _main_nb.show_screenshot_var
|
||||
auto_scroll_var = _main_nb.auto_scroll_var
|
||||
# forward-declare handler to satisfy linters; real function defined later
|
||||
_open_realtime_viewer_impl = None
|
||||
# 使用模块化组件创建映射表并加入 Notebook
|
||||
mapping_tab = create_mapping_tab(root, notebook, cfg)
|
||||
notebook.add(mapping_tab, text="映射表")
|
||||
|
||||
Reference in new issue
Block a user