From a4e13500891cba68223f93d68fa222f2ccb2bf24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Sun, 9 Jun 2024 22:00:39 +0800 Subject: [PATCH] . --- .../LunaTranslator/gui/translatorUI.py | 10 +++++++-- .../LunaTranslator/myutils/utils.py | 21 ++++++++----------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/LunaTranslator/LunaTranslator/gui/translatorUI.py b/LunaTranslator/LunaTranslator/gui/translatorUI.py index 71286710..58154217 100644 --- a/LunaTranslator/LunaTranslator/gui/translatorUI.py +++ b/LunaTranslator/LunaTranslator/gui/translatorUI.py @@ -17,6 +17,7 @@ from gui.dialog_savedgame import browserdialog, dialog_savedgame_integrated class QUnFrameWindow(resizableframeless): + displayglobaltooltip= pyqtSignal(str) displayres = pyqtSignal(dict) displayraw1 = pyqtSignal(dict) displaystatus = pyqtSignal(str, str, bool, bool) @@ -591,10 +592,15 @@ class QUnFrameWindow(resizableframeless): self.showbuttons = [] self.stylebuttons = {} self.saveiterclasspointer = {} - + def displayglobaltooltip_f(self,string): + QToolTip.showText( + QCursor.pos(), + string, + gobject.baseobject.translation_ui, + ) def initsignals(self): self.hidesignal.connect(self.hide_) - + self.displayglobaltooltip.connect(self.displayglobaltooltip_f) self.ocr_once_signal.connect(self.ocr_once_function) self.entersignal.connect(self.enterfunction) self.displaystatus.connect(self.showstatus) diff --git a/LunaTranslator/LunaTranslator/myutils/utils.py b/LunaTranslator/LunaTranslator/myutils/utils.py index c269bb7e..9bdc12f9 100644 --- a/LunaTranslator/LunaTranslator/myutils/utils.py +++ b/LunaTranslator/LunaTranslator/myutils/utils.py @@ -15,6 +15,7 @@ from myutils.config import ( static_data, getlanguse, savehook_new_data, + _TR, getdefaultsavehook, ) from ctypes import c_float, pointer, c_void_p @@ -157,10 +158,10 @@ def trysearchforid(gamepath, searchargs: list): break if infoid: searchvndbqueue.put((1, gamepath, infoid)) + return infoid -def trysearchfordata(gamepath, arg): - key, vid = arg +def trysearchfordata(gamepath, key, vid): try: data = targetmod[key].searchfordata(vid) except: @@ -195,24 +196,20 @@ def trysearchfordata(gamepath, arg): savehook_new_data[gamepath]["developers"] = developers -def parsetask(_type, gamepath, arg): - if _type == 0: - trysearchforid(gamepath, arg) - - elif _type == 1: - trysearchforid(gamepath, arg) - - def everymethodsthread(): while True: _ = searchvndbqueue.get() _type, gamepath, arg = _ try: if _type == 0: - trysearchforid(gamepath, arg) + infoid = trysearchforid(gamepath, arg) + key, vid = infoid + gobject.baseobject.translation_ui.displayglobaltooltip.emit(f"{key}: found {vid}") elif _type == 1: - trysearchfordata(gamepath, arg) + key, vid = arg + trysearchfordata(gamepath, key, vid) + gobject.baseobject.translation_ui.displayglobaltooltip.emit(f"{key}: {vid} data loaded") except: print_exc()