Add about dialogue
authorAndrew Flegg <andrew@bleb.org>
Thu, 10 Jun 2010 14:55:11 +0000 (15:55 +0100)
committerAndrew Flegg <andrew@bleb.org>
Thu, 10 Jun 2010 14:55:11 +0000 (15:55 +0100)
package/src/org/bleb/wimpworks.py
package/src/org/maemo/hermes/gui/gtkui.py

index 094186b..29c3fd6 100644 (file)
@@ -56,6 +56,7 @@ class WimpWorks:
         self.name = application
         self.dbus_name = dbus_name
         self.menu = None
+        self.version = version
         
         if _have_gconf:
             self.gconf = gnome.gconf.client_get_default()
index fa72817..26f045e 100644 (file)
@@ -6,6 +6,7 @@ import thread
 import urllib2
 import hildon
 import conic
+import webbrowser
 from org.bleb.wimpworks import WimpWorks
 from org.maemo.hermes.gui.contactview import ContactView
 from org.maemo.hermes.gui.mapcontact import MapContact
@@ -33,6 +34,7 @@ class HermesGUI(WimpWorks):
         layout.add_button('Refresh', _("Update contacts' info"))
         
         self.add_menu_action("Accounts")
+        self.add_menu_action("About")
         self.menu.show_all()
         
         self.providers = providers
@@ -55,6 +57,54 @@ class HermesGUI(WimpWorks):
     def do_accounts(self, widget = None):
         dialog = AccountsDialogue(self.main_window, self.providers)
         dialog.show()
+
+
+    # -----------------------------------------------------------------------
+    def do_about(self, widget):
+        """Inspired by HeAboutDialog Python port:
+           http://wiki.maemo.org/Hildon-Extras#HeAboutDialog"""
+
+        dlg = gtk.Dialog(_("About"), self.main_window)
+
+        icon = gtk.Image()
+        icon.set_from_icon_name(self.name.lower(), gtk.ICON_SIZE_DIALOG)
+        icon.set_padding(5, 5)
+
+        name = gtk.Label(self.name)
+        name.set_alignment(0, 1)
+        hildon.hildon_helper_set_logical_font(name, 'X-LargeSystemFont')
+
+        version = gtk.Label('v%s' % (self.version))
+        version.set_alignment(0, 1)
+        version.set_padding(10, 0)
+        hildon.hildon_helper_set_logical_font(version, 'LargeSystemFont')
+        
+        desc = gtk.Label(_("Enrich contacts' from social networks."))
+        desc.set_alignment(0, 0)
+
+        copy = gtk.Label("Copyright (c) 2010 Andrew Flegg, Fredrik Wendt, Tim Samoff")
+        copy.set_alignment(0, 1)
+        copy.set_padding(0, 5)
+        hildon.hildon_helper_set_logical_font(copy, 'SmallSystemFont')
+        hildon.hildon_helper_set_logical_color(copy, gtk.RC_FG, gtk.STATE_NORMAL, "SecondaryTextColor")
+
+        layout = gtk.Table(3, 3, False)
+        layout.attach(icon, 0, 1, 0, 2, 0, gtk.EXPAND, 0, 0)
+        layout.attach(name, 1, 2, 0, 1, 0, gtk.EXPAND | gtk.FILL, 0, 0)
+        layout.attach(version, 2, 3, 0, 1, gtk.EXPAND | gtk.FILL, gtk.EXPAND | gtk.FILL, 0, 0)
+        layout.attach(desc, 1, 3, 1, 2, gtk.EXPAND | gtk.FILL, gtk.EXPAND | gtk.FILL, 0, 0)
+        layout.attach(copy, 0, 3, 2, 3, gtk.EXPAND | gtk.FILL, gtk.EXPAND | gtk.FILL, 0, 0)
+        dlg.vbox.add(layout)
+
+        dlg.add_button(_('Visit website'), gtk.RESPONSE_APPLY)
+        dlg.add_button(_('Report bug'), gtk.RESPONSE_NO)
+        dlg.show_all()
+        response = dlg.run()
+        if response == gtk.RESPONSE_APPLY:
+            webbrowser.open('http://hermes.garage.maemo.org/')
+        elif response == gtk.RESPONSE_NO:
+            webbrowser.open('https://bugs.maemo.org/enter_bug.cgi?product=Hermes')
+        dlg.hide()
    
 
     # -----------------------------------------------------------------------