Mercurial > cpython-lru_cache-weakref
changeset 11239:577ea261bdf2 legacy-trunk
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.
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Thu, 26 Aug 1999 23:06:05 +0000 |
| parents | 56ef4c2e0d7e |
| children | 4cc4baa24a40 |
| files | Tools/idle/EditorWindow.py |
| diffstat | 1 files changed, 14 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/Tools/idle/EditorWindow.py Thu Aug 26 18:08:13 1999 +0000 +++ b/Tools/idle/EditorWindow.py Thu Aug 26 23:06:05 1999 +0000 @@ -116,6 +116,7 @@ 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 @@ 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")
