Fix selecting next game
This commit is contained in:
1 parent
826b6647d0
commit
fb10d2ae78
2 files changed
+11
-9
No files matched your search
@@ -294,16 +294,18 @@ class GameSelector:
|
||||
return first_game
|
||||
return self._games[self._selection]
|
||||
|
||||
def get_next_selection(self) -> Optional[Game]:
|
||||
def select_next(self) -> Optional[Game]:
|
||||
current = self._list.curselection()
|
||||
if not current:
|
||||
return self.get_selection()
|
||||
game_name = self._list.get(current[0]+1)
|
||||
if game_name:
|
||||
return self._games[game_name]
|
||||
else:
|
||||
next_idx = current[0]+1
|
||||
game_name = self._list.get(next_idx)
|
||||
if not game_name:
|
||||
# this was the last game on the list
|
||||
return None
|
||||
self._list.selection_set(next_idx)
|
||||
self._selection = game_name
|
||||
return self._games[game_name]
|
||||
|
||||
|
||||
class _BaseVars(TypedDict):
|
||||
@@ -856,9 +858,9 @@ if __name__ == "__main__":
|
||||
create_game(491115, "Paladins"),
|
||||
# create_game(460630, "Tom Clancy's Rainbow Six Siege"),
|
||||
])
|
||||
gui.games.get_next_selection()
|
||||
gui.games.get_next_selection()
|
||||
gui.games.get_next_selection()
|
||||
gui.games.select_next()
|
||||
gui.games.select_next()
|
||||
gui.games.select_next()
|
||||
# Channel list
|
||||
gui.channels.display(create_channel("PaladinsGame", 0, None, 0, 0))
|
||||
channel = create_channel("Traitus", 1, None, 0, 0)
|
||||
|
||||
Reference in new issue
Block a user