2 # Based on C code from:
3 # "Hildon Tutorial" version 2009-04-28
4 # Example 3.1, "Example of a Hildon application menu"
13 about_name = 'mEveMon'
14 about_text = ('Mobile character monitor for EVE Online')
15 about_authors = ['Ryan Campbell']
16 about_website = 'http://example.site.org'
19 menu_items = ("Settings", "About", "Refresh")
22 program = hildon.Program.get_instance()
24 gtk.set_application_name("mEveMon")
26 #create the main window
27 win = hildon.StackableWindow()
28 win.connect("destroy", gtk.main_quit, None)
31 menu = create_menu(win)
32 # Attach menu to the window
33 win.set_app_menu(menu)
35 pannable_area = hildon.PannableArea()
36 table = create_table(win)
38 pannable_area.add_with_viewport(table)
40 win.add(pannable_area);
44 def settings_clicked(button, window):
48 dialog.set_transient_for(window)
49 dialog.set_title("Settings")
55 def about_clicked(button):
57 dialog = gtk.AboutDialog()
58 dialog.set_website(about_website)
59 dialog.set_website_label(about_website)
60 dialog.set_name(about_name)
61 dialog.set_authors(about_authors)
62 dialog.set_comments(about_text)
63 dialog.set_version(app_version)
67 def refresh_clicked(button, window):
71 def create_menu(window):
73 menu = hildon.AppMenu()
75 for command in menu_items:
77 button = hildon.GtkButton(gtk.HILDON_SIZE_AUTO)
78 button.set_label(command)
80 if command == "About":
81 button.connect("clicked", about_clicked)
82 elif command == "Settings":
83 button.connect("clicked", settings_clicked, window)
84 elif command == "Refresh":
85 button.connect("clicked", refresh_clicked, window)
89 # Add entry to the view menu
96 def create_table(window):
98 # create a table of 10 by 10 squares.
99 table = gtk.Table (1, 10, False)
102 # this simply creates a grid of toggle buttons on the table
103 # to demonstrate the scrolled window.
105 data_buffer = "button %d\n" % i
106 button = gtk.ToggleButton(data_buffer)
107 table.attach(button, 0, 1 , i, i+1)
112 if __name__ == "__main__":