Mercurial > libervia-desktop-kivy
comparison 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 |
comparison
equal
deleted
inserted
replaced
395:c04c3b167cb0 | 396:ae6f7fd1cb0e |
---|---|
1034 self.showExtraUI(share_wid) | 1034 self.showExtraUI(share_wid) |
1035 except Exception as e: | 1035 except Exception as e: |
1036 log.error(e) | 1036 log.error(e) |
1037 self.closeUI() | 1037 self.closeUI() |
1038 | 1038 |
1039 def notify(self, type_, entity=None, message=None, subject=None, callback=None, | |
1040 cb_args=None, widget=None, profile=C.PROF_KEY_NONE): | |
1041 super().notify( | |
1042 type_=type_, entity=entity, message=message, subject=subject, | |
1043 callback=callback, cb_args=cb_args, widget=widget, profile=profile) | |
1044 self.desktop_notif(message, title=subject) | |
1045 | |
1039 def desktop_notif(self, message, title='', duration=5000): | 1046 def desktop_notif(self, message, title='', duration=5000): |
1040 global notification | 1047 global notification |
1041 if notification is not None: | 1048 if notification is not None: |
1042 try: | 1049 try: |
1050 log.debug( | |
1051 f"sending desktop notification (duration: {duration}):\n" | |
1052 f"{title}\n" | |
1053 f"{message}" | |
1054 ) | |
1043 notification.notify(title=title, | 1055 notification.notify(title=title, |
1044 message=message, | 1056 message=message, |
1045 app_name=C.APP_NAME, | 1057 app_name=C.APP_NAME, |
1046 app_icon=self.app.icon, | 1058 app_icon=self.app.icon, |
1047 timeout = duration) | 1059 timeout=duration) |
1048 except Exception as e: | 1060 except Exception as e: |
1049 log.warning(_("Can't use notifications, disabling: {msg}").format( | 1061 log.warning(_("Can't use notifications, disabling: {msg}").format( |
1050 msg = e)) | 1062 msg = e)) |
1051 notification = None | 1063 notification = None |
1052 | 1064 |