Mercurial > libervia-desktop-kivy
comparison cagou/core/cagou_main.py @ 229:ab523cc967bb
core(notification): display a warning and disable notifications if something is going wrong
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 02 Jul 2018 08:22:11 +0200 |
parents | e702228b655a |
children | f555b10712d7 |
comparison
equal
deleted
inserted
replaced
228:e702228b655a | 229:ab523cc967bb |
---|---|
816 log.warning(_(u"unknown dialog type: {dialog_type}").format(dialog_type=type)) | 816 log.warning(_(u"unknown dialog type: {dialog_type}").format(dialog_type=type)) |
817 | 817 |
818 | 818 |
819 def desktop_notif(self, message, title=u'', duration=5000): | 819 def desktop_notif(self, message, title=u'', duration=5000): |
820 if notification is not None: | 820 if notification is not None: |
821 notification.notify(title=title, | 821 try: |
822 message=message, | 822 notification.notify(title=title, |
823 app_name=C.APP_NAME, | 823 message=message, |
824 app_icon=self.app.icon, | 824 app_name=C.APP_NAME, |
825 timeout = duration) | 825 app_icon=self.app.icon, |
826 timeout = duration) | |
827 except Exception as e: | |
828 log.warning(_(u"Can't use notifications, disabling: {msg}").format( | |
829 msg = e)) | |
830 global notification | |
831 notification = None |