This commit is contained in:
恍兮惚兮 2024-08-15 00:53:33 +08:00
parent 2fdd5621ec
commit 668bbb8ea6
3 changed files with 5 additions and 9 deletions

View File

@ -87,7 +87,7 @@ _initlock = threading.Lock()
def ocr_end(): def ocr_end():
global _ocrengine, _nowuseocr global _ocrengine, _nowuseocr, _nowuseocrx
with _initlock: with _initlock:
_nowuseocr = None _nowuseocr = None
_nowuseocrx = None _nowuseocrx = None

View File

@ -1,11 +1,10 @@
import time, os import time, os, threading
from myutils.config import globalconfig from myutils.config import globalconfig
import winsharedutils, windows import winsharedutils, windows
from gui.rangeselect import rangeadjust from gui.rangeselect import rangeadjust
from myutils.ocrutil import imageCut, ocr_run, ocr_end, ocr_init from myutils.ocrutil import imageCut, ocr_run, ocr_init
import time, gobject import time, gobject
from qtsymbols import * from qtsymbols import *
from traceback import print_exc
from collections import Counter from collections import Counter
from textsource.textsourcebase import basetext from textsource.textsourcebase import basetext
@ -36,10 +35,7 @@ def compareImage(img1: QImage, img2):
class ocrtext(basetext): class ocrtext(basetext):
def __init__(self): def __init__(self):
try: threading.Thread(target=ocr_init).start()
ocr_init()
except:
print_exc()
self.screen = QApplication.primaryScreen() self.screen = QApplication.primaryScreen()
self.savelastimg = [] self.savelastimg = []
self.savelastrecimg = [] self.savelastrecimg = []
@ -205,4 +201,3 @@ class ocrtext(basetext):
globalconfig["ocrregions"] = [_.getrect() for _ in self.range_ui] globalconfig["ocrregions"] = [_.getrect() for _ in self.range_ui]
[_.closesignal.emit() for _ in self.range_ui] [_.closesignal.emit() for _ in self.range_ui]
super().end() super().end()
ocr_end()

View File

@ -137,6 +137,7 @@ class basetext:
return None return None
def end(self): def end(self):
self.hwnd = None
self.ending = True self.ending = True
################## ##################