EVE image server URL changed with new patch, updated fetchimg to reflect the new...
[mevemon] / package / src / ui / fremantle / menu.py
1 import hildon
2 import gtk
3
4 import ui.models as models
5 import ui.fremantle.dialogs as dialogs
6 import constants
7
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)
14         self.win = win
15         self.controller = controller
16         self.build_buttons()
17
18     def build_buttons(self):
19         for button_name in self.MENU_ITEMS:
20             self.create_menu_button(button_name)
21         self.show_all()
22
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]))
27         self.append(button)
28
29     def on_refresh_clicked(self, button):
30         pass
31
32     def on_settings_clicked(self, button):
33         setting_dialog = dialogs.SettingsDialog(self.win, self.controller)
34
35     
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)
44         dialog.run()
45         dialog.destroy()
46
47     def report_error(self, error):
48         hildon.hildon_banner_show_information(self.win, '', error)