]> git.saurik.com Git - wxWidgets.git/blame - wxPython/wx/tools/helpviewer.py
Make sure the window is not iconized before saving position and size.
[wxWidgets.git] / wxPython / wx / tools / helpviewer.py
CommitLineData
d14a1e28
RD
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#----------------------------------------------------------------------
1fded56b 12
d14a1e28
RD
13"""
14helpviewer.py -- Displays HTML Help in a wxHtmlHelpController window.
1fded56b 15
d14a1e28
RD
16Usage:
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
25import sys, os
26
27#---------------------------------------------------------------------------
28
29def 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
e6c3f9eb
RD
44 import wx
45 import wx.html
d14a1e28 46
e6c3f9eb
RD
47 app = wx.PySimpleApp()
48 #wx.Log.SetActiveTarget(wx.LogStderr())
49 wx.Log.SetLogLevel(wx.LOG_Error)
d14a1e28
RD
50
51 # Set up the default config so the htmlhelp frame can save its preferences
52 app.SetVendorName('wxWindows')
53 app.SetAppName('helpviewer')
e6c3f9eb 54 cfg = wx.ConfigBase.Get()
d14a1e28
RD
55
56 # Add the Zip filesystem
e6c3f9eb 57 wx.FileSystem.AddHandler(wx.ZipFSHandler())
d14a1e28
RD
58
59 # Create the viewer
e6c3f9eb 60 helpctrl = wx.html.HtmlHelpController()
d14a1e28
RD
61 if cachedir:
62 helpctrl.SetTempDir(cachedir)
63
64 # and add the books
65 for helpfile in args:
66 print "Adding %s..." % helpfile
67 helpctrl.AddBook(helpfile, 1)
68
69 # start it up!
70 helpctrl.DisplayContents()
71 app.MainLoop()
72
73
74if __name__ == '__main__':
75 main()
e6c3f9eb
RD
76
77