Add drops column, signifying if drops are enabled or not
This commit is contained in:
1 parent
0b8e0211ff
commit
0388fdc290
1 file changed
+51
-12
@@ -552,6 +552,7 @@ class ChannelList:
|
|||||||
self._add_column("channel", "Channel", width=100, anchor='w')
|
self._add_column("channel", "Channel", width=100, anchor='w')
|
||||||
self._add_column("status", "Status", width_template="OFFLINE ❌")
|
self._add_column("status", "Status", width_template="OFFLINE ❌")
|
||||||
self._add_column("game", "Game", width=50)
|
self._add_column("game", "Game", width=50)
|
||||||
|
self._add_column("drops", "🎁", width_template="✔")
|
||||||
self._add_column("viewers", "Viewers", width_template="1234567")
|
self._add_column("viewers", "Viewers", width_template="1234567")
|
||||||
self._add_column("points", "Points", width_template="1234567")
|
self._add_column("points", "Points", width_template="1234567")
|
||||||
self._add_column("priority", "❗", width_template="✔")
|
self._add_column("priority", "❗", width_template="✔")
|
||||||
@@ -687,6 +688,8 @@ class ChannelList:
|
|||||||
status = "OFFLINE ❌"
|
status = "OFFLINE ❌"
|
||||||
# game
|
# game
|
||||||
game = str(channel.game or '')
|
game = str(channel.game or '')
|
||||||
|
# drops
|
||||||
|
drops = "✔" if channel.drops_enabled else "❌"
|
||||||
# viewers
|
# viewers
|
||||||
viewers = ''
|
viewers = ''
|
||||||
if channel.viewers is not None:
|
if channel.viewers is not None:
|
||||||
@@ -698,6 +701,7 @@ class ChannelList:
|
|||||||
iid = channel.iid
|
iid = channel.iid
|
||||||
if iid in self._channel_map:
|
if iid in self._channel_map:
|
||||||
self._set(iid, "game", game)
|
self._set(iid, "game", game)
|
||||||
|
self._set(iid, "drops", drops)
|
||||||
self._set(iid, "status", status)
|
self._set(iid, "status", status)
|
||||||
self._set(iid, "viewers", viewers)
|
self._set(iid, "viewers", viewers)
|
||||||
self._set(iid, "priority", priority)
|
self._set(iid, "priority", priority)
|
||||||
@@ -708,12 +712,13 @@ class ChannelList:
|
|||||||
self._insert(
|
self._insert(
|
||||||
iid,
|
iid,
|
||||||
{
|
{
|
||||||
"channel": channel.name,
|
|
||||||
"priority": priority,
|
|
||||||
"status": status,
|
|
||||||
"game": game,
|
"game": game,
|
||||||
"viewers": viewers,
|
"drops": drops,
|
||||||
"points": points,
|
"points": points,
|
||||||
|
"status": status,
|
||||||
|
"viewers": viewers,
|
||||||
|
"priority": priority,
|
||||||
|
"channel": channel.name,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -949,10 +954,17 @@ if __name__ == "__main__":
|
|||||||
iid = 0
|
iid = 0
|
||||||
|
|
||||||
def create_channel(
|
def create_channel(
|
||||||
name: str, online: int, game: Optional[str], viewers: int, points: int, priority: bool
|
name: str,
|
||||||
|
status: int,
|
||||||
|
game: Optional[str],
|
||||||
|
drops: bool,
|
||||||
|
viewers: int,
|
||||||
|
points: int,
|
||||||
|
priority: bool,
|
||||||
):
|
):
|
||||||
if online == 1:
|
# status: 0 -> OFFLINE, 1 -> PENDING_ONLINE, 2 -> ONLINE
|
||||||
online = False
|
if status == 1:
|
||||||
|
status = False
|
||||||
pending = True
|
pending = True
|
||||||
else:
|
else:
|
||||||
pending = False
|
pending = False
|
||||||
@@ -965,9 +977,10 @@ if __name__ == "__main__":
|
|||||||
name=name,
|
name=name,
|
||||||
iid=(iid := iid + 1),
|
iid=(iid := iid + 1),
|
||||||
points=points,
|
points=points,
|
||||||
online=bool(online),
|
online=bool(status),
|
||||||
pending_online=pending,
|
pending_online=pending,
|
||||||
game=game_obj,
|
game=game_obj,
|
||||||
|
drops_enabled=drops,
|
||||||
viewers=viewers,
|
viewers=viewers,
|
||||||
priority=priority,
|
priority=priority,
|
||||||
)
|
)
|
||||||
@@ -1023,12 +1036,38 @@ if __name__ == "__main__":
|
|||||||
# create_game(654321, "My Game Very Long Name"),
|
# create_game(654321, "My Game Very Long Name"),
|
||||||
])
|
])
|
||||||
# Channel list
|
# Channel list
|
||||||
gui.channels.display(create_channel("Thomus", 0, None, 0, 0, True))
|
gui.channels.display(
|
||||||
channel = create_channel("Traitus", 1, None, 0, 0, True)
|
create_channel(
|
||||||
|
name="Thomus", status=0, game=None, drops=False, viewers=0, points=0, priority=True
|
||||||
|
)
|
||||||
|
)
|
||||||
|
channel = create_channel(
|
||||||
|
name="Traitus", status=1, game=None, drops=False, viewers=0, points=0, priority=True
|
||||||
|
)
|
||||||
gui.channels.display(channel)
|
gui.channels.display(channel)
|
||||||
gui.channels.set_watching(channel)
|
gui.channels.set_watching(channel)
|
||||||
gui.channels.display(create_channel("Testus", 2, "Best Game", 42, 1234567, False))
|
gui.channels.display(
|
||||||
gui.channels.display(create_channel("Livus", 2, "Best Game", 69, 1234567, False))
|
create_channel(
|
||||||
|
name="Testus",
|
||||||
|
status=2,
|
||||||
|
game="Best Game",
|
||||||
|
drops=True,
|
||||||
|
viewers=42,
|
||||||
|
points=1234567,
|
||||||
|
priority=False,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
gui.channels.display(
|
||||||
|
create_channel(
|
||||||
|
name="Livus",
|
||||||
|
status=2,
|
||||||
|
game="Best Game",
|
||||||
|
drops=True,
|
||||||
|
viewers=69,
|
||||||
|
points=1234567,
|
||||||
|
priority=False,
|
||||||
|
)
|
||||||
|
)
|
||||||
gui._root.update()
|
gui._root.update()
|
||||||
gui.channels.get_selection()
|
gui.channels.get_selection()
|
||||||
# Tray
|
# Tray
|
||||||
|
|||||||
Reference in new issue
Block a user