modify tray.notify to return a task for cancelling purposes

This commit is contained in:
DevilXD
2022-04-02 17:05:55 +02:00
parent a45a97f193
commit cbb59c3e98

7
gui.py
View File

@@ -824,7 +824,9 @@ class TrayIcon:
self.stop()
self._manager._root.deiconify()
def notify(self, message: str, title: str | None = None, duration: float = 10):
def notify(
self, message: str, title: str | None = None, duration: float = 10
) -> asyncio.Task[None] | None:
if self.icon is not None:
icon = self.icon
@@ -833,7 +835,8 @@ class TrayIcon:
await asyncio.sleep(duration)
icon.remove_notification()
asyncio.create_task(notifier())
return asyncio.create_task(notifier())
return None
def update_title(self, drop: TimedDrop):
if self.icon is not None: