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

Annotation of /trunk/pygtk/help.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1590 - (hide annotations) (download) (as text)
Thu Aug 9 14:47:47 2007 UTC (13 years, 2 months ago) by jpye
File MIME type: text/x-python
File size: 968 byte(s)
Fixed default web help URL.
Fixed handling of web links on Fedora (needs checking on other Linux)
1 johnpye 230 import webbrowser
2     import os.path
3 johnpye 337 import platform
4     import config
5 johnpye 230
6     class Help:
7 jpye 1429 def __init__(self,helproot=None,url=None):
8 johnpye 337 print "HELPROOT =",config.HELPROOT
9     self.goonline=False
10 jpye 1429
11     if url is not None:
12     self.webhelproot = url
13     self.goonline = True
14 johnpye 230 else:
15 jpye 1429 self.webhelproot = config.WEBHELPROOT
16    
17     if helproot==None:
18     self.helproot = os.path.expanduser(config.HELPROOT)
19     else:
20     self.helproot = helproot
21    
22 jpye 1444 if not os.path.exists(self.helproot):
23 jpye 1429 print "LOCAL HELP FILES NOT FOUND, WILL USE ONLINE COPY"
24     self.goonline = True
25 johnpye 230
26     def run(self,topic=None):
27    
28 jpye 1590 if platform.system()=="Windows":
29     _b = webbrowser.get()
30     else:
31     # tested on Fedora 7:
32     _b = webbrowser.get('firefox')
33    
34 johnpye 337 if self.goonline:
35     _u = self.webhelproot
36     else:
37 jpye 1444 _p = os.path.join(self.helproot)
38 johnpye 826 _u = "file://"+_p
39 johnpye 337
40 jpye 1552 print "OPENING WEB PAGE: %s..." % _u
41 jpye 1590 _b.open(_u,autoraise=1);
42 jpye 1552 print "BACK FROM WEB CALL"
43 johnpye 337
44 johnpye 230 if __name__ == "__main__":
45     _h = Help()
46     _h.run()

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