Mercurial > libervia-desktop-kivy
comparison cagou/core/cagou_main.py @ 184:c63922860f80
chat: show desktop notification and/or note when suitable
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 10 May 2018 08:32:46 +0200 |
parents | 2cfef8fbfd4e |
children | 0abd24ab81b1 |
comparison
equal
deleted
inserted
replaced
183:6f09bc00a9e7 | 184:c63922860f80 |
---|---|
64 import glob | 64 import glob |
65 import cagou.plugins | 65 import cagou.plugins |
66 import cagou.kv | 66 import cagou.kv |
67 from kivy import utils as kivy_utils | 67 from kivy import utils as kivy_utils |
68 import sys | 68 import sys |
69 try: | |
70 from plyer import notification | |
71 except ImportError: | |
72 notification = None | |
73 log.warning(_(u"Can't import plyer, some features disabled")) | |
69 | 74 |
70 # we want white background by default | 75 # we want white background by default |
71 Window.clearcolor = (1, 1, 1, 1) | 76 Window.clearcolor = (1, 1, 1, 1) |
72 | 77 |
73 | 78 |
725 | 730 |
726 def showDialog(self, message, title, type="info", answer_cb=None, answer_data=None): | 731 def showDialog(self, message, title, type="info", answer_cb=None, answer_data=None): |
727 # TODO | 732 # TODO |
728 log.info(u"FIXME: showDialog not implemented") | 733 log.info(u"FIXME: showDialog not implemented") |
729 log.info(u"message: {} -- {}".format(title, message)) | 734 log.info(u"message: {} -- {}".format(title, message)) |
735 | |
736 | |
737 def desktop_notif(self, message, title=u'', duration=5000): | |
738 if notification is not None: | |
739 notification.notify(title=title, | |
740 message=message, | |
741 app_name=C.APP_NAME, | |
742 app_icon=self.app.icon, | |
743 timeout = duration) |