modify tray.notify to return a task for cancelling purposes

This commit is contained in:
DevilXD committed 2022-04-02 17:05:55 +02:00
1 parent a45a97f193
commit cbb59c3e98
1 file changed
+5 -2
+5 -2
View File
@@ -824,7 +824,9 @@ class TrayIcon:
self.stop() self.stop()
self._manager._root.deiconify() 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: if self.icon is not None:
icon = self.icon icon = self.icon
@@ -833,7 +835,8 @@ class TrayIcon:
await asyncio.sleep(duration) await asyncio.sleep(duration)
icon.remove_notification() icon.remove_notification()
asyncio.create_task(notifier()) return asyncio.create_task(notifier())
return None
def update_title(self, drop: TimedDrop): def update_title(self, drop: TimedDrop):
if self.icon is not None: if self.icon is not None: