diff --git a/LunaTranslator/LunaTranslator/gui/rangeselect.py b/LunaTranslator/LunaTranslator/gui/rangeselect.py index 25237b4f..6ff63bb8 100644 --- a/LunaTranslator/LunaTranslator/gui/rangeselect.py +++ b/LunaTranslator/LunaTranslator/gui/rangeselect.py @@ -114,7 +114,7 @@ class rangeadjust(Mainw): class rangeselct(QMainWindow): - def __init__(self, parent): + def __init__(self, parent=None): super(rangeselct, self).__init__(parent) self.setWindowFlags( @@ -225,10 +225,11 @@ class rangeselct(QMainWindow): screen_shot_ui = None -def rangeselct_function(parent, callback, clickrelease, startauto): +def rangeselct_function(callback, clickrelease, startauto): global screen_shot_ui 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.reset() screen_shot_ui.callback = callback diff --git a/LunaTranslator/LunaTranslator/gui/showword.py b/LunaTranslator/LunaTranslator/gui/showword.py index f44fd131..c29f705f 100644 --- a/LunaTranslator/LunaTranslator/gui/showword.py +++ b/LunaTranslator/LunaTranslator/gui/showword.py @@ -135,7 +135,7 @@ class AnkiWindow(QWidget): if globalconfig["ankiconnect"]["ocrcroped"]: self.asyncocr(img) - rangeselct_function(self, ocroncefunction, False, False) + rangeselct_function(ocroncefunction, False, False) def __init__(self) -> None: super().__init__() diff --git a/LunaTranslator/LunaTranslator/gui/translatorUI.py b/LunaTranslator/LunaTranslator/gui/translatorUI.py index 58154217..b9d31f4f 100644 --- a/LunaTranslator/LunaTranslator/gui/translatorUI.py +++ b/LunaTranslator/LunaTranslator/gui/translatorUI.py @@ -348,7 +348,7 @@ class QUnFrameWindow(resizableframeless): text = ocr_run(img) gobject.baseobject.textgetmethod(text, False) - rangeselct_function(self, ocroncefunction, False, False) + rangeselct_function(ocroncefunction, False, False) @threader def simulate_key_enter(self): @@ -900,7 +900,7 @@ class QUnFrameWindow(resizableframeless): return self.showhidestate = False - rangeselct_function(self, self.afterrange, auto, auto) + rangeselct_function(self.afterrange, auto, auto) def afterrange(self, rect): gobject.baseobject.textsource.newrangeadjustor()