]> git.saurik.com Git - wxWidgets.git/blame - wxPython/distrib/viewdocs.py
moved fatal exception handling code to msw/main.cpp from common code
[wxWidgets.git] / wxPython / distrib / viewdocs.py
CommitLineData
1e4a197e
RD
1#!/usr/bin/env python
2#---------------------------------------------------------------------------
3
4import sys, os, glob
f93cfdc3
RD
5import wx
6from wx.tools import helpviewer
1e4a197e
RD
7
8
9# Figure out the path where this app is located
10if __name__ == '__main__':
11 basePath = os.path.dirname(sys.argv[0])
12else:
13 basePath = os.path.dirname(__file__)
ed5f4c78
RD
14if not basePath:
15 basePath = '.'
16
1e4a197e 17
f93cfdc3
RD
18# test for write access
19if os.access(basePath, os.W_OK):
1e4a197e 20
f93cfdc3
RD
21 # setup the args
22 args = ['',
1e4a197e
RD
23 '--cache='+basePath,
24 os.path.join(basePath, 'wx.zip'),
25 os.path.join(basePath, 'ogl.zip'),
26 ]
27
f93cfdc3
RD
28 # add any other .zip files found
29 for file in glob.glob(os.path.join(basePath, "*.zip")):
30 if file not in args:
31 args.append(file)
1e4a197e 32
f93cfdc3
RD
33 # launch helpviewer
34 helpviewer.main(args)
35
36else:
37 app = wx.PySimpleApp()
38 dlg = wx.MessageDialog(None,
39 "The wxDocs need to be located in a directory that is writable by you. "
40 "I am unable to start the viewer in its current location.",
41 "Error!", wx.OK|wx.ICON_EXCLAMATION)
42 dlg.ShowModal()
43 dlg.Destroy()
44 app.MainLoop()
1e4a197e
RD
45
46#---------------------------------------------------------------------------
47