1 |
import webbrowser |
2 |
import os.path |
3 |
import platform |
4 |
import config |
5 |
|
6 |
class Help: |
7 |
def __init__(self,helproot=None): |
8 |
print "HELPROOT =",config.HELPROOT |
9 |
self.goonline=False |
10 |
self.webhelproot = config.WEBHELPROOT |
11 |
|
12 |
if helproot==None: |
13 |
self.helproot = os.path.expanduser(config.HELPROOT) |
14 |
else: |
15 |
self.helproot = helproot |
16 |
|
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 |
|
23 |
def run(self,topic=None): |
24 |
|
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 |
|
39 |
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 |
if __name__ == "__main__": |
49 |
_h = Help() |
50 |
_h.run() |