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-29 10:54:00 -05:00
|
|
|
if not basePath:
|
|
|
|
basePath = '.'
|
|
|
|
|
2003-03-25 01:35:27 -05:00
|
|
|
|
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'),
|
|
|
|
]
|
|
|
|
|
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
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|