From acc88fa123da69a1dc836fe912caec183ececde0 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: Tue, 10 Sep 2024 10:09:52 +0800 Subject: [PATCH] icon --- .../gui/dialog_savedgame_common.py | 6 +++++- .../LunaTranslator/gui/dialog_savedgame_v3.py | 16 ++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/LunaTranslator/LunaTranslator/gui/dialog_savedgame_common.py b/LunaTranslator/LunaTranslator/gui/dialog_savedgame_common.py index 01b44d5f..d4df19fb 100644 --- a/LunaTranslator/LunaTranslator/gui/dialog_savedgame_common.py +++ b/LunaTranslator/LunaTranslator/gui/dialog_savedgame_common.py @@ -413,7 +413,11 @@ def getcachedimage(src, small): return _pix -def getpixfunction(kk, small=False): +def getpixfunction(kk, small=False, iconfirst=False): + if iconfirst: + _pix = getExeIcon(uid2gamepath[kk], False, cache=True) + if not _pix.toImage().allGray(): + return _pix if ( savehook_new_data[kk]["currentmainimage"] in savehook_new_data[kk]["imagepath_all"] diff --git a/LunaTranslator/LunaTranslator/gui/dialog_savedgame_v3.py b/LunaTranslator/LunaTranslator/gui/dialog_savedgame_v3.py index d5942ddb..5b2eb5f3 100644 --- a/LunaTranslator/LunaTranslator/gui/dialog_savedgame_v3.py +++ b/LunaTranslator/LunaTranslator/gui/dialog_savedgame_v3.py @@ -92,7 +92,9 @@ class clickitem(QWidget): self.uid = uid self.lay = QHBoxLayout() self.lay.setSpacing(0) - self.lay.setContentsMargins(0, 0, 0, 0) + size = globalconfig["dialog_savegame_layout"]["listitemheight"] + margin = min(3, int(size / 15)) + self.lay.setContentsMargins(margin, margin, margin, margin) self.maskshowfileexists = QLabel(self) exists = os.path.exists(get_launchpath(uid)) @@ -101,22 +103,20 @@ class clickitem(QWidget): self.bottommask.hide() self.bottommask.setObjectName("savegame_onselectcolor1") _ = QLabel(self) - _.setStyleSheet( - """background-color: rgba(255,255,255, 0);border-bottom: 1px solid gray;""" - ) + _.setStyleSheet("""background-color: rgba(255,255,255, 0);""") self.bottomline = _ - size = globalconfig["dialog_savegame_layout"]["listitemheight"] + _ = QLabel() - _.setFixedSize(QSize(size, size)) + _.setFixedSize(QSize(size - 2 * margin, size - 2 * margin)) _.setScaledContents(True) _.setStyleSheet("background-color: rgba(255,255,255, 0);") - icon = getpixfunction(uid, small=True) + icon = getpixfunction(uid, small=True, iconfirst=True) icon.setDevicePixelRatio(self.devicePixelRatioF()) _.setPixmap(icon) self.lay.addWidget(_) _ = QLabel(savehook_new_data[uid]["title"]) _.setWordWrap(True) - _.setFixedHeight(size + 1) + _.setFixedHeight(size) _.setObjectName("savegame_textfont2") self.lay.addWidget(_) self.setLayout(self.lay)