Mercurial > libervia-desktop-kivy
diff cagou/core/cagou_main.py @ 396:ae6f7fd1cb0e
chat: use QuickApp.notify and clear notifications when selected.
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 09 Feb 2020 23:47:29 +0100 |
parents | de066b72f5a8 |
children | 672880661797 |
line wrap: on
line diff
--- a/cagou/core/cagou_main.py Thu Feb 06 21:16:21 2020 +0100 +++ b/cagou/core/cagou_main.py Sun Feb 09 23:47:29 2020 +0100 @@ -1036,15 +1036,27 @@ log.error(e) self.closeUI() + def notify(self, type_, entity=None, message=None, subject=None, callback=None, + cb_args=None, widget=None, profile=C.PROF_KEY_NONE): + super().notify( + type_=type_, entity=entity, message=message, subject=subject, + callback=callback, cb_args=cb_args, widget=widget, profile=profile) + self.desktop_notif(message, title=subject) + def desktop_notif(self, message, title='', duration=5000): global notification if notification is not None: try: + log.debug( + f"sending desktop notification (duration: {duration}):\n" + f"{title}\n" + f"{message}" + ) notification.notify(title=title, message=message, app_name=C.APP_NAME, app_icon=self.app.icon, - timeout = duration) + timeout=duration) except Exception as e: log.warning(_("Can't use notifications, disabling: {msg}").format( msg = e))