]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Update to use the new standard webbrowser module if available, otherwise
authorFred Drake <fdrake@acm.org>
Sun, 9 Jul 2000 19:10:19 +0000 (19:10 +0000)
committerFred Drake <fdrake@acm.org>
Sun, 9 Jul 2000 19:10:19 +0000 (19:10 +0000)
uses the BrowserControl module.

BrowserControl is not removed to allow IDLE to be distributed separately
and still be used with Python 1.5.2.

Tools/idle/EditorWindow.py

index 53f2520545d4eba4839e94e8adeb90fe3c3977e1..d744a2e386cfb90befdae429e04c763104f0abad 100644 (file)
@@ -6,7 +6,12 @@ import imp
 from Tkinter import *
 import tkSimpleDialog
 import tkMessageBox
-import BrowserControl
+try:
+    import webbrowser
+except ImportError:
+    import BrowserControl
+    webbrowser = BrowserControl
+    del BrowserControl
 import idlever
 import WindowList
 from IdleConf import idleconf
@@ -27,6 +32,7 @@ TK_TABWIDTH_DEFAULT = 8
 #$ event <<open-path-browser>>
 
 #$ event <<close-window>>
+
 #$ unix <Control-x><Control-0>
 #$ unix <Control-x><Key-0>
 #$ win <Alt-F4>
@@ -298,7 +304,7 @@ class EditorWindow:
         del fn
 
     def python_docs(self, event=None):
-        BrowserControl.open(self.help_url)
+        webbrowser.open(self.help_url)
 
     def select_all(self, event=None):
         self.text.tag_add("sel", "1.0", "end-1c")