[Idle-dev] [ idlefork-Patches-470637 ] better doc path on windows

noreply@sourceforge.net noreply@sourceforge.net
Tue, 01 Oct 2002 10:09:58 -0700


Patches item #470637, was opened at 2001-10-12 19:21
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=309579&aid=470637&group_id=9579

Category: None
Group: None
Status: Open
Resolution: None
Priority: 7
Submitted By: Bruce Sherwood (bsherwood)
Assigned to: Nobody/Anonymous (nobody)
Summary: better doc path on windows

Initial Comment:
In EditorWindow.py, I suggest a better path to the 
documentation on Windows. The old way is commented out 
below; it says to start from where EditorWindow.py is 
located, come up two parent levels, then go down to 
\Doc\index.html.

This works fine as long as idle is in Python21\Tools, 
but would not work if idle were in some arbitrary 
location.

    if sys.platform[:3] == "win":
        fn = os.path.split(sys.executable)[0]
+'\Doc\index.html'
##        fn = os.path.dirname(__file__)
##        fn = os.path.join(fn, os.pardir, 
os.pardir, "Doc", "index.html")
##        fn = os.path.normpath(fn)



----------------------------------------------------------------------

Comment By: Josh Robb (josh_robb)
Date: 2002-10-01 19:09

Message:
Logged In: YES 
user_id=614376

How do you add a patch attatchment to an existing issue?

Index: EditorWindow.py
===============================================
====================
RCS file: /cvsroot/idlefork/idle/EditorWindow.py,v
retrieving revision 1.32
diff -c -r1.32 EditorWindow.py
*** EditorWindow.py	26 Sep 2002 22:13:22 -0000	1.32
--- EditorWindow.py	30 Sep 2002 22:28:32 -0000
***************
*** 290,319 ****
      def help_dialog(self, event=None):
          fn=os.path.join(os.path.abspath(os.path.dirname
(__file__)),'help.txt')
          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):
          self.text.event_generate("<<Cut>>")
          return "break"
--- 290,324 ----
      def help_dialog(self, event=None):
          fn=os.path.join(os.path.abspath(os.path.dirname
(__file__)),'help.txt')
          textView.TextViewer(self.top,'Help',fn)        
! 
!     ## TODO help_url should be user configurable
!     ## first time we should ask for location if we can't figure it out 
automagically.
! 
!     #Ka-Ping & co have already figured out how to do this.
!     import pydoc
!     dirroot = pydoc.Helper(None, None).docdir
!     fn = os.path.join(dirroot, "index.html")
!     if os.path.isfile(fn):
!         help_url = fn
      else:
!         help_url = "http://www.python.org/doc/current/"
!     del pydoc, fn, dirroot
  
      def display_docs(self, url):
          webbrowser.open(url)
  
+     if sys.platform[:3] == "win":
+         dirroot = os.path.dirname(sys.executable)
+         fn = os.path.join(dirroot, "pythlp.chm")
+         if os.path.isfile(fn):
+             help_url = fn
+             def display_docs(self, url):
+                 os.startfile(url)
+         del fn, dirroot
+ 
+     def python_docs(self, event=None):
+         self.display_docs(self.help_url)
+ 
      def cut(self,event):
          self.text.event_generate("<<Cut>>")
          return "break"

----------------------------------------------------------------------

Comment By: Josh Robb (josh_robb)
Date: 2002-10-01 19:08

Message:
Logged In: YES 
user_id=614376

During the writing of the online help system (patch coming) i 
discovered that this code already exists in the pydoc module. 
This code works on UNIX/Windows i have no idea if it works on 
Mac but if it doesn't it should be fixed in pydoc which needs this
logic anyway.


----------------------------------------------------------------------

Comment By: Kurt B. Kaiser (kbk)
Date: 2002-09-23 04:56

Message:
Logged In: YES 
user_id=149084

Stephen Gava made some improvements in
Rev 1.23 which added pythlp.chm support
for the win platform.  (22Apr2002)

PEP 250 standardizes the location of Idle
on Windows but the canonical location of
the docs requires investigation.

Also, EditorWindow does not handle locally
installed html docs on other platforms, 
e.g. Linux.  It accesses the mother ship.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=309579&aid=470637&group_id=9579