/[ascend]/trunk/pygtk/interface/help.py
ViewVC logotype

Annotation of /trunk/pygtk/interface/help.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 337 - (hide annotations) (download) (as text)
Wed Mar 1 00:51:23 2006 UTC (18 years, 4 months ago) by johnpye
File MIME type: text/x-python
File size: 1147 byte(s)
Something is starting to run on MinGW now. GUI loads and ascend DLL is opened.
This revision still breaks the linux and Tcl/Tk builds, I expect.
Also added some smarts to the 'help...contents' menu for loading offline/online help files.
1 johnpye 230 import webbrowser
2     import os.path
3 johnpye 337 import platform
4     import config
5 johnpye 230
6     class Help:
7     def __init__(self,helproot=None):
8 johnpye 337 print "HELPROOT =",config.HELPROOT
9     self.goonline=False
10     self.webhelproot = config.WEBHELPROOT
11    
12 johnpye 230 if helproot==None:
13 johnpye 337 self.helproot = os.path.expanduser(config.HELPROOT)
14 johnpye 230 else:
15     self.helproot = helproot
16 johnpye 337
17     if os.path.exists(self.helproot):
18     print "HELP PATH FOUND"
19     else:
20     print "LOCAL HELP FILES NOT FOUND, WILL USE ONLINE COPY"
21     self.goonline = True
22 johnpye 230
23     def run(self,topic=None):
24 johnpye 337
25     if platform.system()=='Windows':
26     try:
27     import win32api
28     _b = webbrowser.get('windows-default')
29     except:
30     print "FAILED TO IMPORT 'win32', hoping that firefox is installed..."
31     _b = webbrowser.GenericBrowser('\\Progra~1\\Mozill~1\\firefox %s &');
32    
33     print _b
34     elif platform.system()=='Linux':
35     _b = webbrowser.get('mozilla')
36     else:
37     print "PLATFORM IS ".platform.platform(True,True)
38 johnpye 230
39 johnpye 337 if self.goonline:
40     _u = self.webhelproot
41     else:
42     _p = os.path.join(self.helproot,"book.html")
43     _u = "file:"+_p
44    
45     print "OPENING WEB PAGE:",_u
46     _b.open(_u);
47    
48 johnpye 230 if __name__ == "__main__":
49     _h = Help()
50     _h.run()

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22