This commit is contained in:
恍兮惚兮 2024-06-18 13:52:26 +08:00
parent 7031867f08
commit d7e4882e9c
4 changed files with 27 additions and 10 deletions

View File

@ -1074,6 +1074,20 @@ class dialog_setting_game_internal(QWidget):
for showname, key, filt in [ for showname, key, filt in [
("json翻译文件", "gamejsonfile", "*.json"), ("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"), ("sqlite翻译记录", "gamesqlitefile", "*.sqlite"),
]: ]:
formLayout.addRow( formLayout.addRow(
@ -2556,7 +2570,7 @@ class dialog_savedgame_v3(QWidget):
_TR("画廊"), _TR("画廊"),
savehook_new_data[self.currentfocuspath]["imagepath_all"], savehook_new_data[self.currentfocuspath]["imagepath_all"],
closecallback=lambda: self.pixview.setpix(self.currentfocuspath), closecallback=lambda: self.pixview.setpix(self.currentfocuspath),
ispathsedit=True, ispathsedit=dict(),
) )
elif action == deleteimage: elif action == deleteimage:

View File

@ -1204,7 +1204,7 @@ class listediter(QDialog):
self.hcmodel.insertRow(target, [QStandardItem(text)]) self.hcmodel.insertRow(target, [QStandardItem(text)])
def __init__( def __init__(
self, p, title, header, lst, closecallback=None, ispathsedit=False self, p, title, header, lst, closecallback=None, ispathsedit=None
) -> None: ) -> None:
super().__init__(p) super().__init__(p)
self.lst = lst self.lst = lst
@ -1277,8 +1277,8 @@ class listediter(QDialog):
"", "",
multi=False, multi=False,
edit=None, edit=None,
isdir=self.ispathsedit["isdir"], isdir=self.ispathsedit.get("isdir",False),
filter1=self.ispathsedit["filter1"], filter1=self.ispathsedit.get("filter1",'*.*'),
callback=self.__cb, callback=self.__cb,
) )
else: else:
@ -1288,7 +1288,7 @@ class listediter(QDialog):
class listediterline(QLineEdit): class listediterline(QLineEdit):
clicked = pyqtSignal() clicked = pyqtSignal()
def __init__(self, name, header, reflist, ispathsedit=False): def __init__(self, name, header, reflist, ispathsedit=None):
super().__init__() super().__init__()
self.setReadOnly(True) self.setReadOnly(True)
self.reflist = reflist self.reflist = reflist

View File

@ -92,7 +92,7 @@ def getdefaultsavehook(gamepath, title=None):
"hooktypeasname": {}, "hooktypeasname": {},
"use_saved_text_process": False, "use_saved_text_process": False,
# "searchnoresulttime": 0, # "searchnoresulttime": 0,
"gamejsonfile": "", "gamejsonfile": [],#之前是"",后面改成[]
"gamesqlitefile": "", "gamesqlitefile": "",
"relationlinks": [], "relationlinks": [],
# "vndbtags": [],#->webtags # "vndbtags": [],#->webtags

View File

@ -16,16 +16,19 @@ class TS(basetrans):
with open(pp, "r", encoding="utf8") as f: with open(pp, "r", encoding="utf8") as f:
self.jsons.append(json.load(f)) self.jsons.append(json.load(f))
if p1: if p1:
if os.path.exists(p1): for pp in p1:
with open(p1, "r", encoding="utf8") as f: if os.path.exists(pp):
self.jsons.append(json.load(f)) with open(pp, "r", encoding="utf8") as f:
self.jsons.append(json.load(f))
self.paths = (p1, p) self.paths = (p1, p)
def unsafegetcurrentgameconfig(self): def unsafegetcurrentgameconfig(self):
try: try:
_path = gobject.baseobject.textsource.pname _path = gobject.baseobject.textsource.pname
_path = savehook_new_data[_path]["gamejsonfile"] _path = savehook_new_data[_path]["gamejsonfile"]
return _path if isinstance(_path, str):
_path = [_path]
return tuple(_path)
except: except:
return None return None