Skip to content

Commit

Permalink
Disable locked achivements' icons
Browse files Browse the repository at this point in the history
and improve var name in group_achievements method
  • Loading branch information
Gatsik committed Jan 8, 2025
1 parent b923fa6 commit 60b9f13
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/playercard/achievements.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def icon(self, icon_name: str = "") -> QPixmap:

def set_icon(self, pixmap: QPixmap) -> None:
self.iconLabel.setPixmap(pixmap)
self.iconLabel.setEnabled(self.player_achievement.current_state == State.UNLOCKED)

def on_icon_downloaded(self, _: str, pixmap: QPixmap) -> None:
self.set_icon(pixmap)
Expand Down Expand Up @@ -156,17 +157,17 @@ def group_achievements(
self,
player_achievements: Iterator[PlayerAchievement],
) -> AchievementGroup:
unlocked, locked, included_ids = [], [], []
unlocked, locked, progressed_any_percent = [], [], []
for player_achievement in player_achievements:
included_ids.append(player_achievement.achievement.xd)
progressed_any_percent.append(player_achievement.achievement.xd)
if player_achievement.current_state == State.UNLOCKED:
unlocked.append(player_achievement)
else:
locked.append(player_achievement)
locked.extend((
self.mock_player_achievement(entry)
for entry in self.all_achievements
if entry.xd not in included_ids
if entry.xd not in progressed_any_percent
))
return AchievementGroup(locked, unlocked)

Expand Down

0 comments on commit 60b9f13

Please sign in to comment.