diff --git a/LunaTranslator/LunaTranslator/LunaTranslator.py b/LunaTranslator/LunaTranslator/LunaTranslator.py index 9f4175f4..f0a43d6d 100644 --- a/LunaTranslator/LunaTranslator/LunaTranslator.py +++ b/LunaTranslator/LunaTranslator/LunaTranslator.py @@ -117,6 +117,11 @@ class MAINUI: class klass(kls): @property def using(self): + if 'using_X' in dir(self): + try: + return self.using_X + except: + return False return checkpostusing(_name) return klass() diff --git a/LunaTranslator/LunaTranslator/gui/dialog_savedgame.py b/LunaTranslator/LunaTranslator/gui/dialog_savedgame.py index 4486fc92..605700e9 100644 --- a/LunaTranslator/LunaTranslator/gui/dialog_savedgame.py +++ b/LunaTranslator/LunaTranslator/gui/dialog_savedgame.py @@ -1217,6 +1217,7 @@ class dialog_setting_game_internal(QWidget): visname, getboxlayout( [ + getsimpleswitch(savehook_new_data[gameuid], name + "_use"), getIconButton( callback=functools.partial(__, setting, self, gameuid), icon="fa.gear", diff --git a/LunaTranslator/LunaTranslator/myutils/config.py b/LunaTranslator/LunaTranslator/myutils/config.py index fbc507e2..e384f9b7 100644 --- a/LunaTranslator/LunaTranslator/myutils/config.py +++ b/LunaTranslator/LunaTranslator/myutils/config.py @@ -154,6 +154,8 @@ def getdefaultsavehook(title=None): "currentvisimage": None, "currentmainimage": "", "noundictconfig": [], + "noundict_use":True, + "vndbnamemap_use" :True, # 元数据 "namemap": {}, # 人名翻译映射,vndb独占,用于优化翻译 # diff --git a/LunaTranslator/LunaTranslator/transoptimi/noundict.py b/LunaTranslator/LunaTranslator/transoptimi/noundict.py index 6755ab8b..b03aa1d8 100644 --- a/LunaTranslator/LunaTranslator/transoptimi/noundict.py +++ b/LunaTranslator/LunaTranslator/transoptimi/noundict.py @@ -5,6 +5,7 @@ from traceback import print_exc import gobject from gui.usefulwidget import getQMessageBox, threebuttons from myutils.wrapper import Singleton_close +from myutils.utils import checkpostusing @Singleton_close @@ -382,6 +383,22 @@ class Process: ), ) + @property + def using_X(self): + for _ in (0,): + try: + if not gobject.baseobject.textsource: + break + gameuid = gobject.baseobject.textsource.gameuid + if savehook_new_data[gameuid]["transoptimi_followdefault"]: + break + return savehook_new_data[gameuid]["noundict_use"] + + except: + print_exc() + break + return checkpostusing("noundict") + def usewhich(self) -> dict: for _ in (0,): try: diff --git a/LunaTranslator/LunaTranslator/transoptimi/vndbnamemap.py b/LunaTranslator/LunaTranslator/transoptimi/vndbnamemap.py index bff6b7e0..34046164 100644 --- a/LunaTranslator/LunaTranslator/transoptimi/vndbnamemap.py +++ b/LunaTranslator/LunaTranslator/transoptimi/vndbnamemap.py @@ -2,6 +2,7 @@ from myutils.config import savehook_new_data, globalconfig import gobject from traceback import print_exc from gui.inputdialog import postconfigdialog_ +from myutils.utils import checkpostusing class Process: @@ -28,6 +29,22 @@ class Process: ), ) + @property + def using_X(self): + for _ in (0,): + try: + if not gobject.baseobject.textsource: + break + gameuid = gobject.baseobject.textsource.gameuid + if savehook_new_data[gameuid]["transoptimi_followdefault"]: + break + return savehook_new_data[gameuid]["vndbnamemap_use"] + + except: + print_exc() + break + return checkpostusing("vndbnamemap") + def usewhich(self) -> dict: for _ in (0,): try: