Add a missing status update in on_online;

redesign the watching status if statement
This commit is contained in:
DevilXD committed 2022-09-02 13:21:03 +02:00
1 parent 1f4a177906
commit c665d81f70
1 file changed
+15 -10
+15 -10
View File
@@ -379,23 +379,25 @@ class Twitch:
new_watching = channel new_watching = channel
break break
watching_channel = self.watching_channel.get_with_default(None) watching_channel = self.watching_channel.get_with_default(None)
if watching_channel is None and new_watching is None:
# not watching anything and there isn't anything to watch either
self.gui.print(_("status", "no_channel"))
self.change_state(State.IDLE)
else:
if new_watching is not None: if new_watching is not None:
# if we have a better switch target - do so # if we have a better switch target - do so
# otherwise, continue watching what we had before
self.watch(new_watching) self.watch(new_watching)
# should immediately complete, since we'll definitely self.gui.status.update(
# have a channel we're watching here _("gui", "status", "watching").format(channel=new_watching.name)
watching_channel = await self.watching_channel.get() )
# break the state change chain by clearing the flag
self._state_change.clear()
elif watching_channel is not None:
# otherwise, continue watching what we had before
self.gui.status.update( self.gui.status.update(
_("gui", "status", "watching").format(channel=watching_channel.name) _("gui", "status", "watching").format(channel=watching_channel.name)
) )
# break the state change chain by clearing the flag # break the state change chain by clearing the flag
self._state_change.clear() self._state_change.clear()
else:
# not watching anything and there isn't anything to watch either
self.gui.print(_("status", "no_channel"))
self.change_state(State.IDLE)
elif self._state is State.EXIT: elif self._state is State.EXIT:
self.gui.status.update(_("gui", "status", "exiting")) self.gui.status.update(_("gui", "status", "exiting"))
# we've been requested to exit the application # we've been requested to exit the application
@@ -580,8 +582,11 @@ class Twitch:
self.can_watch(channel) # we can watch the channel that just got ONLINE self.can_watch(channel) # we can watch the channel that just got ONLINE
and self.should_switch(channel) # and we should! and self.should_switch(channel) # and we should!
): ):
self.gui.print(_("status", "goes_online").format(channel=channel.name))
self.watch(channel) self.watch(channel)
self.gui.print(_("status", "goes_online").format(channel=channel.name))
self.gui.status.update(
_("gui", "status", "watching").format(channel=channel.name)
)
def on_offline(self, channel: Channel): def on_offline(self, channel: Channel):
""" """