1
0
Fork 0
mirror of https://github.com/shlomif/PySolFC.git synced 2025-04-05 00:02:29 -04:00

Disable favorite games menu when there are no favorites.

This commit is contained in:
Joe R 2023-12-26 09:26:36 -05:00
parent 2017b4f23b
commit 5852bad127

View file

@ -1262,7 +1262,7 @@ class PysolMenubarTkCommon:
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)
@ -1273,8 +1273,12 @@ class PysolMenubarTkCommon:
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))