Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
恍兮惚兮 committed Dec 28, 2024
1 parent bbb2b23 commit 3efca3b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 42 deletions.
53 changes: 18 additions & 35 deletions py/LunaTranslator/gui/dialog_savedgame.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,57 +354,40 @@ def mouseDoubleClickEvent(self, e):
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:
Expand Down
4 changes: 0 additions & 4 deletions py/LunaTranslator/gui/dialog_savedgame_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,10 +403,6 @@ def __init__(self, parent, type_=1) -> None:
isfontselector=True,
),
)
formLayout.addRow(
"显示标题",
getsimpleswitch(globalconfig, "showgametitle"),
)
formLayout.addRow(
"缩放",
getsimplecombobox(
Expand Down
5 changes: 2 additions & 3 deletions py/files/defaultconfig/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,6 @@
"localeswitchmethod": 0,
"hide_not_exists": false,
"startgamenototop": true,
"showgametitle": true,
"extra_space": 0,
"extra_space_trans": 0,
"fonttype": "",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 3efca3b

Please sign in to comment.