From a63f2a1cdd008b58167aec0671797257cd15f431 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: Fri, 28 Jun 2024 02:14:28 +0800 Subject: [PATCH] fix --- .../LunaTranslator/gui/dialog_savedgame.py | 41 ++++++++++++------- .../files/defaultconfig/config.json | 2 + 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/LunaTranslator/LunaTranslator/gui/dialog_savedgame.py b/LunaTranslator/LunaTranslator/gui/dialog_savedgame.py index a6bda7ff..a3d4211c 100644 --- a/LunaTranslator/LunaTranslator/gui/dialog_savedgame.py +++ b/LunaTranslator/LunaTranslator/gui/dialog_savedgame.py @@ -91,7 +91,7 @@ class ItemWidget(QWidget): def click(self): try: self.bottommask.setStyleSheet( - f'background-color: {str2rgba(globalconfig["dialog_savegame_layout"]["onselectcolor1"],globalconfig["dialog_savegame_layout"]["transparent"])};' + f'background-color: {str2rgba(globalconfig["dialog_savegame_layout"]["onselectcolor1"],globalconfig["dialog_savegame_layout"]["transparentselect"])};' ) if self != ItemWidget.globallashfocus: @@ -163,7 +163,14 @@ class ItemWidget(QWidget): os.path.exists(uid2gamepath[gameuid]) ] ] - c = str2rgba(c, globalconfig["dialog_savegame_layout"]["transparent"]) + c = str2rgba( + c, + globalconfig["dialog_savegame_layout"][ + ("transparentnotexits", "transparent")[ + os.path.exists(uid2gamepath[gameuid]) + ] + ], + ) self.maskshowfileexists.setStyleSheet(f"background-color:{c};") @@ -1546,13 +1553,13 @@ class dialog_syssetting(QDialog): getspinbox(0, 1000, globalconfig["dialog_savegame_layout"], key), ) - for key, name in [ - ("backcolor1", "颜色"), - ("onselectcolor1", "选中时颜色"), - ("onfilenoexistscolor1", "游戏不存在时颜色"), + for key, key2, name in [ + ("backcolor1", "transparent", "颜色"), + ("onselectcolor1", "transparentselect", "选中时颜色"), + ("onfilenoexistscolor1", "transparentnotexits", "游戏不存在时颜色"), ]: formLayout.addRow( - (_TR(name)), + _TR(name), getcolorbutton( globalconfig["dialog_savegame_layout"], key, @@ -1569,10 +1576,10 @@ class dialog_syssetting(QDialog): parent=self, ), ) - formLayout.addRow( - (_TR("不透明度")), - getspinbox(0, 100, globalconfig["dialog_savegame_layout"], "transparent"), - ) + formLayout.addRow( + _TR(name) + _TR("不透明度"), + getspinbox(0, 100, globalconfig["dialog_savegame_layout"], key2), + ) if type_ == 1: formLayout.addRow( _TR("缩放"), @@ -2394,9 +2401,8 @@ class clickitem(QWidget): def click(self): try: self.bottommask.setStyleSheet( - f'background-color: {str2rgba(globalconfig["dialog_savegame_layout"]["onselectcolor1"],globalconfig["dialog_savegame_layout"]["transparent"])};' + f'background-color: {str2rgba(globalconfig["dialog_savegame_layout"]["onselectcolor1"],globalconfig["dialog_savegame_layout"]["transparentselect"])};' ) - if self != clickitem.globallashfocus: clickitem.clearfocus() clickitem.globallashfocus = self @@ -2429,7 +2435,14 @@ class clickitem(QWidget): c = globalconfig["dialog_savegame_layout"][ ("onfilenoexistscolor1", "backcolor1")[os.path.exists(uid2gamepath[uid])] ] - c = str2rgba(c, globalconfig["dialog_savegame_layout"]["transparent"]) + c = str2rgba( + c, + globalconfig["dialog_savegame_layout"][ + ("transparentnotexits", "transparent")[ + os.path.exists(uid2gamepath[uid]) + ] + ], + ) self.maskshowfileexists.setStyleSheet(f"background-color:{c};") self.bottommask = QLabel(self) self.bottommask.setStyleSheet("background-color: rgba(255,255,255, 0);") diff --git a/LunaTranslator/files/defaultconfig/config.json b/LunaTranslator/files/defaultconfig/config.json index dd708bc7..e25f61cc 100644 --- a/LunaTranslator/files/defaultconfig/config.json +++ b/LunaTranslator/files/defaultconfig/config.json @@ -517,6 +517,8 @@ "onselectcolor1": "#007fff", "onfilenoexistscolor1": "#acacac", "transparent": 25, + "transparentselect": 25, + "transparentnotexits": 25, "listitemheight": 40, "listitemwidth": 300 },