Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dcd2dc2

Browse files
committed
Patch #540583: Open MS Help Docs if available.
1 parent 2f6d4da commit dcd2dc2

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

Tools/idle/EditorWindow.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,14 +294,23 @@ def help_dialog(self, event=None):
294294
help_url = "http://www.python.org/doc/current/"
295295
if sys.platform[:3] == "win":
296296
fn = os.path.dirname(__file__)
297-
fn = os.path.join(fn, os.pardir, os.pardir, "Doc", "index.html")
297+
fn = os.path.join(fn, os.pardir, os.pardir, "pythlp.chm")
298298
fn = os.path.normpath(fn)
299299
if os.path.isfile(fn):
300300
help_url = fn
301+
else:
302+
fn = os.path.dirname(__file__)
303+
fn = os.path.join(fn, os.pardir, os.pardir, "Doc", "index.html")
304+
fn = os.path.normpath(fn)
305+
if os.path.isfile(fn):
306+
help_url = fn
301307
del fn
302308

303-
def python_docs(self, event=None):
304-
webbrowser.open(self.help_url)
309+
def python_docs(self, event=None):
310+
os.startfile(self.help_url)
311+
else:
312+
def python_docs(self, event=None):
313+
webbrowser.open(self.help_url)
305314

306315
def select_all(self, event=None):
307316
self.text.tag_add("sel", "1.0", "end-1c")

0 commit comments

Comments
 (0)