From 72b21ce7e5baa3c0f81266e2066edff1edae0136 Mon Sep 17 00:00:00 2001 From: skyjake Date: Sat, 30 Dec 2006 12:36:31 +0000 Subject: [PATCH] Added documentation URL. Help plugin should open the URL in a browser when the "Snowberry Help" menu item is selected. --- snowberry/lang/english.lang | 8 ++++++++ snowberry/plugins/help.py | 27 +++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/snowberry/lang/english.lang b/snowberry/lang/english.lang index 697c26801c..9e380c5c83 100644 --- a/snowberry/lang/english.lang +++ b/snowberry/lang/english.lang @@ -14,6 +14,11 @@ # Supposed to appear in the language selection list. language-english: English (U.S.) +# +# Documentation URL +# +documentation-url: http://dengine.net/dew/index.php?title=Snowberry_Main_Page + # # Setup Wizard # @@ -184,6 +189,7 @@ preferences: Preferences menu-0: Snowberry menu-1: Profile menu-2: Tools +menu-3: Help menu-new-profile: New... menu-rename-profile: Rename menu-reset-profile: Reset to defaults @@ -211,6 +217,8 @@ menu-show-snowberry-settings-accel: Ctrl-, menu-about: About Snowberry menu-quit: Quit menu-quit-accel: Ctrl-Q +menu-open-documentation: Snowberry Help +menu-open-documentation-accel: Ctrl-? # # Tab Labels diff --git a/snowberry/plugins/help.py b/snowberry/plugins/help.py index f4935fcdf0..54b117c414 100644 --- a/snowberry/plugins/help.py +++ b/snowberry/plugins/help.py @@ -18,12 +18,13 @@ # You should have received a copy of the GNU General Public License # along with this program; if not: http://www.opensource.org/ -import string, time -import language, events, ui +import string, time, os, urllib +import language, events, ui, host import sb.aodb as ao import sb.addon import sb.profdb as pr import sb.confdb as st +import sb.util.dialog # An instance of the message timer. @@ -53,10 +54,14 @@ def init(): "Create the HTML text widget into the help area." + + ui.addPopupMenuCommand(ui.MENU_HELP, 'open-documentation') + try: helpArea = ui.getArea(ui.HELP) except KeyError: # The Help area does not exist. We don't have much to do here. + events.addCommandListener(handleCommand, ['open-documentation']) return helpArea.setExpanding(True) @@ -79,7 +84,8 @@ def init(): # Register a listener. events.addCommandListener(handleCommand, ['help-addon-mode-brief', 'help-addon-mode-detailed', - 'freeze', 'unfreeze']) + 'freeze', 'unfreeze', + 'open-documentation']) events.addNotifyListener(handleNotify, ['show-help-text-now', 'init-done', @@ -140,7 +146,20 @@ def handleCommand(event): elif event.hasId('unfreeze'): helpDisabled = False updateHelpText() - + + elif event.hasId('open-documentation'): + if host.isMac(): + cmd = 'open ' + urllib.quote(language.translate('documentation-url'), '/:?=') + os.system(cmd) + else: + dialog, area = sb.util.dialog.createButtonDialog( + 'help-documentation-dialog', + ['ok'], 'ok', resizable=False) + msg = area.createFormattedText() + msg.setText(language.translate('documentation-url')) + msg.setMinSize(400, 100) + dialog.run() + def handleNotify(event): """This is called when somebody sends a notification.