From 4602b9773fa780640d7bd6a944e0778afcd96db6 Mon Sep 17 00:00:00 2001 From: Dmitry Moiseev Date: Fri, 17 Jan 2014 17:11:44 +0600 Subject: Moved StatusApp(NSApplication) class to separate fil --- StatusAppMac.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 StatusAppMac.py diff --git a/StatusAppMac.py b/StatusAppMac.py new file mode 100644 index 0000000..fc0bc64 --- /dev/null +++ b/StatusAppMac.py @@ -0,0 +1,25 @@ +import objc +from Foundation import * +from AppKit import * +from PyObjCTools import AppHelper + +class StatusApp(NSApplication): + + def initMenu(self,menu): + statusbar = NSStatusBar.systemStatusBar() + self.statusitem = statusbar.statusItemWithLength_(NSVariableStatusItemLength) + + self.mymenu = menu + #add menu to statusitem + self.statusitem.setMenu_(menu.menubarMenu) + self.statusitem.setToolTip_('Parrot Zik Indicator') + + def setIcon(self,icon,icon_directory): + self.icon = NSImage.alloc().initByReferencingFile_(icon_directory+icon+'.png') + self.icon.setScalesWhenResized_(True) + self.icon.setSize_((20, 20)) + self.statusitem.setImage_(self.icon) + + def clicked_(self, notification): + self.mymenu.actions[notification._.title]() + NSLog('clicked!') \ No newline at end of file -- cgit v1.2.1