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:
parent
2017b4f23b
commit
5852bad127
1 changed files with 6 additions and 2 deletions
|
@ -1262,7 +1262,7 @@ class PysolMenubarTkCommon:
|
||||||
|
|
||||||
def updateFavoriteGamesMenu(self):
|
def updateFavoriteGamesMenu(self):
|
||||||
gameids = self.app.opt.favorite_gameid
|
gameids = self.app.opt.favorite_gameid
|
||||||
submenu = self.menupath[".menubar.file.favoritegames"][2]
|
menu, index, submenu = self.menupath[".menubar.file.favoritegames"]
|
||||||
games = []
|
games = []
|
||||||
for id in gameids:
|
for id in gameids:
|
||||||
gi = self.app.getGameInfo(id)
|
gi = self.app.getGameInfo(id)
|
||||||
|
@ -1273,8 +1273,12 @@ class PysolMenubarTkCommon:
|
||||||
return gi.name
|
return gi.name
|
||||||
|
|
||||||
games.sort(key=sort_func)
|
games.sort(key=sort_func)
|
||||||
self.updateGamesMenu(submenu, games)
|
|
||||||
state = self._getEnabledState
|
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
|
in_favor = self.app.game.id in gameids
|
||||||
menu, index, submenu = self.menupath[".menubar.file.addtofavorites"]
|
menu, index, submenu = self.menupath[".menubar.file.addtofavorites"]
|
||||||
menu.entryconfig(index, state=state(not in_favor))
|
menu.entryconfig(index, state=state(not in_favor))
|
||||||
|
|
Loading…
Add table
Reference in a new issue