summaryrefslogtreecommitdiffstats
path: root/Tools/idle
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1999-08-26 23:06:05 (GMT)
committerGuido van Rossum <guido@python.org>1999-08-26 23:06:05 (GMT)
commit416b961be8e04df70d909b85349b8f01cea7464f (patch)
tree3c8f2fdba33dba6e4cc2464907527972e51f044f /Tools/idle
parent0ee4891c82bbec210b7e13ea3e2b76afb5d078f9 (diff)
downloadcpython-416b961be8e04df70d909b85349b8f01cea7464f.zip
cpython-416b961be8e04df70d909b85349b8f01cea7464f.tar.gz
cpython-416b961be8e04df70d909b85349b8f01cea7464f.tar.bz2
Find the help.txt file relative to __file__ or ".", not in sys.path.
(Suggested by Moshe Zadka, but implemented differently.) Add <<python-docs>> event which, on Unix, brings up Netscape pointing to http://www.python.doc/current/ (a local copy would be nice but its location can't be predicted). Windows solution TBD.
Diffstat (limited to 'Tools/idle')
-rw-r--r--Tools/idle/EditorWindow.py22
1 files changed, 14 insertions, 8 deletions
diff --git a/Tools/idle/EditorWindow.py b/Tools/idle/EditorWindow.py
index 007a99b..eb9466a 100644
--- a/Tools/idle/EditorWindow.py
+++ b/Tools/idle/EditorWindow.py
@@ -116,6 +116,7 @@ class EditorWindow:
self.top.bind("<<close-window>>", self.close_event)
text.bind("<<center-insert>>", self.center_insert_event)
text.bind("<<help>>", self.help_dialog)
+ text.bind("<<python-docs>>", self.python_docs)
text.bind("<<about-idle>>", self.about_dialog)
text.bind("<<open-module>>", self.open_module)
text.bind("<<do-nothing>>", lambda event: "break")
@@ -258,19 +259,24 @@ class EditorWindow:
helpfile = "help.txt"
def help_dialog(self, event=None):
- helpfile = self.helpfile
- if not os.path.exists(helpfile):
- base = os.path.basename(self.helpfile)
- for dir in sys.path:
- fullname = os.path.join(dir, base)
- if os.path.exists(fullname):
- helpfile = fullname
- break
+ try:
+ helpfile = os.path.join(os.path.dirname(__file__), self.helpfile)
+ except NameError:
+ helpfile = self.helpfile
if self.flist:
self.flist.open(helpfile)
else:
self.io.loadfile(helpfile)
+ # XXX Fix these for Windows
+ help_viewer = "netscape -remote 'openurl(%(url)s)' 2>/dev/null || " \
+ "netscape %(url)s &"
+ help_url = "http://www.python.org/doc/current/"
+
+ def python_docs(self, event=None):
+ cmd = self.help_viewer % {"url": self.help_url}
+ os.system(cmd)
+
def select_all(self, event=None):
self.text.tag_add("sel", "1.0", "end-1c")
self.text.mark_set("insert", "1.0")