4 import ui.models as models
5 import ui.fremantle.dialogs as dialogs
8 class Menu(hildon.AppMenu):
9 MENU_ITEMS = { "Settings": 'on_settings_clicked',
10 "About": 'on_about_clicked',
11 "Refresh": 'on_refresh_clicked' }
12 def __init__(self, win, controller):
13 hildon.AppMenu.__init__(self)
15 self.controller = controller
18 def build_buttons(self):
19 for button_name in self.MENU_ITEMS:
20 self.create_menu_button(button_name)
23 def create_menu_button(self, name):
24 button = hildon.GtkButton(gtk.HILDON_SIZE_AUTO)
25 button.set_label(name)
26 button.connect("clicked", getattr(self, self.MENU_ITEMS[name]))
29 def on_refresh_clicked(self, button):
32 def on_settings_clicked(self, button):
33 setting_dialog = dialogs.SettingsDialog(self.win, self.controller)
36 def on_about_clicked(self, button):
37 dialog = gtk.AboutDialog()
38 dialog.set_website(constants.ABOUT_WEBSITE)
39 dialog.set_website_label(constants.ABOUT_WEBSITE)
40 dialog.set_name(constants.ABOUT_NAME)
41 dialog.set_authors(constants.ABOUT_AUTHORS)
42 dialog.set_comments(constants.ABOUT_TEXT)
43 dialog.set_version(constants.APP_VERSION)
47 def report_error(self, error):
48 hildon.hildon_banner_show_information(self.win, '', error)