feat: Implement 30-minute timeout protection and unify path configurations
- Introduced a 30-minute timeout mechanism to prevent the script from getting stuck in invalid states, with configurable timeout settings. - Unified path configurations across the project to enhance maintainability and avoid hardcoded paths. - Updated documentation and flowcharts to reflect the new timeout feature and improved path management. - Fixed issues with template and screenshot path configurations to ensure consistency across the project.
This commit is contained in:
1 parent
686dde5cc0
commit
26df350755
64 files changed
+7568
-414
No files matched your search
@@ -0,0 +1,58 @@
|
||||
"""设备选择组件
|
||||
|
||||
包含设备选择、刷新设备等功能的GUI组件。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Callable
|
||||
import tkinter as tk
|
||||
from tkinter import ttk
|
||||
|
||||
from gui.gui_core import find_adb_executable, list_adb_devices
|
||||
|
||||
|
||||
def create_device_selector(
|
||||
parent: Any,
|
||||
on_line: Callable[[str], None],
|
||||
device_var: tk.StringVar,
|
||||
) -> tuple[ttk.Combobox, Callable[[], None]]:
|
||||
"""创建设备选择组件。
|
||||
|
||||
参数:
|
||||
parent: 父容器
|
||||
on_line: 日志输出回调
|
||||
device_var: 设备ID变量
|
||||
|
||||
返回:
|
||||
(device_combo, refresh_devices_func) 设备下拉框和刷新函数
|
||||
"""
|
||||
adb_exe = find_adb_executable()
|
||||
devices = list_adb_devices(adb_exe)
|
||||
device_var.set(devices[0] if devices else "")
|
||||
|
||||
ttk.Label(parent, text="设备:").pack(side="left")
|
||||
device_combo = ttk.Combobox(parent, textvariable=device_var, values=devices, width=28)
|
||||
device_combo.pack(side="left", padx=(0, 10))
|
||||
|
||||
def refresh_devices():
|
||||
nonlocal adb_exe
|
||||
adb_exe = find_adb_executable()
|
||||
devs = list_adb_devices(adb_exe)
|
||||
device_combo["values"] = devs
|
||||
if devs and not device_var.get():
|
||||
device_var.set(devs[0])
|
||||
if not adb_exe:
|
||||
on_line("[设备] 未找到 adb.exe(请确认已安装 platform-tools)")
|
||||
elif not devs:
|
||||
on_line("[设备] adb 可用,但未发现 device 状态设备(可能未授权/未连接)")
|
||||
|
||||
ttk.Button(parent, text="刷新设备", command=refresh_devices).pack(
|
||||
side="left", padx=(0, 20)
|
||||
)
|
||||
|
||||
return device_combo, refresh_devices
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user