2003-03-25 06:35:27 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
import sys, os, glob
|
2004-03-26 05:32:40 +00:00
|
|
|
import wx
|
|
|
|
from wx.tools import helpviewer
|
2003-03-25 06:35:27 +00: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 15:54:00 +00:00
|
|
|
if not basePath:
|
|
|
|
basePath = '.'
|
|
|
|
|
2003-03-25 06:35:27 +00:00
|
|
|
|
2004-03-26 05:32:40 +00:00
|
|
|
# test for write access
|
|
|
|
if os.access(basePath, os.W_OK):
|
2003-03-25 06:35:27 +00:00
|
|
|
|
2004-03-26 05:32:40 +00:00
|
|
|
# setup the args
|
|
|
|
args = ['',
|
2003-03-25 06:35:27 +00:00
|
|
|
'--cache='+basePath,
|
|
|
|
os.path.join(basePath, 'wx.zip'),
|
|
|
|
]
|
|
|
|
|
2004-03-26 05:32:40 +00: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 06:35:27 +00:00
|
|
|
|
2004-03-26 05:32:40 +00: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 06:35:27 +00:00
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|