From 3efca3b5adcbfeea2b9136c898cdbece04908d96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <1173718158@qq.com> Date: Sat, 28 Dec 2024 12:48:14 +0800 Subject: [PATCH] . --- py/LunaTranslator/gui/dialog_savedgame.py | 53 +++++++------------ .../gui/dialog_savedgame_common.py | 4 -- py/files/defaultconfig/config.json | 5 +- 3 files changed, 20 insertions(+), 42 deletions(-) diff --git a/py/LunaTranslator/gui/dialog_savedgame.py b/py/LunaTranslator/gui/dialog_savedgame.py index b138a897..620a5628 100644 --- a/py/LunaTranslator/gui/dialog_savedgame.py +++ b/py/LunaTranslator/gui/dialog_savedgame.py @@ -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: diff --git a/py/LunaTranslator/gui/dialog_savedgame_common.py b/py/LunaTranslator/gui/dialog_savedgame_common.py index 63cb849f..2571a4f2 100644 --- a/py/LunaTranslator/gui/dialog_savedgame_common.py +++ b/py/LunaTranslator/gui/dialog_savedgame_common.py @@ -403,10 +403,6 @@ class dialog_syssetting(LDialog): isfontselector=True, ), ) - formLayout.addRow( - "显示标题", - getsimpleswitch(globalconfig, "showgametitle"), - ) formLayout.addRow( "缩放", getsimplecombobox( diff --git a/py/files/defaultconfig/config.json b/py/files/defaultconfig/config.json index e7023757..cda5ab2e 100644 --- a/py/files/defaultconfig/config.json +++ b/py/files/defaultconfig/config.json @@ -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",