diff --git a/app/view/career_interface.py b/app/view/career_interface.py index 54e8de7a..a8c7d7d7 100644 --- a/app/view/career_interface.py +++ b/app/view/career_interface.py @@ -8,8 +8,8 @@ QSizePolicy, QTableWidgetItem, QHeaderView, QWidget, QFrame, QStackedWidget) from PyQt5.QtCore import Qt, pyqtSignal -from qfluentwidgets import (ScrollArea, TableWidget, Theme, PushButton, - ComboBox, SmoothScrollArea, ToolTipFilter, +from qfluentwidgets import (ScrollArea, TableWidget, Theme, PushButton, ComboBox, + SmoothScrollArea, ToolTipFilter, setCustomStyleSheet, ToolTipPosition, ToolButton, IndeterminateProgressRing, Flyout, FlyoutViewBase, FlyoutAnimationType) @@ -43,9 +43,9 @@ def __init__(self, parent=None): self.IconNameHBoxLayout = QHBoxLayout() self.nameLevelVLayout = QVBoxLayout() self.icon = RoundLevelAvatar('app/resource/images/champion-0.png', - 0, - 1, - parent=self) + 0, + 1, + parent=self) self.name = QLabel(self.tr("Connecting...")) self.copyButton = ToolButton(Icon.COPY) self.nameButtonLayout = QHBoxLayout() @@ -152,7 +152,7 @@ def __initWidget(self): self.__updateTable() StyleSheet.CAREER_INTERFACE.apply(self) - self.setTableStyle(cfg.theme) + self.setTableStyle() def __initLayout(self): self.nameButtonLayout.setContentsMargins(0, 0, 0, 0) @@ -262,30 +262,36 @@ def __updateTable(self): self.rankTable.horizontalHeader().setSectionResizeMode( QHeaderView.Stretch) - def setTableStyle(self, theme=None): - if cfg.theme == Theme.LIGHT: - borderColor = "rgba(0, 0, 0, 0.095)" - backgroundColor = "rgba(255, 255, 255, 0.667)" - else: - borderColor = "rgb(35, 35, 35)" - backgroundColor = "rgba(255, 255, 255, 0.051)" - - qss = self.rankTable.styleSheet() - qss += f''' - QHeaderView::section:horizontal {{ - border: none; - border-bottom: 1px solid {borderColor}; - }} - - QTableView {{ - border: 1px solid {borderColor}; - border-radius: 6px; - background: {backgroundColor}; - }}''' - self.rankTable.setStyleSheet(qss) + def setTableStyle(self): + light = ''' + QHeaderView::section:horizontal { + border: none; + border-bottom: 1px solid rgba(0, 0, 0, 0.095); + } + + QTableView { + border: 1px solid rgba(0, 0, 0, 0.095); + border-radius: 6px; + background: rgba(255, 255, 255, 0.667); + } + ''' + + dark = ''' + QHeaderView::section:horizontal { + border: none; + border-bottom: 1px solid rgb(35, 35, 35); + } + + QTableView { + border: 1px solid rgb(35, 35, 35); + border-radius: 6px; + background: rgba(255, 255, 255, 0.051); + } + ''' + + setCustomStyleSheet(self.rankTable, light, dark) def __connectSignalToSlot(self): - cfg.themeChanged.connect(self.setTableStyle) self.careerInfoChanged.connect(self.__onCareerInfoChanged) self.IconLevelExpChanged.connect(self.__onChangeIconLevelAndExp) self.filterComboBox.currentIndexChanged.connect( @@ -313,7 +319,8 @@ def __onChangeIconLevelAndExp(self, info): self.name.setText(name) levelStr = str(level) if level != -1 else "None" - self.icon.updateIcon(icon, xpSinceLastLevel, xpUntilNextLevel, levelStr) + self.icon.updateIcon(icon, xpSinceLastLevel, + xpUntilNextLevel, levelStr) def __onCareerInfoChanged(self, info: dict): if not info['triggerByUser'] and not self.isCurrentSummoner(): @@ -329,7 +336,8 @@ def __onCareerInfoChanged(self, info: dict): games = info['games'] levelStr = str(level) if level != -1 else "None" - self.icon.updateIcon(icon, xpSinceLastLevel, xpUntilNextLevel, levelStr) + self.icon.updateIcon(icon, xpSinceLastLevel, + xpUntilNextLevel, levelStr) self.name.setText(name) self.puuid = puuid @@ -493,7 +501,8 @@ def __onfilterComboBoxChanged(self, index): else: targetId = 0 - hitGames, kills, deaths, assists, wins, losses = parseGames(self.games["games"], targetId) + hitGames, kills, deaths, assists, wins, losses = parseGames( + self.games["games"], targetId) for game in hitGames: bar = GameInfoBar(game) diff --git a/app/view/main_window.py b/app/view/main_window.py index f213026f..2904e1cb 100644 --- a/app/view/main_window.py +++ b/app/view/main_window.py @@ -1003,8 +1003,8 @@ def exceptHook(self, ty, value, tb): self.oldHook(ty, value, tb) def __onCurrentStackedChanged(self, index): - if index == self.stackedWidget.indexOf(self.careerInterface): - self.careerInterface.setTableStyle() + # if index == self.stackedWidget.indexOf(self.careerInterface): + # self.careerInterface.setTableStyle() widget: SmoothScrollArea = self.stackedWidget.view.currentWidget() widget.delegate.vScrollBar.resetValue(0)