Ensure CHANNEL_SWITCH preserves currently watched channel
This commit is contained in:
1 parent
b17127aabc
commit
17dc4b2c30
1 file changed
+8
-4
@@ -280,14 +280,18 @@ class Twitch:
|
|||||||
if selected_game is None:
|
if selected_game is None:
|
||||||
self.change_state(State.GAME_SELECT)
|
self.change_state(State.GAME_SELECT)
|
||||||
else:
|
else:
|
||||||
# Change into the selected channel
|
# Change into the selected channel, stay in the watching channel,
|
||||||
|
# or select a new channel that meets the required conditions
|
||||||
channels: Iterable[Channel]
|
channels: Iterable[Channel]
|
||||||
|
priority_channels: List[Channel] = []
|
||||||
selected_channel = self.gui.channels.get_selection()
|
selected_channel = self.gui.channels.get_selection()
|
||||||
if selected_channel is not None:
|
if selected_channel is not None:
|
||||||
self.gui.channels.clear_selection()
|
self.gui.channels.clear_selection()
|
||||||
channels = chain([selected_channel], self.channels.values())
|
priority_channels.append(selected_channel)
|
||||||
else:
|
watching_channel = self._watching_channel.get_with_default(None)
|
||||||
channels = self.channels.values()
|
if watching_channel is not None:
|
||||||
|
priority_channels.append(watching_channel)
|
||||||
|
channels = chain(priority_channels, self.channels.values())
|
||||||
# If there's no selected channel, change into a channel we can watch
|
# If there's no selected channel, change into a channel we can watch
|
||||||
for channel in channels:
|
for channel in channels:
|
||||||
if (
|
if (
|
||||||
|
|||||||
Reference in new issue
Block a user