def init(self): self = objc.super(NotificationManager, self).init() self.notification_center = NSUserNotificationCenter.defaultUserNotificationCenter( ) self.notification_center.setDelegate_(self) myDict = NSDictionary.dictionary() return self
def show(self, title, text): notification = NSUserNotification.alloc().init() notification.setTitle_(str(title)) #notification.setIdentifier_("ID_1") notification.setInformativeText_(str(text)) notification.setSoundName_("NSUserNotificationDefaultSoundName") notification.setHasActionButton_(False) #notification.setActionButtonTitle_("View") payload = NSDictionary.dictionary() notification.setUserInfo_(payload) self.notification_center.scheduleNotification_(notification) return notification