From 3f9e219425218dac5ec21e76cd8dffc74479820f 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:04:52 +0800 Subject: [PATCH] . --- LunaTranslator/LunaTranslator/myutils/utils.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/LunaTranslator/LunaTranslator/myutils/utils.py b/LunaTranslator/LunaTranslator/myutils/utils.py index 9bdc12f9..5dad249c 100644 --- a/LunaTranslator/LunaTranslator/myutils/utils.py +++ b/LunaTranslator/LunaTranslator/myutils/utils.py @@ -166,7 +166,7 @@ def trysearchfordata(gamepath, key, vid): data = targetmod[key].searchfordata(vid) except: print_exc() - data = {} + return False title = data.get("title", None) namemap = data.get("namemap", None) developers = data.get("developers", []) @@ -194,7 +194,7 @@ def trysearchfordata(gamepath, key, vid): savehook_new_data[gamepath]["webtags"] = webtags if len(developers): savehook_new_data[gamepath]["developers"] = developers - + return True def everymethodsthread(): while True: @@ -208,8 +208,11 @@ def everymethodsthread(): elif _type == 1: key, vid = arg - trysearchfordata(gamepath, key, vid) - gobject.baseobject.translation_ui.displayglobaltooltip.emit(f"{key}: {vid} data loaded") + if trysearchfordata(gamepath, key, vid): + gobject.baseobject.translation_ui.displayglobaltooltip.emit(f"{key}: {vid} data loaded") + else: + gobject.baseobject.translation_ui.displayglobaltooltip.emit(f"{key}: {vid} load failed") + except: print_exc()