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
60
61
62
63
64
65
66
67
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import pygtk
pygtk.require('2.0')
import gtk
import appindicator

class TestIndicator:
    def __init__(self):
        #We're using the gnome-do icon for testing.
        self.indicator = appindicator.Indicator('testindicator', 
                                                'gnome-do-symbolic', 
                                                appindicator.CATEGORY_APPLICATION_STATUS)
        self.indicator.set_status(appindicator.STATUS_ACTIVE)
        self.indicator.set_icon('gnome-do-symbolic')

        #Create a menu to hold our stuff
        self.menu = gtk.Menu()

        #And now populate said menu

        #Here's where I try to cram all kinds of weird widgets into the menu.
        #I can tell from experience that neither progressbar or button works.
        item = gtk.MenuItem()
        button = gtk.ProgressBar()
        button.pulse()
        button.show()
        item.add(button)
        item.show()
        self.menu.append(item)

        #A separator, because I like to keep things neat.
        item = gtk.SeparatorMenuItem()
        item.show()
        self.menu.append(item)

        #Preferences button
        item = gtk.ImageMenuItem(gtk.STOCK_PREFERENCES)
        item.connect('activate', self.showPreferences)
        item.show()
        self.menu.append(item)

        #Quit button
        item = gtk.ImageMenuItem(gtk.STOCK_QUIT)
        item.connect('activate', self.quit)
        item.show()
        self.menu.append(item)

        self.menu.show()
        self.indicator.set_menu(self.menu)

    def showPreferences(self, widget, data=None ):
        '''Shows the preferences window'''
        print('Does nothing, for the time being.')

    def quit(self, widget, data=None):
        '''Quits the application cleanly'''
        gtk.main_quit()

def main():
    indicator = TestIndicator()
    gtk.main()
    return 0

if __name__ == '__main__':
    main()