make channel list's display add channels only on explicit add
This commit is contained in:
1 parent
3ccbd4c3db
commit
473af57aeb
3 files changed
+10
-10
No files matched your search
+2
-2
@@ -179,8 +179,8 @@ class Channel:
|
|||||||
return self._stream.drops_enabled
|
return self._stream.drops_enabled
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def display(self):
|
def display(self, *, add: bool = False):
|
||||||
self._gui_channels.display(self)
|
self._gui_channels.display(self, add=add)
|
||||||
|
|
||||||
def remove(self):
|
def remove(self):
|
||||||
if self._pending_stream_up is not None:
|
if self._pending_stream_up is not None:
|
||||||
|
|||||||
@@ -676,7 +676,7 @@ class ChannelList:
|
|||||||
def clear_selection(self):
|
def clear_selection(self):
|
||||||
self._table.selection_set('')
|
self._table.selection_set('')
|
||||||
|
|
||||||
def display(self, channel: Channel):
|
def display(self, channel: Channel, *, add: bool = False):
|
||||||
# priority
|
# priority
|
||||||
priority = "✔" if channel.priority else "❌"
|
priority = "✔" if channel.priority else "❌"
|
||||||
# status
|
# status
|
||||||
@@ -707,7 +707,7 @@ class ChannelList:
|
|||||||
self._set(iid, "priority", priority)
|
self._set(iid, "priority", priority)
|
||||||
if points != '': # we still want to display 0
|
if points != '': # we still want to display 0
|
||||||
self._set(iid, "points", points)
|
self._set(iid, "points", points)
|
||||||
else:
|
elif add:
|
||||||
self._channel_map[iid] = channel
|
self._channel_map[iid] = channel
|
||||||
self._insert(
|
self._insert(
|
||||||
iid,
|
iid,
|
||||||
|
|||||||
@@ -292,7 +292,7 @@ class Twitch:
|
|||||||
channel_id = channel.id
|
channel_id = channel.id
|
||||||
if channel_id not in self.channels:
|
if channel_id not in self.channels:
|
||||||
self.channels[channel_id] = channel
|
self.channels[channel_id] = channel
|
||||||
channel.display()
|
channel.display(add=True)
|
||||||
# Subscribe to these channel's state updates
|
# Subscribe to these channel's state updates
|
||||||
topics: List[WebsocketTopic] = [
|
topics: List[WebsocketTopic] = [
|
||||||
WebsocketTopic(
|
WebsocketTopic(
|
||||||
@@ -599,13 +599,13 @@ class Twitch:
|
|||||||
# }
|
# }
|
||||||
msg_type = message["type"]
|
msg_type = message["type"]
|
||||||
if msg_type == "points-earned":
|
if msg_type == "points-earned":
|
||||||
data = message["data"]
|
data: JsonType = message["data"]
|
||||||
channel = self.channels.get(int(data["channel_id"]))
|
channel: Optional[Channel] = self.channels.get(int(data["channel_id"]))
|
||||||
points = data["point_gain"]["total_points"]
|
points: int = data["point_gain"]["total_points"]
|
||||||
balance = data["balance"]["balance"]
|
balance: int = data["balance"]["balance"]
|
||||||
if channel is not None:
|
if channel is not None:
|
||||||
channel.points = balance
|
channel.points = balance
|
||||||
self.gui.channels.display(channel)
|
channel.display()
|
||||||
self.gui.print(f"Earned points for watching: {points:3}, total: {balance}")
|
self.gui.print(f"Earned points for watching: {points:3}, total: {balance}")
|
||||||
elif msg_type == "claim-available":
|
elif msg_type == "claim-available":
|
||||||
claim_data = message["data"]["claim"]
|
claim_data = message["data"]["claim"]
|
||||||
|
|||||||
Reference in new issue
Block a user