diff --git a/LunaTranslator/LunaTranslator/gui/showword.py b/LunaTranslator/LunaTranslator/gui/showword.py index 5f5b8627..22699794 100644 --- a/LunaTranslator/LunaTranslator/gui/showword.py +++ b/LunaTranslator/LunaTranslator/gui/showword.py @@ -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): diff --git a/LunaTranslator/LunaTranslator/myutils/ocrutil.py b/LunaTranslator/LunaTranslator/myutils/ocrutil.py index cf0189ec..2576cb8b 100644 --- a/LunaTranslator/LunaTranslator/myutils/ocrutil.py +++ b/LunaTranslator/LunaTranslator/myutils/ocrutil.py @@ -129,3 +129,19 @@ def ocr_run(qimage: QImage): msg = "" + _TR(globalconfig["ocr"][use]["name"]) + " " + msg text = msg return text + + +def ocr_run_2(qimage: QImage): + text = ocr_run(qimage) + + msgs = [ + "", + "", + "", + "", + "", + ] + for msg in msgs: + if text.startswith(msg): + return text[len(msg) :] + return text