diff options
author | Livio Recchia <recchialivio@libero.it> | 2020-02-10 23:06:34 +0100 |
---|---|---|
committer | Livio Recchia <recchialivio@libero.it> | 2020-02-10 23:06:34 +0100 |
commit | 9a13903a2f7d3a65fdf15a65fb59cccd622e2066 (patch) | |
tree | 9403b7dff39eb5e5d7fa0f79efb69b496add4c4b /external/plyer/platforms/macosx/notification.py | |
parent | 11cc316b74d5f3f283413a33e7693b314741aa4a (diff) | |
download | manachat-9a13903a2f7d3a65fdf15a65fb59cccd622e2066.tar.gz manachat-9a13903a2f7d3a65fdf15a65fb59cccd622e2066.tar.bz2 manachat-9a13903a2f7d3a65fdf15a65fb59cccd622e2066.tar.xz manachat-9a13903a2f7d3a65fdf15a65fb59cccd622e2066.zip |
Initial commit
Diffstat (limited to 'external/plyer/platforms/macosx/notification.py')
-rw-r--r-- | external/plyer/platforms/macosx/notification.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/external/plyer/platforms/macosx/notification.py b/external/plyer/platforms/macosx/notification.py new file mode 100644 index 0000000..a52ebe3 --- /dev/null +++ b/external/plyer/platforms/macosx/notification.py @@ -0,0 +1,27 @@ +from plyer.facades import Notification +import Foundation +import objc +import AppKit + + +class OSXNotification(Notification): + def _notify(self, **kwargs): + NSUserNotification = objc.lookUpClass('NSUserNotification') + NSUserNotificationCenter = objc.lookUpClass('NSUserNotificationCenter') + notification = NSUserNotification.alloc().init() + notification.setTitle_(kwargs.get('title').encode('utf-8')) + #notification.setSubtitle_(str(subtitle)) + notification.setInformativeText_(kwargs.get('message').encode('utf-8')) + notification.setSoundName_("NSUserNotificationDefaultSoundName") + #notification.setHasActionButton_(False) + #notification.setOtherButtonTitle_("View") + #notification.setUserInfo_({"action":"open_url", "value":url}) + NSUserNotificationCenter.defaultUserNotificationCenter() \ + .setDelegate_(self) + NSUserNotificationCenter.defaultUserNotificationCenter() \ + .scheduleNotification_(notification) + + +def instance(): + return OSXNotification() + |