Skip to content

Commit

Permalink
Merge pull request #502 from jqyisbest/main
Browse files Browse the repository at this point in the history
修复个人生涯页面KDA计算结果仅在部分情况下显示的问题(Bug?Feature?)
  • Loading branch information
Zzaphkiel authored Oct 27, 2024
2 parents adca4e2 + 2e15aa3 commit 77ee73f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions app/view/career_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def __init__(self, parent=None):
self.tr('games)'))
self.winsLabel = ColorLabel(self.tr("Wins:") + " None", 'win')
self.lossesLabel = ColorLabel(self.tr("Losses:") + " None", 'lose')
self.kdaLabel = QLabel(self.tr("KDA:") + " None / None / None")
self.kdaLabel = QLabel(self.tr("KDA:") + " None / None / None" + self.tr("(") + "0" + self.tr(")"))
self.championsCard = ChampionsCard()
self.recentTeamButton = PushButton(self.tr("Recent teammates"))
self.filterComboBox = ComboBox()
Expand Down Expand Up @@ -555,8 +555,11 @@ def __onfilterComboBoxChanged(self, index):
)
self.winsLabel.setText(f"{self.tr('Wins:')} {wins}")
self.lossesLabel.setText(f"{self.tr('Losses:')} {losses}")
self.kdaLabel.setText(
f"{self.tr('KDA:')} {kills} / {deaths} / {assists}")
kda = f"{self.tr('KDA:')} {kills} / {deaths} / {assists}"
kda += self.tr("(")
kda += f"{(kills + assists) / (1 if deaths == 0 else deaths):.1f}"
kda += self.tr(")")
self.kdaLabel.setText(kda)

self.gameInfoLayout.addSpacerItem(
QSpacerItem(1, 1, QSizePolicy.Minimum, QSizePolicy.Expanding))
Expand Down Expand Up @@ -645,8 +648,8 @@ def updateSummoners(self, info):
spacing = self.infopageVBoxLayout.spacing()

if length < 5:
self.infopageVBoxLayout.addStretch(5-length)
self.infopageVBoxLayout.addSpacing(spacing * (5-length))
self.infopageVBoxLayout.addStretch(5 - length)
self.infopageVBoxLayout.addSpacing(spacing * (5 - length))

def setLoadingPageEnabled(self, enable):
index = 0 if enable else 1
Expand Down

0 comments on commit 77ee73f

Please sign in to comment.