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

Contents of /trunk/pygtk/help.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1757 - (show annotations) (download) (as text)
Wed Feb 27 05:40:40 2008 UTC (16 years, 3 months ago) by jpye
File MIME type: text/x-python
File size: 1309 byte(s)
Add DOPRI5 to installer package (EXPERIMENTAL).
On Windows, use the registry to locate the book.pdf documentation file.
Fix path to test models for DOPRI5 in test.py.
1 import webbrowser
2 import os.path
3 import platform
4 import config
5
6 class Help:
7 def __init__(self,helproot=None,url=None):
8 print "HELPROOT =",config.HELPROOT
9 self.goonline=False
10
11 if url is not None:
12 self.webhelproot = url
13 self.goonline = True
14 else:
15 self.webhelproot = config.WEBHELPROOT
16
17 if helproot==None:
18 if platform.system()=="Windows":
19 import _winreg
20 x=_winreg.ConnectRegistry(None,_winreg.HKEY_LOCAL_MACHINE)
21 y= _winreg.OpenKey(x,r"SOFTWARE\ASCEND")
22 _regpath,t = _winreg.QueryValueEx(y,"Install_Dir")
23 _winreg.CloseKey(y)
24 _winreg.CloseKey(x)
25 self.helproot = os.path.join(_regpath,"book.pdf")
26 else:
27 self.helproot = os.path.expanduser(config.HELPROOT)
28 else:
29 self.helproot = helproot
30
31 if not os.path.exists(self.helproot):
32 print "LOCAL HELP FILES NOT FOUND, WILL USE ONLINE COPY"
33 self.goonline = True
34
35 def run(self,topic=None):
36
37 if platform.system()=="Windows":
38 _b = webbrowser.get()
39 else:
40 # tested on Fedora 7:
41 _b = webbrowser.get('firefox')
42
43 if self.goonline:
44 _u = self.webhelproot
45 else:
46 _p = os.path.join(self.helproot)
47 _u = "file://"+_p
48
49 print "OPENING WEB PAGE: %s..." % _u
50 _b.open(_u,autoraise=1);
51 print "BACK FROM WEB CALL"
52
53 if __name__ == "__main__":
54 _h = Help()
55 _h.run()

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