refactor(gui): 抽左侧配置区(PanedWindow + 7 Tabs + load/save IO)到 components/left_config_area (389 → 348)
This commit is contained in:
1 parent
a06ece4e15
commit
089cb32e1c
2 files changed
+135
-57
No files matched your search
+16
-57
@@ -52,26 +52,19 @@ from gui.components.wifi_adb_one_click_scan import (
|
||||
from gui.components.logging_config_io import save_logging_config as _save_logging_config_impl
|
||||
from gui.components.run_params_builder import get_params as _get_params_impl
|
||||
from gui.components.config_io import (
|
||||
load_config_to_ui as _load_config_to_ui_impl,
|
||||
save_ui_to_config as _save_ui_to_config_impl,
|
||||
load_config_to_ui as _load_config_to_ui_impl, # noqa: F401 re-export
|
||||
save_ui_to_config as _save_ui_to_config_impl, # noqa: F401 re-export
|
||||
)
|
||||
from gui.components.debug_tab import setup_debug_tab
|
||||
from gui.components.logging_tab import setup_logging_tab
|
||||
from gui.components.yanghao_tab import setup_yanghao_tab
|
||||
from gui.components.reservation_tab import setup_reservation_tab
|
||||
from gui.components.run_tab import setup_run_tab
|
||||
from gui.components.filter_tab import setup_filter_tab
|
||||
from gui.components.realtime_tab import setup_realtime_tab
|
||||
from gui.components.win_record_tab import setup_win_record_tab
|
||||
from gui.components.simple_tabs import (
|
||||
setup_simple_text_tab,
|
||||
setup_simple_text_tab, # noqa: F401 re-export
|
||||
setup_stats_tab,
|
||||
setup_text_tab_with_refresh,
|
||||
setup_actions_log_tab,
|
||||
setup_ocr_results_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
|
||||
from gui.components.action_buttons import setup_action_buttons
|
||||
from gui.components.config_vars import build_config_vars
|
||||
@@ -80,6 +73,7 @@ from gui.components.top_buttons import setup_top_buttons
|
||||
from gui.components.log_tab import setup_log_tab
|
||||
from gui.components.log_pipeline import setup_log_pipeline
|
||||
from gui.components.root_window import setup_root_window
|
||||
from gui.components.left_config_area import setup_left_config_area
|
||||
from gui.components.periodic_refreshers import (
|
||||
setup_periodic_refreshers,
|
||||
setup_close_handler,
|
||||
@@ -171,53 +165,18 @@ def main():
|
||||
side=LEFT, padx=(0, 12)
|
||||
)
|
||||
|
||||
# 中部:左侧配置(使用Notebook标签页)+ 右侧日志/预览(支持拖拽调整宽度)
|
||||
mid = ttk.PanedWindow(root, orient="horizontal")
|
||||
mid.pack(fill=BOTH, expand=True, padx=12, pady=(0, 12))
|
||||
|
||||
left_wrap = ttk.Frame(mid)
|
||||
right = ttk.Frame(mid)
|
||||
mid.add(left_wrap, weight=0) # 左侧配置区域
|
||||
mid.add(right, weight=1) # 右侧日志/预览区域
|
||||
|
||||
# 左侧使用Notebook标签页组织配置
|
||||
left_notebook = ttk.Notebook(left_wrap)
|
||||
left_notebook.pack(fill=BOTH, expand=True)
|
||||
|
||||
# 创建左侧配置标签页
|
||||
setup_run_tab(left_notebook, vars_=_vars_)
|
||||
setup_filter_tab(left_notebook, vars_=_vars_)
|
||||
setup_reservation_tab(left_notebook, vars_=_vars_)
|
||||
_, yg_comment_texts, yg_like_keywords_text, yg_fav_keywords_text = setup_yanghao_tab(left_notebook, vars_=_vars_)
|
||||
setup_debug_tab(left_notebook, vars_=_vars_)
|
||||
setup_logging_tab(left_notebook, vars_=_vars_, on_save_logging=save_logging_config)
|
||||
want_text, not_want_text = setup_keywords_tab(left_notebook, ScrolledText_cls=ScrolledText)
|
||||
_config_io_texts = {
|
||||
"not_want_text": not_want_text,
|
||||
"want_text": want_text,
|
||||
"yg_comment_texts": yg_comment_texts,
|
||||
"yg_fav_keywords_text": yg_fav_keywords_text,
|
||||
"yg_like_keywords_text": yg_like_keywords_text,
|
||||
}
|
||||
|
||||
def load_config_to_ui():
|
||||
nonlocal cfg
|
||||
cfg = _load_config_to_ui_impl(
|
||||
vars_=_vars_,
|
||||
texts_=_config_io_texts,
|
||||
read_config=read_config,
|
||||
)
|
||||
|
||||
def save_ui_to_config():
|
||||
_save_ui_to_config_impl(
|
||||
vars_=_vars_,
|
||||
texts_=_config_io_texts,
|
||||
cfg=cfg,
|
||||
read_config=read_config,
|
||||
write_config=write_config,
|
||||
on_line=on_line,
|
||||
)
|
||||
load_config_to_ui()
|
||||
_left_area = setup_left_config_area(
|
||||
root,
|
||||
vars_=_vars_,
|
||||
cfg=cfg,
|
||||
ScrolledText_cls=ScrolledText,
|
||||
on_save_logging=save_logging_config,
|
||||
read_config=read_config,
|
||||
write_config=write_config,
|
||||
on_line=on_line,
|
||||
)
|
||||
right = _left_area.right_frame
|
||||
save_ui_to_config = _left_area.save_ui_to_config
|
||||
|
||||
# 右侧:操作按钮区域(先创建,放在底部)
|
||||
actions = ttk.Frame(right)
|
||||
|
||||
Reference in new issue
Block a user