summaryrefslogtreecommitdiffstats
path: root/Lib/idlelib/EditorWindow.py
diff options
context:
space:
mode:
authorKurt B. Kaiser <kbk@shore.net>2001-07-13 03:35:32 (GMT)
committerKurt B. Kaiser <kbk@shore.net>2001-07-13 03:35:32 (GMT)
commitafdf71b9eefdfb5904e40602984836b28318bad0 (patch)
tree6aa71666f381f5f203d5eb0cf24ba9cdc43aa4f6 /Lib/idlelib/EditorWindow.py
parentfad225f1ba5df5f22328ea5648d1e3d2aa919479 (diff)
downloadcpython-afdf71b9eefdfb5904e40602984836b28318bad0.zip
cpython-afdf71b9eefdfb5904e40602984836b28318bad0.tar.gz
cpython-afdf71b9eefdfb5904e40602984836b28318bad0.tar.bz2
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.
Diffstat (limited to 'Lib/idlelib/EditorWindow.py')
-rw-r--r--Lib/idlelib/EditorWindow.py30
1 files changed, 16 insertions, 14 deletions
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 @@ import imp
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 @@ TK_TABWIDTH_DEFAULT = 8
#$ event <<open-path-browser>>
#$ event <<close-window>>
+
#$ unix <Control-x><Control-0>
#$ unix <Control-x><Key-0>
#$ win <Alt-F4>
@@ -303,22 +310,17 @@ class EditorWindow:
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 @@ class EditorWindow:
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):