py-cvs-rel2_1 (Rev 1.33 - 1.37) merge

VP IDLE version depended on VP's ExecBinding.py and spawn.py to get the
path to the Windows Doc directory (relative to python.exe). Removed this
conflicting code in favor of py-cvs updates which on Windows use a hard
coded path relative to the location of this module. py-cvs updates include
support for webbrowser.py.  Module still has BrowserControl.py for 1.5.2
support.

At this point, the differences wrt py-cvs relate to menu functionality.
diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py
index 9f76ef7..17837a9 100644
--- a/Lib/idlelib/EditorWindow.py
+++ b/Lib/idlelib/EditorWindow.py
@@ -12,6 +12,12 @@
 from Tkinter import *
 import tkSimpleDialog
 import tkMessageBox
+try:
+    import webbrowser
+except ImportError:
+    import BrowserControl
+    webbrowser = BrowserControl
+    del BrowserControl
 import idlever
 import WindowList
 from IdleConf import idleconf
@@ -32,6 +38,7 @@
 #$ event <<open-path-browser>>
 
 #$ event <<close-window>>
+
 #$ unix <Control-x><Control-0>
 #$ unix <Control-x><Key-0>
 #$ win <Alt-F4>
@@ -303,22 +310,17 @@
         else:
             self.io.loadfile(helpfile)
 
-    help_viewer = "netscape -remote 'openurl(%(url)s)' 2>/dev/null || " \
-                  "netscape %(url)s &"
     help_url = "http://www.python.org/doc/current/"
+    if sys.platform[:3] == "win":
+        fn = os.path.dirname(__file__)
+        fn = os.path.join(fn, "../../Doc/index.html")
+        fn = os.path.normpath(fn)
+        if os.path.isfile(fn):
+            help_url = fn
+        del fn
 
     def python_docs(self, event=None):
-        if sys.platform=='win32':
-          try:
-            import win32api
-            import ExecBinding
-            doc = os.path.join( os.path.dirname( ExecBinding.pyth_exe ), "doc", "index.html" )
-            win32api.ShellExecute(0, None, doc, None, sys.path[0], 1)
-          except:
-            pass
-        else:
-          cmd = self.help_viewer % {"url": self.help_url}
-          os.system(cmd)
+        webbrowser.open(self.help_url)
 
     def select_all(self, event=None):
         self.text.tag_add("sel", "1.0", "end-1c")
@@ -688,7 +690,7 @@
         if self.get_tabwidth() != newtabwidth:
             pixels = text.tk.call("font", "measure", text["font"],
                                   "-displayof", text.master,
-                                  "n" * newtabwith)
+                                  "n" * newtabwidth)
             text.configure(tabs=pixels)
 
 def prepstr(s):