This commit is contained in:
恍兮惚兮 2024-12-28 12:48:14 +08:00
parent bbb2b23d4c
commit 3efca3b5ad
3 changed files with 20 additions and 42 deletions

View File

@ -354,57 +354,40 @@ class ItemWidget(QWidget):
def resizeEvent(self, a0: QResizeEvent) -> None:
self.bottommask.resize(a0.size())
self.maskshowfileexists.resize(a0.size())
self._imgsz()
def others(self):
self._lb.setText(self.file if globalconfig["showgametitle"] else "")
self._img.switch()
self._imgsz()
def _imgsz(self):
textH = (
globalconfig["dialog_savegame_layout"]["textH"]
if globalconfig["showgametitle"]
else 0
)
margin = globalconfig["dialog_savegame_layout"]["margin2"]
self._img.setGeometry(
margin,
margin,
self.width() - 2 * margin,
self.height() - textH - 2 * margin,
self.l.setContentsMargins(
*([globalconfig["dialog_savegame_layout"]["margin2"]] * 4)
)
if self._img._pixmap.isNull():
self._lb.setGeometry(
margin,
max(
margin,
self.height() - self._lb.heightForWidth(self.width()) - margin,
),
self.width() - 2 * margin,
min(self.height() - 2 * margin, self._lb.heightForWidth(self.width())),
)
pass
else:
self._lb.setGeometry(
margin,
self.height() - textH - margin,
self.width() - 2 * margin,
textH,
)
self._lb.setFixedHeight(globalconfig["dialog_savegame_layout"]["textH"])
self._img.switch()
def __init__(self, gameuid, pixmap, file) -> None:
super().__init__()
self.gameuid = gameuid
self.file = file
self.maskshowfileexists = QLabel(self)
self.l = QVBoxLayout(self)
self.l.setSpacing(0)
self.l.setContentsMargins(
*([globalconfig["dialog_savegame_layout"]["margin2"]] * 4)
)
self._img = IMGWidget(self, pixmap)
self._lb = QLabel(self)
self._lb.setText(file if globalconfig["showgametitle"] else "")
if self._img._pixmap.isNull():
self.l.setAlignment(Qt.AlignmentFlag.AlignBottom)
else:
self._lb.setFixedHeight(globalconfig["dialog_savegame_layout"]["textH"])
self.l.addWidget(self._img)
self._lb.setText(file)
self._lb.setWordWrap(True)
self._lb.setObjectName("savegame_textfont1")
self._lb.setAlignment(Qt.AlignmentFlag.AlignHCenter)
self.l.addWidget(self._lb)
exists = os.path.exists(get_launchpath(gameuid))
self.maskshowfileexists.setObjectName("savegame_exists" + str(exists))
if not exists:

View File

@ -403,10 +403,6 @@ class dialog_syssetting(LDialog):
isfontselector=True,
),
)
formLayout.addRow(
"显示标题",
getsimpleswitch(globalconfig, "showgametitle"),
)
formLayout.addRow(
"缩放",
getsimplecombobox(

View File

@ -441,7 +441,6 @@
"localeswitchmethod": 0,
"hide_not_exists": false,
"startgamenototop": true,
"showgametitle": true,
"extra_space": 0,
"extra_space_trans": 0,
"fonttype": "",
@ -521,8 +520,8 @@
"dialog_savegame_layout": {
"itemw": 130,
"itemh": 190,
"margin": 8,
"margin2": 8,
"margin": 6,
"margin2": 6,
"textH": 0,
"backcolor2": "#40ffffff",
"onselectcolor2": "#40007fff",