From 416b961be8e04df70d909b85349b8f01cea7464f Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Thu, 26 Aug 1999 23:06:05 +0000 Subject: Find the help.txt file relative to __file__ or ".", not in sys.path. (Suggested by Moshe Zadka, but implemented differently.) Add <> 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. --- Tools/idle/EditorWindow.py | 22 ++++++++++++++-------- 1 file 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("<>", self.close_event) text.bind("<>", self.center_insert_event) text.bind("<>", self.help_dialog) + text.bind("<>", self.python_docs) text.bind("<>", self.about_dialog) text.bind("<>", self.open_module) text.bind("<>", 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") -- cgit v0.12