Browse files

Fixed #787: added initial HtmlHelpController code

* changed sphinx make process to put duplicate copy of htmlhelp files into peppy/help
* modified setup and manifest to include the html files with the code when being distributed
* changed help actions to use HtmlHelpController
* added showHelp to main application to display HtmlHelpController
* added get_package_data_dir
* added stub action to display help text for major mode

svn-revision: r2333
  • Loading branch information...
robmcmullen committed Oct 25, 2009
1 parent 967c07a commit 4877f54cbbec6eac290df2b76c0dcec46a5e3ee7
Showing with 66 additions and 14 deletions.
  1. +1 −0
  2. +3 −0 manual/Makefile
  3. +34 −0 peppy/
  4. +19 −12 peppy/plugins/
  5. +9 −2
@@ -5,6 +5,7 @@ recursive-include manual *
recursive-include peppy/editra/styles *
global-include *.peppy-plugin
recursive-include peppy/icons *
recursive-include peppy/help *
recursive-include py2exe *
include scripts/peppy
include scripts/peppy.bat
@@ -44,6 +44,9 @@ web: pickle
mkdir -p _build/htmlhelp _build/doctrees
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) _build/htmlhelp
python _build/htmlhelp
mkdir -p ../peppy/help
cp -r _build/htmlhelp/* ../peppy/help
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in _build/htmlhelp."
@@ -46,6 +46,22 @@ def main_is_frozen():
hasattr(sys, "importers") # old py2exe
or imp.is_frozen("__main__")) # tools/freeze
def get_package_data_dir(relative_path):
"""Gets the package data directory.
@param relative_path: the path starting from the root data directory,
not from within the peppy directory. For example, the path should be
"peppy/help" rather than just "help".
if main_is_frozen():
top = os.path.dirname(sys.argv[0])
top = os.path.dirname(os.path.dirname(__file__))
path = os.path.join(top, relative_path)
return path
def get_plugin_dirs(search_path):
# 'plugins' directory at root of current installation (either when bundled
# as an app or when running from the file system) is automatically included
@@ -1083,6 +1099,24 @@ def cooperativeYield(self):
if self.debuglevel > 0:
dprint("Yield returned.")
self.yielding = False
def showHelp(self, section=None):
from wx.html import HtmlHelpController
if not hasattr(self, 'helpframe') or self.helpframe is None:
self.helpframe = HtmlHelpController()
filename = get_package_data_dir("peppy/help/peppydoc.hhp")
if os.path.exists(filename):
if section:
dlg = wx.MessageDialog(self.GetTopWindow(), "Unable to locate help files; installation error?\nThe files should be located here:\n\n%s\n\nbut were not found." % os.path.dirname(filename), "Help Files Not Found", wx.OK | wx.ICON_EXCLAMATION )
def run():
"""Start an instance of the application.
@@ -20,12 +20,6 @@
# in peppy will get loaded twice.
from peppy import __url__, __bug_report_url__
_user_manual = """<!-- -*- HTMLView -*- -->
<h2>User Manual for %(prog)s %(version)s</h2>
<p>Copyright (c) %(yearrange)s %(author)s (%(author_email)s)</p>
<p>Well, not so much a user's manual as a placeholder for one.
class HelpAbout(SelectAction):
name = "&About..."
@@ -90,8 +84,20 @@ class UserManual(SelectAction):
def action(self, index=-1, multiplier=1):"about:User Manual")
class MajorModeHelp(SelectAction):
"""Display the manual for the current major mode
name = "Help on Current Major Mode"
default_menu = ("&Help", 101)
osx_minimal_menu = False
def action(self, index=-1, multiplier=1):
class ProjectHome(SelectAction):
"""Go to the project homepage.
@@ -141,10 +147,11 @@ def action(self, index=-1, multiplier=1):
class HelpPlugin(IPeppyPlugin):
def aboutFiles(self):
return {'User Manual': _user_manual}
def getActions(self):
return [HelpAbout, UserManual, ProjectHome, BugReport,
return [HelpAbout,
UserManual, MajorModeHelp,
ProjectHome, BugReport,
@@ -199,9 +199,13 @@ def addmodules(arg, dirname, names):
except ImportError:
# py2exe ignores package_data, so the editra files loaded on demand by the
# style editor need to be included in the data_files entry
# py2exe ignores package_data, so the editra files loaded on demand by
# the style editor and all help HTML files need to be included in the
# data_files entry
data_files.append(("peppy/editra/styles", glob.glob("peppy/editra/styles/*.ess")))
data_files.append(("peppy/help", glob.glob("peppy/help/*.*")))
data_files.append(("peppy/help/_images", glob.glob("peppy/help/_images/*")))
data_files.append(("peppy/help/_static", glob.glob("peppy/help/_static/*")))
# py2exe can't scan inside zipped eggs to find dependencies. All plugins
# must be unpacked into a directory in order for py2exe to find any
@@ -291,6 +295,9 @@ def addmodules(arg, dirname, names):
'peppy.hsi': ['*.peppy-plugin' ],
'peppy.major_modes': ['*.peppy-plugin' ],
'peppy.editra': ['styles/*.ess'],
'': ['*.*'],
'': ['*'],
'': ['*'],
ext_modules = ext_modules,

0 comments on commit 4877f54

Please sign in to comment.