Skip to content

Commit

Permalink
Added documentation URL. Help plugin should open the URL in a browser…
Browse files Browse the repository at this point in the history
… when the "Snowberry Help" menu item is selected.
  • Loading branch information
skyjake committed Dec 30, 2006
1 parent d0f6885 commit 72b21ce
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
8 changes: 8 additions & 0 deletions snowberry/lang/english.lang
Expand Up @@ -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
#
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
27 changes: 23 additions & 4 deletions snowberry/plugins/help.py
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand All @@ -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',
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 72b21ce

Please sign in to comment.