Skip to content

Commit

Permalink
Disable favorite games menu when there are no favorites.
Browse files Browse the repository at this point in the history
  • Loading branch information
joeraz committed Dec 26, 2023
1 parent 2017b4f commit 5852bad
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pysollib/ui/tktile/menubar.py
Original file line number Diff line number Diff line change
Expand Up @@ -1262,7 +1262,7 @@ def mSelectGameDialogWithPreview(self, *event):

def updateFavoriteGamesMenu(self):
gameids = self.app.opt.favorite_gameid
submenu = self.menupath[".menubar.file.favoritegames"][2]
menu, index, submenu = self.menupath[".menubar.file.favoritegames"]
games = []
for id in gameids:
gi = self.app.getGameInfo(id)
Expand All @@ -1273,8 +1273,12 @@ def sort_func(gi):
return gi.name

games.sort(key=sort_func)
self.updateGamesMenu(submenu, games)
state = self._getEnabledState
if len(games) > 0:
self.updateGamesMenu(submenu, games)
menu.entryconfig(index, state=state(True))
else:
menu.entryconfig(index, state=state(False))
in_favor = self.app.game.id in gameids
menu, index, submenu = self.menupath[".menubar.file.addtofavorites"]
menu.entryconfig(index, state=state(not in_favor))
Expand Down

0 comments on commit 5852bad

Please sign in to comment.