]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/wx/tools/helpviewer.py
1 #----------------------------------------------------------------------
2 # Name: wx.tools.helpviewer
3 # Purpose: HTML Help viewer
9 # Copyright: (c) 2002 by Total Control Software
10 # Licence: wxWindows license
11 #----------------------------------------------------------------------
14 helpviewer.py -- Displays HTML Help in a wxHtmlHelpController window.
17 helpviewer [--cache=path] helpfile [helpfile(s)...]
19 Where helpfile is the path to either a .hhp file or a .zip file
20 which contians a .hhp file. The .hhp files are the same as those
21 used by Microsoft's HTML Help Workshop for creating CHM files.
27 #---------------------------------------------------------------------------
29 def makeOtherFrame(helpctrl
):
31 parent
= helpctrl
.GetFrame()
32 otherFrame
= wx
.Frame(parent
)
35 def main(args
=sys
.argv
):
42 if args
[0][:7] == '--cache':
43 cachedir
= os
.path
.expanduser(args
[0].split('=')[1])
53 app
= wx
.PySimpleApp()
54 #wx.Log.SetActiveTarget(wx.LogStderr())
55 wx
.Log
.SetLogLevel(wx
.LOG_Error
)
57 # Set up the default config so the htmlhelp frame can save its preferences
58 app
.SetVendorName('wxWindows')
59 app
.SetAppName('helpviewer')
60 cfg
= wx
.ConfigBase
.Get()
62 # Add the Zip filesystem
63 wx
.FileSystem
.AddHandler(wx
.ZipFSHandler())
66 helpctrl
= wx
.html
.HtmlHelpController()
68 helpctrl
.SetTempDir(cachedir
)
72 print "Adding %s..." % helpfile
73 helpctrl
.AddBook(helpfile
, 1)
75 # The frame used by the HtmlHelpController is set to not prevent
76 # app exit, so in the case of a standalone helpviewer like this
77 # when the about box or search box is closed the help frame will
78 # be the only one left and the app will close unexpectedly. To
79 # work around this we'll create another frame that is never shown,
80 # but which will be closed when the helpviewer frame is closed.
81 wx
.CallAfter(makeOtherFrame
, helpctrl
)
84 helpctrl
.DisplayContents()
88 if __name__
== '__main__':