Skip to content

Commit

Permalink
Merge pull request #455 from Ninohana/main
Browse files Browse the repository at this point in the history
fix: 云母效果与子窗口不统一
  • Loading branch information
Zzaphkiel authored Sep 1, 2024
2 parents d7da2ca + 0801718 commit dd66499
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
15 changes: 11 additions & 4 deletions app/lol/champions.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import json
import os
import re
from functools import lru_cache, wraps

import aiohttp

from app.common.config import cfg, LOCAL_PATH
from app.common.config import LOCAL_PATH
from app.common.logger import logger
from app.common.util import getLolClientVersion

Expand Down Expand Up @@ -76,9 +74,18 @@ def __needUpdate(self):

return ChampionAlias.getDataVersion() != lolVersion

@staticmethod
def computeDict(dic: dict, key, fun: callable):
dic[key] = fun(key, dic.get(key))

@classmethod
def getChampionsAlias(cls) -> dict:
return ChampionAlias.data['champions']
champions = ChampionAlias.data['champions']
cls.computeDict(champions, "901", lambda x, y: y + ",小火龙")# 斯莫德
cls.computeDict(champions, "950", lambda x, y: y + ",狗")# 纳亚菲利
cls.computeDict(champions, "902", lambda x, y: y + ",丁真")# 米利欧
cls.computeDict(champions, "897", lambda x, y: y + ",黑龙,n-word")# 奎桑提
return champions

@classmethod
def isAvailable(cls) -> bool:
Expand Down
8 changes: 7 additions & 1 deletion app/view/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def __conncetSignalToSlot(self):
self.settingInterface.careerGamesCount.pushButton.clicked.connect(
self.__refreshCareerInterface)
self.settingInterface.micaCard.checkedChanged.connect(
self.setMicaEffectEnabled)
self.__cascadeSetMicaEffect)

# From main_window
self.showUpdateMessageBox.connect(self.__onShowUpdateMessageBox)
Expand Down Expand Up @@ -992,6 +992,12 @@ async def __refreshCareerInterface(self):
if self.isClientProcessRunning:
self.careerInterface.refreshButton.click()

@asyncSlot()
async def __cascadeSetMicaEffect(self):
isMicaEnabled = cfg.get(cfg.micaEnabled)
self.setMicaEffectEnabled(isMicaEnabled)
self.opggWindow.setMicaEffectEnabled(isMicaEnabled)

@asyncSlot()
async def __onFixLCUButtonClicked(self):
if self.isClientProcessRunning:
Expand Down
4 changes: 2 additions & 2 deletions app/view/opgg_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@

class OpggWindowBase(BackgroundAnimationWidget, FramelessWindow):
def __init__(self, parent=None):
self._isMicaEnabled = False
self._isMicaEnabled = cfg.get(cfg.micaEnabled)
self._lightBackgroundColor = QColor(243, 243, 243)
self._darkBackgroundColor = QColor(32, 32, 32)

super().__init__(parent=parent)

self.setTitleBar(FluentTitleBar(self))
self.setMicaEffectEnabled(True)
self.setMicaEffectEnabled(self._isMicaEnabled)
self.setContentsMargins(0, 36, 0, 0)

self.titleBar.hBoxLayout.setContentsMargins(14, 0, 0, 0)
Expand Down

0 comments on commit dd66499

Please sign in to comment.