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 [
("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:

View File

@ -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

View File

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

View File

@ -16,8 +16,9 @@ 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:
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)
@ -25,7 +26,9 @@ class TS(basetrans):
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