diff --git a/LunaTranslator/LunaTranslator/gui/dialog_savedgame.py b/LunaTranslator/LunaTranslator/gui/dialog_savedgame.py index cccd5d3d..2dc5529f 100644 --- a/LunaTranslator/LunaTranslator/gui/dialog_savedgame.py +++ b/LunaTranslator/LunaTranslator/gui/dialog_savedgame.py @@ -1074,6 +1074,20 @@ class dialog_setting_game_internal(QWidget): for showname, key, filt in [ ("json翻译文件", "gamejsonfile", "*.json"), + ]: + if isinstance(savehook_new_data[exepath][key], str): + savehook_new_data[exepath][key] = [savehook_new_data[exepath][key]] + formLayout.addRow( + _TR(showname), + listediterline( + showname, + showname, + savehook_new_data[exepath][key], + ispathsedit=dict(filter1=filt), + ), + ) + + for showname, key, filt in [ ("sqlite翻译记录", "gamesqlitefile", "*.sqlite"), ]: formLayout.addRow( @@ -2556,7 +2570,7 @@ class dialog_savedgame_v3(QWidget): _TR("画廊"), savehook_new_data[self.currentfocuspath]["imagepath_all"], closecallback=lambda: self.pixview.setpix(self.currentfocuspath), - ispathsedit=True, + ispathsedit=dict(), ) elif action == deleteimage: diff --git a/LunaTranslator/LunaTranslator/gui/usefulwidget.py b/LunaTranslator/LunaTranslator/gui/usefulwidget.py index 82795ad6..682e3c22 100644 --- a/LunaTranslator/LunaTranslator/gui/usefulwidget.py +++ b/LunaTranslator/LunaTranslator/gui/usefulwidget.py @@ -1204,7 +1204,7 @@ class listediter(QDialog): self.hcmodel.insertRow(target, [QStandardItem(text)]) def __init__( - self, p, title, header, lst, closecallback=None, ispathsedit=False + self, p, title, header, lst, closecallback=None, ispathsedit=None ) -> None: super().__init__(p) self.lst = lst @@ -1277,8 +1277,8 @@ class listediter(QDialog): "", multi=False, edit=None, - isdir=self.ispathsedit["isdir"], - filter1=self.ispathsedit["filter1"], + isdir=self.ispathsedit.get("isdir",False), + filter1=self.ispathsedit.get("filter1",'*.*'), callback=self.__cb, ) else: @@ -1288,7 +1288,7 @@ class listediter(QDialog): class listediterline(QLineEdit): clicked = pyqtSignal() - def __init__(self, name, header, reflist, ispathsedit=False): + def __init__(self, name, header, reflist, ispathsedit=None): super().__init__() self.setReadOnly(True) self.reflist = reflist diff --git a/LunaTranslator/LunaTranslator/myutils/config.py b/LunaTranslator/LunaTranslator/myutils/config.py index 93952fe5..9846d3bc 100644 --- a/LunaTranslator/LunaTranslator/myutils/config.py +++ b/LunaTranslator/LunaTranslator/myutils/config.py @@ -92,7 +92,7 @@ def getdefaultsavehook(gamepath, title=None): "hooktypeasname": {}, "use_saved_text_process": False, # "searchnoresulttime": 0, - "gamejsonfile": "", + "gamejsonfile": [],#之前是"",后面改成[] "gamesqlitefile": "", "relationlinks": [], # "vndbtags": [],#->webtags diff --git a/LunaTranslator/LunaTranslator/translator/rengong.py b/LunaTranslator/LunaTranslator/translator/rengong.py index 6949f665..d9dfc7e5 100644 --- a/LunaTranslator/LunaTranslator/translator/rengong.py +++ b/LunaTranslator/LunaTranslator/translator/rengong.py @@ -16,16 +16,19 @@ class TS(basetrans): with open(pp, "r", encoding="utf8") as f: self.jsons.append(json.load(f)) if p1: - if os.path.exists(p1): - with open(p1, "r", encoding="utf8") as f: - self.jsons.append(json.load(f)) + for pp in p1: + if os.path.exists(pp): + with open(pp, "r", encoding="utf8") as f: + self.jsons.append(json.load(f)) self.paths = (p1, p) def unsafegetcurrentgameconfig(self): try: _path = gobject.baseobject.textsource.pname _path = savehook_new_data[_path]["gamejsonfile"] - return _path + if isinstance(_path, str): + _path = [_path] + return tuple(_path) except: return None