This commit is contained in:
恍兮惚兮 2024-07-20 02:48:19 +08:00
parent 2a8eee528f
commit a2ff34e0fe
2 changed files with 18 additions and 2 deletions

View File

@ -9,7 +9,7 @@ from myutils.utils import parsekeystringtomodvkcode, unsupportkey
from myutils.config import globalconfig, _TR, static_data, savehook_new_data
from myutils.subproc import subproc_w
from myutils.wrapper import threader, tryprint
from myutils.ocrutil import imageCut, ocr_run
from myutils.ocrutil import imageCut, ocr_run_2
from gui.rangeselect import rangeselct_function
from gui.usefulwidget import (
closeashidewindow,
@ -131,7 +131,7 @@ class AnkiWindow(QWidget):
@threader
def asyncocr(self, img):
self.__ocrsettext.emit(ocr_run(img))
self.__ocrsettext.emit(ocr_run_2(img))
def crop(self):
def ocroncefunction(rect):

View File

@ -129,3 +129,19 @@ def ocr_run(qimage: QImage):
msg = "<msg_error_refresh>" + _TR(globalconfig["ocr"][use]["name"]) + " " + msg
text = msg
return text
def ocr_run_2(qimage: QImage):
text = ocr_run(qimage)
msgs = [
"<notrans>",
"<msg_info_not_refresh>",
"<msg_info_refresh>",
"<msg_error_not_refresh>",
"<msg_error_refresh>",
]
for msg in msgs:
if text.startswith(msg):
return text[len(msg) :]
return text