Only triggere a game select state change when the selection actually changes
This commit is contained in:
1 parent
1f43702839
commit
1134dfcef3
1 file changed
+4
-6
@@ -250,10 +250,6 @@ class GameSelector:
|
||||
self._games: OrderedDict[str, Game] = OrderedDict()
|
||||
self._list.bind("<<ListboxSelect>>", self._on_select)
|
||||
|
||||
@property
|
||||
def selected(self) -> Optional[str]:
|
||||
return self._selection
|
||||
|
||||
def set_games(self, games: Iterable[Game]):
|
||||
self._games.clear()
|
||||
self._games.update((str(g), g) for g in sorted(games, key=lambda g: g.name))
|
||||
@@ -280,9 +276,11 @@ class GameSelector:
|
||||
current = self._list.curselection()
|
||||
if not current:
|
||||
# can happen when the user clicks on an empty list
|
||||
self._selection = None
|
||||
new_selection = None
|
||||
else:
|
||||
self._selection = self._list.get(current[0])
|
||||
new_selection = self._list.get(current[0])
|
||||
if new_selection != self._selection:
|
||||
self._selection = new_selection
|
||||
self._manager._twitch.change_state(State.GAME_SELECT)
|
||||
|
||||
def get_selection(self) -> Game:
|
||||
|
||||
Reference in new issue
Block a user