]> git.saurik.com Git - wxWidgets.git/blob - wxPython/wx/tools/helpviewer.py
removed second parameter from GetFirstChild calls
[wxWidgets.git] / wxPython / wx / tools / helpviewer.py
1 #----------------------------------------------------------------------
2 # Name: wxPython.tools.helpviewer
3 # Purpose: HTML Help viewer
4 #
5 # Author: Robin Dunn
6 #
7 # Created: 11-Dec-2002
8 # RCS-ID: $Id$
9 # Copyright: (c) 2002 by Total Control Software
10 # Licence: wxWindows license
11 #----------------------------------------------------------------------
12
13 """
14 helpviewer.py -- Displays HTML Help in a wxHtmlHelpController window.
15
16 Usage:
17 helpviewer [--cache=path] helpfile [helpfile(s)...]
18
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.
22 """
23
24
25 import sys, os
26
27 #---------------------------------------------------------------------------
28
29 def main(args=sys.argv):
30 if len(args) < 2:
31 print __doc__
32 return
33
34 args = args[1:]
35 cachedir = None
36 if args[0][:7] == '--cache':
37 cachedir = os.path.expanduser(args[0].split('=')[1])
38 args = args[1:]
39
40 if len(args) == 0:
41 print __doc__
42 return
43
44 from wxPython.wx import wxPySimpleApp, wxConfigBase_Get, \
45 wxLog_SetActiveTarget, wxLogStderr, \
46 wxLog_SetLogLevel, wxLOG_Error, \
47 wxFileSystem_AddHandler, wxZipFSHandler
48 import wxPython.html
49 from wxPython.htmlhelp import wxHtmlHelpController
50
51
52 app = wxPySimpleApp()
53 #wxLog_SetActiveTarget(wxLogStderr())
54 wxLog_SetLogLevel(wxLOG_Error)
55
56 # Set up the default config so the htmlhelp frame can save its preferences
57 app.SetVendorName('wxWindows')
58 app.SetAppName('helpviewer')
59 cfg = wxConfigBase_Get()
60
61 # Add the Zip filesystem
62 wxFileSystem_AddHandler(wxZipFSHandler())
63
64 # Create the viewer
65 helpctrl = wxHtmlHelpController()
66 if cachedir:
67 helpctrl.SetTempDir(cachedir)
68
69 # and add the books
70 for helpfile in args:
71 print "Adding %s..." % helpfile
72 helpctrl.AddBook(helpfile, 1)
73
74 # start it up!
75 helpctrl.DisplayContents()
76 app.MainLoop()
77
78
79 if __name__ == '__main__':
80 main()