diff options
author | Kenneth Skovhede <kenneth@hexad.dk> | 2016-04-13 11:12:28 +0300 |
---|---|---|
committer | Kenneth Skovhede <kenneth@hexad.dk> | 2016-04-13 11:12:28 +0300 |
commit | a2535271f536833aaa24f9334648a5b0c2a28609 (patch) | |
tree | 5e0468d70a800a51f20fd43c3ca8cc6777b48df4 /thirdparty | |
parent | 2e9854c936a1084ebdfb46269bf3847702866b0f (diff) | |
parent | c78dc32fc5e5fa29e1c4421b7d34e91bced5877e (diff) |
Merge branch 'feature/fixes_to_rumps_trayicon'
Diffstat (limited to 'thirdparty')
-rw-r--r-- | thirdparty/rumps/rumps.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/thirdparty/rumps/rumps.py b/thirdparty/rumps/rumps.py index 6ef748225..d1699ab8a 100644 --- a/thirdparty/rumps/rumps.py +++ b/thirdparty/rumps/rumps.py @@ -10,6 +10,7 @@ # # The method _nsimage_from_file has been modified to also allow # loading a manually constructed NSImage +# The notification class has also been modified to allow an image # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - from collections import OrderedDict @@ -94,7 +95,7 @@ def alert(title=None, message='', ok=None, cancel=None): return alert.runModal() -def notification(title, subtitle, message, data=None, sound=True): +def notification(title, subtitle, message, data=None, sound=True, image=None): """Send a notification to Notification Center (Mac OS X 10.8+). If running on a version of Mac OS X that does not support notifications, a ``RuntimeError`` will be raised. Apple says, @@ -121,6 +122,8 @@ def notification(title, subtitle, message, data=None, sound=True): notification.setUserInfo_({} if data is None else data) if sound: notification.setSoundName_("NSUserNotificationDefaultSoundName") + if image != None: + notification.setContentImage_(image) notification.setDeliveryDate_(NSDate.dateWithTimeInterval_sinceDate_(0, NSDate.date())) NSUserNotificationCenter.defaultUserNotificationCenter().scheduleNotification_(notification) |