issues/819

This commit is contained in:
恍兮惚兮 2024-06-15 00:40:23 +08:00
parent 03b452b419
commit 2fc2fb7698
3 changed files with 7 additions and 6 deletions

View File

@ -114,7 +114,7 @@ class rangeadjust(Mainw):
class rangeselct(QMainWindow): class rangeselct(QMainWindow):
def __init__(self, parent): def __init__(self, parent=None):
super(rangeselct, self).__init__(parent) super(rangeselct, self).__init__(parent)
self.setWindowFlags( self.setWindowFlags(
@ -225,10 +225,11 @@ class rangeselct(QMainWindow):
screen_shot_ui = None screen_shot_ui = None
def rangeselct_function(parent, callback, clickrelease, startauto): def rangeselct_function(callback, clickrelease, startauto):
global screen_shot_ui global screen_shot_ui
if screen_shot_ui is None: if screen_shot_ui is None:
screen_shot_ui = rangeselct(parent) screen_shot_ui = rangeselct()
# 可能是由于使用win32移动窗口导致父翻译show/hide影响到他
screen_shot_ui.show() screen_shot_ui.show()
screen_shot_ui.reset() screen_shot_ui.reset()
screen_shot_ui.callback = callback screen_shot_ui.callback = callback

View File

@ -135,7 +135,7 @@ class AnkiWindow(QWidget):
if globalconfig["ankiconnect"]["ocrcroped"]: if globalconfig["ankiconnect"]["ocrcroped"]:
self.asyncocr(img) self.asyncocr(img)
rangeselct_function(self, ocroncefunction, False, False) rangeselct_function(ocroncefunction, False, False)
def __init__(self) -> None: def __init__(self) -> None:
super().__init__() super().__init__()

View File

@ -348,7 +348,7 @@ class QUnFrameWindow(resizableframeless):
text = ocr_run(img) text = ocr_run(img)
gobject.baseobject.textgetmethod(text, False) gobject.baseobject.textgetmethod(text, False)
rangeselct_function(self, ocroncefunction, False, False) rangeselct_function(ocroncefunction, False, False)
@threader @threader
def simulate_key_enter(self): def simulate_key_enter(self):
@ -900,7 +900,7 @@ class QUnFrameWindow(resizableframeless):
return return
self.showhidestate = False self.showhidestate = False
rangeselct_function(self, self.afterrange, auto, auto) rangeselct_function(self.afterrange, auto, auto)
def afterrange(self, rect): def afterrange(self, rect):
gobject.baseobject.textsource.newrangeadjustor() gobject.baseobject.textsource.newrangeadjustor()