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