[Idle-dev] CVS: idle EditorWindow.py,1.43,1.44
Kurt B. Kaiser
kbk@users.sourceforge.net
Thu, 09 Jan 2003 21:07:26 -0800
Update of /cvsroot/idlefork/idle
In directory sc8-pr-cvs1:/tmp/cvs-serv9238
Modified Files:
EditorWindow.py
Log Message:
1. Make finding Python help docs more robust, including the installed
configuation.
2. Make sure that os.startfile() is used to open both Python help docs
and Extra Help docs on the Windows platforms.
Index: EditorWindow.py
===================================================================
RCS file: /cvsroot/idlefork/idle/EditorWindow.py,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -r1.43 -r1.44
*** EditorWindow.py 4 Jan 2003 01:43:53 -0000 1.43
--- EditorWindow.py 10 Jan 2003 05:07:24 -0000 1.44
***************
*** 44,49 ****
--- 44,67 ----
vars = {}
+ help_url = None
def __init__(self, flist=None, filename=None, key=None, root=None):
+ if EditorWindow.help_url is None:
+ if sys.platform.count('linux'):
+ # look for html docs in a couple of standard places
+ pyver = 'python-docs-' + '%s.%s.%s' % sys.version_info[:3]
+ if os.path.isdir('/var/www/html/python/'): # "python2" rpm
+ dochome = '/var/www/html/python/index.html'
+ else:
+ basepath = '/usr/share/doc/' # standard location
+ dochome = os.path.join(basepath, pyver,
+ 'Doc', 'index.html')
+ else:
+ dochome = os.path.join(sys.prefix, 'Doc', 'index.html')
+ dochome = os.path.normpath(dochome)
+ if os.path.isfile(dochome):
+ EditorWindow.help_url = dochome
+ else:
+ EditorWindow.help_url = "http://www.python.org/doc/current"
currentTheme=idleConf.CurrentTheme()
self.flist = flist
***************
*** 286,311 ****
textView.TextViewer(self.top,'Help',fn)
! help_url = "http://www.python.org/doc/current/"
! if sys.platform[:3] == "win":
! fn = os.path.dirname(__file__)
! fn = os.path.join(fn, os.pardir, os.pardir, "pythlp.chm")
! fn = os.path.normpath(fn)
! if os.path.isfile(fn):
! help_url = fn
! else:
! fn = os.path.dirname(__file__)
! fn = os.path.join(fn, os.pardir, os.pardir, "Doc", "index.html")
! fn = os.path.normpath(fn)
! if os.path.isfile(fn):
! help_url = fn
! del fn
! def python_docs(self, event=None):
os.startfile(self.help_url)
! else:
! def python_docs(self, event=None):
! self.display_docs(self.help_url)
def display_docs(self, url):
! webbrowser.open(url)
def cut(self,event):
--- 304,321 ----
textView.TextViewer(self.top,'Help',fn)
! def python_docs(self, event=None):
! if sys.platform.count('win') or sys.platform.count('nt'):
os.startfile(self.help_url)
! return "break"
! else:
! webbrowser.open(self.help_url)
! return "break"
def display_docs(self, url):
! url = os.path.normpath(url)
! if sys.platform.count('win') or sys.platform.count('nt'):
! os.startfile(url)
! else:
! webbrowser.open(url)
def cut(self,event):