blob: dccffe4fc0d9ddfe40329cfe9d95400be46bfb64 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
from Foundation import *
from AppKit import *
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!')
|