usr bin env python import pygtk pygtk require import gtk import appind

 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import gtk
import appindicator
class AppIndicatorExample:
def __init__(self):
self.ind = appindicator.Indicator("example-simple-client", "/home/chmod/man_on.gif", appindicator.CATEGORY_HARDWARE)
self.ind.set_status(appindicator.STATUS_ACTIVE)
self.ind.set_label("TEST")
self.ind.set_attention_icon("indicator-messages-new")
# create a menu
self.menu = gtk.Menu()
# create items for the menu - labels, checkboxes, radio buttons and images are supported:
#~ item = gtk.MenuItem("Regular Menu Item")
#~ item.show()
#~ self.menu.append(item)
#~ check = gtk.CheckMenuItem("Check Menu Item")
#~ check.show()
#~ self.menu.append(check)
#~ radio = gtk.RadioMenuItem(None, "Radio Menu Item")
#~ radio.show()
#~ self.menu.append(radio)
image = gtk.ImageMenuItem("TEST")
image.connect("activate", self.test)
image.show()
self.menu.append(image)
image = gtk.ImageMenuItem(gtk.STOCK_QUIT)
image.connect("activate", self.quit)
image.show()
self.menu.append(image)
self.menu.show()
self.ind.set_menu(self.menu)
def quit(self, widget, data=None):
gtk.main_quit()
def test(self, widget, data=None):
self.ind.set_label("TEST2")
def main():
gtk.main()
return 0
if __name__ == "__main__":
indicator = AppIndicatorExample()
main()