- Removed trailing whitespace and ensured files end with a single newline in cleanup_unused_files.py. - Added fix_trailing_whitespace.py to batch remove trailing whitespace from Python files. - Updated install_dependencies.py to improve dependency installation prompts. - Cleaned up pick_coords.py by removing unnecessary whitespace and improving code readability. - Enhanced region_selector.py by disabling specific pylint checks for better compatibility with third-party libraries. - Improved WPS流程图生成工具.py by cleaning up whitespace and enhancing readability. - Updated __init__.py in typings to remove unnecessary lines. - Modified app.js to adjust default configuration values and clean up unused code.
38 lines
818 B
Python
38 lines
818 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
|