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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 336 by johnpye, Sun Jan 29 07:16:06 2006 UTC revision 337 by johnpye, Wed Mar 1 00:51:23 2006 UTC
# Line 1  Line 1 
1  import webbrowser  import webbrowser
2  import os.path  import os.path
3    import platform
4    import config
5    
6  class Help:  class Help:
7      def __init__(self,helproot=None):      def __init__(self,helproot=None):
8            print "HELPROOT =",config.HELPROOT
9            self.goonline=False
10            self.webhelproot = config.WEBHELPROOT
11            
12          if helproot==None:          if helproot==None:
13              self.helproot = os.path.expanduser("~/src/ascend-doc/trunk/html")              self.helproot = os.path.expanduser(config.HELPROOT)
14          else:          else:
15              self.helproot = helproot              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):      def run(self,topic=None):
24          #_b = webbrowser.GenericBrowser('dillo %s &');              
25          _b = webbrowser.Konqueror();          if platform.system()=='Windows':
26          _p = os.path.join(self.helproot,"book.html");              try:
27          _b.open("file:"+_p);                  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__":  if __name__ == "__main__":
49      _h = Help()      _h = Help()

Legend:
Removed from v.336  
changed lines
  Added in v.337

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