[kupfer/mallard-documentation: 1/7] browser, kupferui: Add menu item for Help
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [kupfer/mallard-documentation: 1/7] browser, kupferui: Add menu item for Help
- Date: Mon, 7 Dec 2009 09:35:30 +0000 (UTC)
commit 895fe3349a6690218a15fad6964c900bca44e20b
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Mon Dec 7 03:13:24 2009 +0100
browser, kupferui: Add menu item for Help
Add an item "Help" to the notification icon menu. Right now this will
simply open Kupfer's Website in the web browser, but that is a
placeholder for later bundled Kupfer documentation.
kupfer/browser.py | 7 +++++++
kupfer/kupferui.py | 47 +++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 54 insertions(+), 0 deletions(-)
---
diff --git a/kupfer/browser.py b/kupfer/browser.py
index e5b44b3..89bff5f 100644
--- a/kupfer/browser.py
+++ b/kupfer/browser.py
@@ -1313,15 +1313,22 @@ class WindowController (pretty.OutputMixin):
from kupfer import preferences
preferences.GetPreferencesWindowController().show()
return True
+ def help_callback(menuitem):
+ from kupfer import kupferui
+ kupferui.show_help()
+ return True
def quit_callback(menuitem):
self.quit()
return True
menu = gtk.Menu()
menu_prefs = gtk.ImageMenuItem(gtk.STOCK_PREFERENCES)
menu_prefs.connect("activate", prefs_callback)
+ menu_help = gtk.ImageMenuItem(gtk.STOCK_HELP)
+ menu_help.connect("activate", help_callback)
menu_quit = gtk.ImageMenuItem(gtk.STOCK_QUIT)
menu_quit.connect("activate", quit_callback)
menu.append(menu_prefs)
+ menu.append(menu_help)
menu.append(menu_quit)
menu.show_all()
diff --git a/kupfer/kupferui.py b/kupfer/kupferui.py
new file mode 100644
index 0000000..348b719
--- /dev/null
+++ b/kupfer/kupferui.py
@@ -0,0 +1,47 @@
+"""
+Access functions of Kupfer's Interface
+"""
+
+from kupfer import utils, version
+
+def show_help():
+ """
+ Show Kupfer help pages, if possible
+ """
+ utils.show_url(version.WEBSITE)
+
+
+_about_dialog = None
+
+def show_about_dialog(*ignored, **kwds):
+ """
+ create an about dialog and show it
+ """
+ # Use only one instance, stored in _about_dialog
+ global _about_dialog
+ if _about_dialog:
+ ab = _about_dialog
+ else:
+ ab = gtk.AboutDialog()
+ ab.set_program_name(version.PROGRAM_NAME)
+ ab.set_logo_icon_name(version.ICON_NAME)
+ ab.set_version(version.VERSION)
+ ab.set_comments(version.SHORT_DESCRIPTION)
+ ab.set_copyright(version.COPYRIGHT)
+ ab.set_website(version.WEBSITE)
+ ab.set_license(version.LICENSE)
+ ab.set_authors(version.AUTHORS)
+ if version.DOCUMENTERS:
+ ab.set_documenters(version.DOCUMENTERS)
+ if version.TRANSLATOR_CREDITS:
+ ab.set_translator_credits(version.TRANSLATOR_CREDITS)
+
+ ab.connect("response", _response_callback)
+ # do not delete window on close
+ ab.connect("delete-event", lambda *ign: True)
+ _about_dialog = ab
+ ab.present()
+
+def _response_callback(dialog, response_id):
+ dialog.hide()
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]