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():
global _ocrengine, _nowuseocr
global _ocrengine, _nowuseocr, _nowuseocrx
with _initlock:
_nowuseocr = None
_nowuseocrx = None

View File

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

View File

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