This commit is contained in:
恍兮惚兮 2024-04-12 18:40:09 +08:00
parent d43673f3c8
commit cb3cdf1ce3

View File

@ -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( editpath.textChanged.connect(
lambda _: globalconfig.__setitem__("backupsavedatato", _) lambda _: globalconfig.__setitem__("backupsavedatato", _)
) )
editpath = QLineEdit(
globalconfig["backupsavedatato"]
if os.path.exists(globalconfig["backupsavedatato"])
else os.path.abspath("./cache/backup")
)
editpath.setReadOnly(True) editpath.setReadOnly(True)
formLayout.addRow( formLayout.addRow(
_TR("备份到"), _TR("备份到"),
@ -1529,6 +1530,7 @@ class dialog_savedgame_new(saveposwindow):
continue continue
self.newline(k) self.newline(k)
self.flow.refreshscroll() self.flow.refreshscroll()
def showmenu(self, p): def showmenu(self, p):
menu = QMenu(self) menu = QMenu(self)
startgame = QAction(_TR("开始游戏")) startgame = QAction(_TR("开始游戏"))
@ -1652,6 +1654,7 @@ class dialog_savedgame_new(saveposwindow):
if _pix.isNull(): if _pix.isNull():
_pix = getExeIcon(kk, False, cache=True) _pix = getExeIcon(kk, False, cache=True)
return _pix return _pix
def getagameitem(self, k): def getagameitem(self, k):
gameitem = ItemWidget( gameitem = ItemWidget(
@ -1661,10 +1664,10 @@ class dialog_savedgame_new(saveposwindow):
gameitem.doubleclicked.connect(self.startgame) gameitem.doubleclicked.connect(self.startgame)
gameitem.focuschanged.connect(self.itemfocuschanged) gameitem.focuschanged.connect(self.itemfocuschanged)
return gameitem return gameitem
def newline(self, k, first=False): def newline(self, k, first=False):
checkifnewgame(k) checkifnewgame(k)
if first: if first:
self.flow.insertwidget(0, self.getagameitem(k)) self.flow.insertwidget(0, self.getagameitem(k))
@ -1673,7 +1676,8 @@ class dialog_savedgame_new(saveposwindow):
itemw = globalconfig["dialog_savegame_layout"]["itemw"] itemw = globalconfig["dialog_savegame_layout"]["itemw"]
itemh = globalconfig["dialog_savegame_layout"]["itemh"] itemh = globalconfig["dialog_savegame_layout"]["itemh"]
self.flow.addwidgetlazy(
self.flow.addwidgetlazy( functools.partial(self.getagameitem, k),QSize(itemw,itemh)) functools.partial(self.getagameitem, k), QSize(itemw, itemh)
)
# self.flow.addwidget( self.getagameitem(k)) # self.flow.addwidget( self.getagameitem(k))
self.idxsave.append(k) self.idxsave.append(k)