[Python-checkins] python/dist/src/Lib/idlelib EditorWindow.py, 1.53.6.2, 1.53.6.3 NEWS.txt, 1.23.4.12, 1.23.4.13 configHelpSourceEdit.py, 1.6, 1.6.8.1

kbk at users.sourceforge.net kbk at users.sourceforge.net
Wed Jan 19 05:12:41 CET 2005


Update of /cvsroot/python/python/dist/src/Lib/idlelib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31514

Modified Files:
      Tag: release23-maint
	EditorWindow.py NEWS.txt configHelpSourceEdit.py 
Log Message:
Backport EditorWindow rev 1.60  configHelpSourceEdit rev 1.7  15Jul04

checking sys.platform for substring 'win' was breaking IDLE docs on Mac
(darwin).  Also, Mac Safari browser requires full file:// URIs.  SF 900580.

M EditorWindow.py
M NEWS.txt
M configHelpSourceEdit.py



Index: EditorWindow.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/EditorWindow.py,v
retrieving revision 1.53.6.2
retrieving revision 1.53.6.3
diff -u -d -r1.53.6.2 -r1.53.6.3
--- EditorWindow.py	17 Jan 2005 20:34:45 -0000	1.53.6.2
+++ EditorWindow.py	19 Jan 2005 04:12:37 -0000	1.53.6.3
@@ -60,7 +60,7 @@
                     basepath = '/usr/share/doc/'  # standard location
                     dochome = os.path.join(basepath, pyver,
                                            'Doc', 'index.html')
-            elif sys.platform.count('win') or sys.platform.count('nt'):
+            elif sys.platform[:3] == 'win':
                 # Try the HTMLHelp file
                 chmpath = os.path.join(sys.prefix, 'Doc',
                                        'Python%d%d.chm' % sys.version_info[:2])
@@ -311,20 +311,11 @@
         textView.TextViewer(self.top,'Help',fn)
 
     def python_docs(self, event=None):
-        if sys.platform.count('win') or sys.platform.count('nt'):
+        if sys.platform[:3] == 'win':
             os.startfile(self.help_url)
-            return "break"
         else:
             webbrowser.open(self.help_url)
-            return "break"
-
-    def display_docs(self, url):
-        if not (url.startswith('www') or url.startswith('http')):
-            url = os.path.normpath(url)
-        if sys.platform.count('win') or sys.platform.count('nt'):
-            os.startfile(url)
-        else:
-            webbrowser.open(url)
+        return "break"
 
     def cut(self,event):
         self.text.event_generate("<<Cut>>")
@@ -575,7 +566,12 @@
     def __extra_help_callback(self, helpfile):
         "Create a callback with the helpfile value frozen at definition time"
         def display_extra_help(helpfile=helpfile):
-            self.display_docs(helpfile)
+            if not (helpfile.startswith('www') or helpfile.startswith('http')):
+                url = os.path.normpath(helpfile)
+            if sys.platform[:3] == 'win':
+                os.startfile(helpfile)
+            else:
+                webbrowser.open(helpfile)
         return display_extra_help
 
     def UpdateRecentFilesList(self,newFile=None):

Index: NEWS.txt
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/NEWS.txt,v
retrieving revision 1.23.4.12
retrieving revision 1.23.4.13
diff -u -d -r1.23.4.12 -r1.23.4.13
--- NEWS.txt	19 Jan 2005 01:44:06 -0000	1.23.4.12
+++ NEWS.txt	19 Jan 2005 04:12:38 -0000	1.23.4.13
@@ -3,6 +3,10 @@
 
 *Release date: XX-Jan-2005*
 
+- checking sys.platform for substring 'win' was breaking IDLE docs on Mac
+  (darwin).  Also, Mac Safari browser requires full file:// URIs.  Backport of
+  fix for SF 900580.
+
 - rpc.py:SocketIO - Large modules were generating large pickles when downloaded
   to the execution server.  The return of the OK response from the subprocess
   initialization was interfering and causing the sending socket to be not

Index: configHelpSourceEdit.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/idlelib/configHelpSourceEdit.py,v
retrieving revision 1.6
retrieving revision 1.6.8.1
diff -u -d -r1.6 -r1.6.8.1
--- configHelpSourceEdit.py	27 Jan 2003 02:36:18 -0000	1.6
+++ configHelpSourceEdit.py	19 Jan 2005 04:12:38 -0000	1.6.8.1
@@ -1,6 +1,7 @@
 "Dialog to specify or edit the parameters for a user configured help source."
 
 import os
+import sys
 
 from Tkinter import *
 import tkMessageBox
@@ -84,7 +85,7 @@
             dir, base = os.path.split(path)
         else:
             base = None
-            if sys.platform.count('win') or sys.platform.count('nt'):
+            if sys.platform[:3] == 'win':
                 dir = os.path.join(os.path.dirname(sys.executable), 'Doc')
                 if not os.path.isdir(dir):
                     dir = os.getcwd()
@@ -127,19 +128,30 @@
             self.entryPath.focus_set()
             pathOk = False
         elif path.startswith('www.') or path.startswith('http'):
-            pathOk = True
-        elif not os.path.exists(path):
-            tkMessageBox.showerror(title='File Path Error',
-                                   message='Help file path does not exist.',
-                                   parent=self)
-            self.entryPath.focus_set()
-            pathOk = False
+            pass
+        else:
+            if path[:5] == 'file:':
+                path = path[5:]
+            if not os.path.exists(path):
+                tkMessageBox.showerror(title='File Path Error',
+                                       message='Help file path does not exist.',
+                                       parent=self)
+                self.entryPath.focus_set()
+                pathOk = False
         return pathOk
 
     def Ok(self, event=None):
         if self.MenuOk() and self.PathOk():
             self.result = (self.menu.get().strip(),
                            self.path.get().strip())
+            if sys.platform == 'darwin':
+                path = self.result[1]
+                if (path.startswith('www') or path.startswith('file:')
+                    or path.startswith('http:')):
+                    pass
+                else:
+                    # Mac Safari insists on using the URI form for local files
+                    self.result[1] = "file://" + path
             self.destroy()
 
     def Cancel(self, event=None):



More information about the Python-checkins mailing list