Include game name in the tray notification and mouse-over title

This commit is contained in:
DevilXD committed 2022-11-30 11:51:49 +01:00
1 parent 36597d9a4a
commit 323de6ed59
2 files changed
+17 -12

No files matched your search

+15 -10
View File
@@ -972,10 +972,12 @@ class TrayIcon:
def get_title(self, drop: TimedDrop | None) -> str: def get_title(self, drop: TimedDrop | None) -> str:
if drop is None: if drop is None:
return self.TITLE return self.TITLE
campaign = drop.campaign
return ( return (
f"{self.TITLE}\n" f"{self.TITLE}\n"
f"{drop.rewards_text()}: {drop.progress:.1%} " f"{campaign.game.name}\n"
f"({drop.campaign.claimed_drops}/{drop.campaign.total_drops})" f"{drop.rewards_text()} "
f"{drop.progress:.1%} ({campaign.claimed_drops}/{campaign.total_drops})"
) )
def start(self): def start(self):
@@ -1875,9 +1877,7 @@ class GUIManager:
tasks = [asyncio.ensure_future(coro), asyncio.ensure_future(self._close_requested.wait())] tasks = [asyncio.ensure_future(coro), asyncio.ensure_future(self._close_requested.wait())]
done: set[asyncio.Task[Any]] done: set[asyncio.Task[Any]]
pending: set[asyncio.Task[Any]] pending: set[asyncio.Task[Any]]
done, pending = await asyncio.wait( # type: ignore done, pending = await asyncio.wait(tasks, return_when=asyncio.FIRST_COMPLETED)
tasks, return_when=asyncio.FIRST_COMPLETED # type: ignore
)
for task in pending: for task in pending:
task.cancel() task.cancel()
if self._close_requested.is_set(): if self._close_requested.is_set():
@@ -2151,15 +2151,20 @@ if __name__ == "__main__":
) )
gui._root.update() gui._root.update()
gui.channels.get_selection() gui.channels.get_selection()
# Tray
# gui.tray.minimize()
await asyncio.sleep(2)
gui.tray.notify("Bounty Coins (3/7)", "Mined Drop")
# Inventory overview # Inventory overview
drop = create_drop( drop = create_drop(
"Wardrobe Cleaning", "Cleaning Masters", ["Fancy Pants"], 2, 7, 239, 240 "Wardrobe Cleaning", "Cleaning Masters", ["Fancy Pants"], 2, 7, 239, 240
) )
await gui.inv.add_campaign(drop.campaign) campaign = drop.campaign
await gui.inv.add_campaign(campaign)
# Tray
# gui.tray.minimize()
await asyncio.sleep(2)
claim_text = (
f"{campaign.game.name}\n"
f"{drop.rewards_text()} ({campaign.claimed_drops}/{campaign.total_drops})"
)
gui.tray.notify(claim_text, "Mined Drop")
# Drop progress # Drop progress
gui.display_drop(drop, countdown=False) gui.display_drop(drop, countdown=False)
+2 -2
View File
@@ -1129,8 +1129,8 @@ class Twitch:
drop.display() drop.display()
if mined: if mined:
claim_text = ( claim_text = (
f"{drop.rewards_text()} " f"{campaign.game.name}\n"
f"({campaign.claimed_drops}/{campaign.total_drops})" f"{drop.rewards_text()} ({campaign.claimed_drops}/{campaign.total_drops})"
) )
self.gui.print(_("status", "claimed_drop").format(drop=claim_text)) self.gui.print(_("status", "claimed_drop").format(drop=claim_text))
self.gui.tray.notify(claim_text, _("gui", "tray", "notification_title")) self.gui.tray.notify(claim_text, _("gui", "tray", "notification_title"))