2003-03-25 01:35:27 -05:00
|
|
|
#!/usr/bin/env python
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
import sys, os, glob
|
2004-03-26 00:32:40 -05:00
|
|
|
import wx
|
|
|
|
from wx.tools import helpviewer
|
2003-03-25 01:35:27 -05:00
|
|
|
|
|
|
|
|
|
|
|
# Figure out the path where this app is located
|
|
|
|
if __name__ == '__main__':
|
|
|
|
basePath = os.path.dirname(sys.argv[0])
|
|
|
|
else:
|
|
|
|
basePath = os.path.dirname(__file__)
|
|
|
|
|
2004-03-26 00:32:40 -05:00
|
|
|
# test for write access
|
|
|
|
if os.access(basePath, os.W_OK):
|
2003-03-25 01:35:27 -05:00
|
|
|
|
2004-03-26 00:32:40 -05:00
|
|
|
# setup the args
|
|
|
|
args = ['',
|
2003-03-25 01:35:27 -05:00
|
|
|
'--cache='+basePath,
|
|
|
|
os.path.join(basePath, 'wx.zip'),
|
|
|
|
os.path.join(basePath, 'ogl.zip'),
|
|
|
|
]
|
|
|
|
|
2004-03-26 00:32:40 -05:00
|
|
|
# add any other .zip files found
|
|
|
|
for file in glob.glob(os.path.join(basePath, "*.zip")):
|
|
|
|
if file not in args:
|
|
|
|
args.append(file)
|
2003-03-25 01:35:27 -05:00
|
|
|
|
2004-03-26 00:32:40 -05:00
|
|
|
# launch helpviewer
|
|
|
|
helpviewer.main(args)
|
|
|
|
|
|
|
|
else:
|
|
|
|
app = wx.PySimpleApp()
|
|
|
|
dlg = wx.MessageDialog(None,
|
|
|
|
"The wxDocs need to be located in a directory that is writable by you. "
|
|
|
|
"I am unable to start the viewer in its current location.",
|
|
|
|
"Error!", wx.OK|wx.ICON_EXCLAMATION)
|
|
|
|
dlg.ShowModal()
|
|
|
|
dlg.Destroy()
|
|
|
|
app.MainLoop()
|
2003-03-25 01:35:27 -05:00
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|