refactor(gui): save_logging_config 内置到 left_config_area (169 → 159)
This commit is contained in:
1 parent
95459607dc
commit
e9b003f906
2 files changed
+12
-14
No files matched your search
@@ -4,10 +4,10 @@
|
||||
- ``ttk.PanedWindow`` (左/右分栏)
|
||||
- 左侧 ``ttk.Notebook`` 容器
|
||||
- 7 个配置 Tab(运行/筛选/高价值预约/养号/调试/日志/关键词)
|
||||
- ``load_config_to_ui`` / ``save_ui_to_config`` 闭包
|
||||
- ``load_config_to_ui`` / ``save_ui_to_config`` / ``save_logging_config`` 闭包
|
||||
- 启动时一次 ``load_config_to_ui()``
|
||||
|
||||
返回 ``LeftNotebookHandles`` 暴露给 ``main()`` 的引用:
|
||||
返回 ``LeftConfigArea`` 暴露给 ``main()`` 的引用:
|
||||
- ``right_frame``: 右侧分栏(传给后续 setup_main_notebook)
|
||||
- ``save_ui_to_config``: 保存配置回调
|
||||
"""
|
||||
@@ -24,6 +24,7 @@ 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,
|
||||
)
|
||||
from gui.components.logging_config_io import save_logging_config as _save_logging_config_impl
|
||||
from gui.components.run_tab import setup_run_tab
|
||||
from gui.components.filter_tab import setup_filter_tab
|
||||
from gui.components.reservation_tab import setup_reservation_tab
|
||||
@@ -47,7 +48,6 @@ def setup_left_config_area(
|
||||
vars_: Dict[str, tk.Variable],
|
||||
cfg: dict,
|
||||
ScrolledText_cls: Any,
|
||||
on_save_logging: Callable[[], None],
|
||||
read_config: Callable[[], dict],
|
||||
write_config: Callable[[dict], None],
|
||||
on_line: Callable[[str], None],
|
||||
@@ -70,6 +70,14 @@ def setup_left_config_area(
|
||||
left_notebook = ttk.Notebook(left_wrap)
|
||||
left_notebook.pack(fill=BOTH, expand=True)
|
||||
|
||||
def save_logging_config() -> None:
|
||||
_save_logging_config_impl(
|
||||
vars_=vars_,
|
||||
read_config=read_config,
|
||||
write_config=write_config,
|
||||
on_line=on_line,
|
||||
)
|
||||
|
||||
# 创建左侧配置标签页
|
||||
setup_run_tab(left_notebook, vars_=vars_)
|
||||
setup_filter_tab(left_notebook, vars_=vars_)
|
||||
@@ -78,7 +86,7 @@ def setup_left_config_area(
|
||||
left_notebook, vars_=vars_,
|
||||
)
|
||||
setup_debug_tab(left_notebook, vars_=vars_)
|
||||
setup_logging_tab(left_notebook, vars_=vars_, on_save_logging=on_save_logging)
|
||||
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_cls,
|
||||
)
|
||||
|
||||
@@ -19,7 +19,6 @@ from gui.components.wifi_adb_scan_dialog import open_scan_dialog # noqa: F401
|
||||
from gui.components.preview_view import (
|
||||
async_refresh_preview as _async_refresh_preview_impl,
|
||||
)
|
||||
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, # noqa: F401 re-export
|
||||
@@ -75,14 +74,6 @@ def main():
|
||||
device_var = _top_bar.device_var
|
||||
refresh_devices = _top_bar.refresh_devices
|
||||
|
||||
def save_logging_config():
|
||||
_save_logging_config_impl(
|
||||
vars_=_vars_,
|
||||
read_config=read_config,
|
||||
write_config=write_config,
|
||||
on_line=on_line,
|
||||
)
|
||||
|
||||
# 配置区(提前读取配置,供后续使用)
|
||||
cfg = read_config()
|
||||
|
||||
@@ -101,7 +92,6 @@ def main():
|
||||
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,
|
||||
|
||||
Reference in new issue
Block a user