refactor: 移除提取页码选项,并将 ocr_worker 源码移动至独立 tools 目录

This commit is contained in:
HONOR
2026-09-16 12:58:49 +08:00
parent c59153253c
commit ebfc197c31
+2 -11
View File
@@ -42,7 +42,6 @@ class BatchTableExtractorApp:
self.topmost_var = tk.BooleanVar(value=False) self.topmost_var = tk.BooleanVar(value=False)
self.conflict_action_var = tk.StringVar(value="直接覆盖 (默认)") self.conflict_action_var = tk.StringVar(value="直接覆盖 (默认)")
self.pdf_pages_var = tk.StringVar(value="")
self.pdf_engine_var = tk.StringVar(value="智能判定 (推荐)") self.pdf_engine_var = tk.StringVar(value="智能判定 (推荐)")
import threading import threading
@@ -78,7 +77,6 @@ class BatchTableExtractorApp:
self.debug_var.set(cfg.get("debug_mode", False)) self.debug_var.set(cfg.get("debug_mode", False))
self.topmost_var.set(cfg.get("topmost", False)) self.topmost_var.set(cfg.get("topmost", False))
self.conflict_action_var.set(cfg.get("conflict_action", "直接覆盖 (默认)")) self.conflict_action_var.set(cfg.get("conflict_action", "直接覆盖 (默认)"))
self.pdf_pages_var.set(cfg.get("pdf_pages", ""))
self.pdf_engine_var.set(cfg.get("pdf_engine", "智能判定 (推荐)")) self.pdf_engine_var.set(cfg.get("pdf_engine", "智能判定 (推荐)"))
except Exception: except Exception:
pass pass
@@ -94,7 +92,6 @@ class BatchTableExtractorApp:
"debug_mode": self.debug_var.get(), "debug_mode": self.debug_var.get(),
"topmost": self.topmost_var.get(), "topmost": self.topmost_var.get(),
"conflict_action": self.conflict_action_var.get(), "conflict_action": self.conflict_action_var.get(),
"pdf_pages": self.pdf_pages_var.get(),
"pdf_engine": self.pdf_engine_var.get() "pdf_engine": self.pdf_engine_var.get()
} }
try: try:
@@ -157,12 +154,7 @@ class BatchTableExtractorApp:
pdf_frame = ttk.Frame(path_box) pdf_frame = ttk.Frame(path_box)
pdf_frame.grid(row=3, column=1, sticky=tk.EW, padx=6) pdf_frame.grid(row=3, column=1, sticky=tk.EW, padx=6)
ttk.Combobox(pdf_frame, textvariable=self.pdf_engine_var, values=["智能判定 (推荐)", "强转 Word (极速)", "强制本地 AI (需插件)"], state="readonly", width=30).pack(side=tk.LEFT, fill=tk.X, expand=True) ttk.Combobox(pdf_frame, textvariable=self.pdf_engine_var, values=["智能判定 (推荐)", "强转 Word (极速)", "强制本地 AI (需插件)"], state="readonly", width=43).pack(side=tk.LEFT, fill=tk.X, expand=True)
ttk.Label(pdf_frame, text=" 提取页码: ").pack(side=tk.LEFT)
self.entry_pdf_pages = ttk.Entry(pdf_frame, textvariable=self.pdf_pages_var, width=12)
self.entry_pdf_pages.pack(side=tk.LEFT)
self.entry_pdf_pages.insert(0, "")
# 移除云端OCR设置按钮,由空白标签占位,保持原有的列宽比例 # 移除云端OCR设置按钮,由空白标签占位,保持原有的列宽比例
ttk.Label(path_box, text="", width=9).grid(row=3, column=2) ttk.Label(path_box, text="", width=9).grid(row=3, column=2)
@@ -464,8 +456,7 @@ class BatchTableExtractorApp:
log_func=my_log, debug=debug_mode) log_func=my_log, debug=debug_mode)
else: else:
from core.extractor import export_pdf_image_tables_local from core.extractor import export_pdf_image_tables_local
pages_str = self.pdf_pages_var.get().strip() tc = export_pdf_image_tables_local(excel_app, file_path, target_excel, "",
tc = export_pdf_image_tables_local(excel_app, file_path, target_excel, pages_str,
log_func=my_log, debug=debug_mode) log_func=my_log, debug=debug_mode)
duration = time.time() - t0 duration = time.time() - t0