- Introduced new logging modules for action tracking, error logging, and performance tracking to improve observability. - Added functions for retrieving debug and error log paths in `path_config.py`. - Updated various components to utilize the new logging system, enhancing error handling and performance diagnostics. - Implemented a GUI component for viewing error logs, improving user experience in monitoring application issues. - Cleaned up unnecessary blank lines and improved code readability across multiple files.
53 lines
837 B
Python
53 lines
837 B
Python
"""OCR面板组件
|
|
|
|
包含OCR区域配置、截图OCR等功能的GUI组件。
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any, Callable
|
|
import tkinter as tk
|
|
from tkinter import ttk
|
|
|
|
|
|
def create_ocr_panel(
|
|
parent: Any,
|
|
device_var: tk.StringVar,
|
|
y_var: tk.IntVar,
|
|
on_line: Callable[[str], None],
|
|
) -> tuple[Any, Callable[[], None]]:
|
|
"""创建OCR面板组件。
|
|
|
|
参数:
|
|
parent: 父容器
|
|
device_var: 设备ID变量
|
|
y_var: Y偏移变量
|
|
on_line: 日志输出回调
|
|
|
|
返回:
|
|
(ocr_results_var, do_screenshot_func)
|
|
"""
|
|
ocr_results_var = {"results": []}
|
|
|
|
def do_screenshot() -> None:
|
|
"""执行截图和OCR识别。"""
|
|
# TODO: 从原文件迁移函数实现
|
|
pass
|
|
|
|
return ocr_results_var, do_screenshot
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|