mirror of
https://github.com/gryf/wicd.git
synced 2026-02-16 14:05:45 +01:00
Don't crash on notification errors
This is not an essential feature, so no need to crash.
This commit is contained in:
@@ -227,15 +227,24 @@ class TrayIcon(object):
|
|||||||
|
|
||||||
def _show_notification(self, title, details, image=None):
|
def _show_notification(self, title, details, image=None):
|
||||||
if self.should_notify:
|
if self.should_notify:
|
||||||
if not self._last_bubble:
|
try:
|
||||||
self._last_bubble = pynotify.Notification(title, details,
|
if not self._last_bubble:
|
||||||
image)
|
self._last_bubble = pynotify.Notification(title, details,
|
||||||
self._last_bubble.show()
|
image)
|
||||||
else:
|
self._last_bubble.show()
|
||||||
self._last_bubble.clear_actions()
|
else:
|
||||||
self._last_bubble.clear_hints()
|
self._last_bubble.clear_actions()
|
||||||
self._last_bubble.update(title, details, image)
|
self._last_bubble.clear_hints()
|
||||||
self._last_bubble.show()
|
self._last_bubble.update(title, details, image)
|
||||||
|
self._last_bubble.show()
|
||||||
|
except Exception, e:
|
||||||
|
if hasattr(e, 'message') and e.message != '':
|
||||||
|
msg = e.message
|
||||||
|
elif hasattr(e, 'args') and len(e.args) > 0:
|
||||||
|
msg = e.args[-1]
|
||||||
|
else:
|
||||||
|
msg = str(e)
|
||||||
|
print "Exception during notification: %s" % msg
|
||||||
|
|
||||||
self.should_notify = False
|
self.should_notify = False
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user