From 2dcd40cf6e28ce4d84214bf7d6cdc9663e13616d Mon Sep 17 00:00:00 2001 From: HONOR Date: Wed, 16 Sep 2026 13:42:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=8E=BB=E9=99=A4=E4=B8=8B=E6=8B=89?= =?UTF-8?q?=E6=A1=86=E9=80=89=E4=B8=AD=E6=97=B6=E7=9A=84=E8=93=9D=E8=89=B2?= =?UTF-8?q?=E9=AB=98=E4=BA=AE=EF=BC=8C=E6=94=AF=E6=8C=81=E6=9A=82=E5=81=9C?= =?UTF-8?q?=E6=97=B6=E5=86=BB=E7=BB=93=E8=AE=A1=E6=97=B6=EF=BC=8C=E5=B9=B6?= =?UTF-8?q?=E6=B3=A8=E5=85=A5=20rapidocr=20=E4=BE=9D=E8=B5=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ui/gui.py | 23 +++++++++++++++++++++-- tools/ocr_worker.py | 2 ++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/ui/gui.py b/src/ui/gui.py index 3510ec9..f97866a 100644 --- a/src/ui/gui.py +++ b/src/ui/gui.py @@ -102,6 +102,13 @@ class BatchTableExtractorApp: pass def _build_ui(self): + # 移除只读下拉框丑陋的蓝色背景高亮 + style = ttk.Style() + style.map('TCombobox', + fieldbackground=[('readonly', 'white')], + selectbackground=[('readonly', 'white')], + selectforeground=[('readonly', 'black')]) + frame = ttk.Frame(self.root, padding="15") frame.pack(fill=tk.BOTH, expand=True) @@ -288,14 +295,26 @@ class BatchTableExtractorApp: self.root.destroy() def _update_timer(self): - if getattr(self, '_is_running', False): + if not getattr(self, '_is_running', False): + return + + if self._pause_event.is_set(): + if not getattr(self, '_is_paused_now', False): + self._is_paused_now = True + self._pause_start = time.time() + else: + if getattr(self, '_is_paused_now', False): + self._is_paused_now = False + self._start_time += (time.time() - self._pause_start) + elapsed = time.time() - getattr(self, '_start_time', time.time()) hours, rem = divmod(elapsed, 3600) minutes, seconds = divmod(rem, 60) ms = int((elapsed - int(elapsed)) * 1000) time_str = f"{int(hours):02d}:{int(minutes):02d}:{int(seconds):02d}.{ms:03d}" self.lbl_timer.config(text=time_str) - self.root.after(50, self._update_timer) + + self.root.after(50, self._update_timer) def _start(self): self._save_config() diff --git a/tools/ocr_worker.py b/tools/ocr_worker.py index bbea6bf..16a13a4 100644 --- a/tools/ocr_worker.py +++ b/tools/ocr_worker.py @@ -2,6 +2,8 @@ import os import sys import argparse import fitz # PyMuPDF +import rapidocr_onnxruntime +sys.modules['rapidocr'] = rapidocr_onnxruntime from rapid_table import RapidTable import pandas as pd import numpy as np