From cb3cdf1ce3a1a3a5ac31c1c34b328f8c7b0ac47c 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: Fri, 12 Apr 2024 18:40:09 +0800 Subject: [PATCH] fix --- .../LunaTranslator/gui/dialog_savedgame.py | 32 +++++++++++-------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/LunaTranslator/LunaTranslator/gui/dialog_savedgame.py b/LunaTranslator/LunaTranslator/gui/dialog_savedgame.py index 4eb19ffe..b4747ca5 100644 --- a/LunaTranslator/LunaTranslator/gui/dialog_savedgame.py +++ b/LunaTranslator/LunaTranslator/gui/dialog_savedgame.py @@ -634,13 +634,14 @@ class dialog_setting_game(QDialog): ), ) - if os.path.exists(globalconfig["backupsavedatato"]) == False: - globalconfig["backupsavedatato"] = os.path.abspath("./cache/backup") - editpath = QLineEdit(globalconfig["backupsavedatato"]) editpath.textChanged.connect( lambda _: globalconfig.__setitem__("backupsavedatato", _) ) - + editpath = QLineEdit( + globalconfig["backupsavedatato"] + if os.path.exists(globalconfig["backupsavedatato"]) + else os.path.abspath("./cache/backup") + ) editpath.setReadOnly(True) formLayout.addRow( _TR("备份到"), @@ -1494,7 +1495,7 @@ class dialog_savedgame_new(saveposwindow): self.flow = ScrollFlow() self.flow.bgclicked.connect(ItemWidget.clearfocus) self.formLayout.insertWidget(self.formLayout.count() - 1, self.flow) - + for k in savehook_new_list: if newtags != self.currtags: break @@ -1529,6 +1530,7 @@ class dialog_savedgame_new(saveposwindow): continue self.newline(k) self.flow.refreshscroll() + def showmenu(self, p): menu = QMenu(self) startgame = QAction(_TR("开始游戏")) @@ -1647,13 +1649,14 @@ class dialog_savedgame_new(saveposwindow): ) _btn.setEnabled(_able1) - def _getpixfunction(self,kk): + def _getpixfunction(self, kk): _pix = QPixmap(savehook_new_data[kk]["imagepath"]) if _pix.isNull(): _pix = getExeIcon(kk, False, cache=True) return _pix - def getagameitem(self,k): - + + def getagameitem(self, k): + gameitem = ItemWidget( functools.partial(self._getpixfunction, k), savehook_new_data[k]["title"] ) @@ -1661,19 +1664,20 @@ class dialog_savedgame_new(saveposwindow): gameitem.doubleclicked.connect(self.startgame) gameitem.focuschanged.connect(self.itemfocuschanged) return gameitem + def newline(self, k, first=False): checkifnewgame(k) - if first: - + self.flow.insertwidget(0, self.getagameitem(k)) self.idxsave.insert(0, k) else: itemw = globalconfig["dialog_savegame_layout"]["itemw"] itemh = globalconfig["dialog_savegame_layout"]["itemh"] - - - self.flow.addwidgetlazy( functools.partial(self.getagameitem, k),QSize(itemw,itemh)) - #self.flow.addwidget( self.getagameitem(k)) + + self.flow.addwidgetlazy( + functools.partial(self.getagameitem, k), QSize(itemw, itemh) + ) + # self.flow.addwidget( self.getagameitem(k)) self.idxsave.append(k)