cpython: 09ebed6a8cb8 (original) (raw)
--- a/Lib/idlelib/NEWS.txt +++ b/Lib/idlelib/NEWS.txt @@ -7,8 +7,8 @@ What's New in IDLE 3.6.0a1?
- Issue #25199: Idle: add synchronization comments for future maintainers. -- Issue #16893: Replace help.txt with idle.html for Idle doc display.
- The new idlelib/idle.html is copied from Doc/build/html/library/idle.html. +- Issue #16893: Replace help.txt with help.html for Idle doc display.
- The new idlelib/help.html is rstripped Doc/build/html/library/idle.html. It looks better than help.txt and will better document Idle as released. The tkinter html viewer that works for this file was written by Mark Roseman. The now unused EditorWindow.HelpDialog class and helt.txt file are deprecated.
rename from Lib/idlelib/idle.html rename to Lib/idlelib/help.html
--- a/Lib/idlelib/help.py +++ b/Lib/idlelib/help.py @@ -1,23 +1,26 @@ -""" -help.py implements the Idle help menu and is subject to change. +""" help.py: Implement the Idle help menu. +Contents are subject to revision at any time, without notice. -The contents are subject to revision at any time, without notice. Help => About IDLE: diplay About Idle dialog -Help => IDLE Help: display idle.html with proper formatting + +Help => IDLE Help: Display help.html with proper formatting. +Doc/library/idle.rst (Sphinx)=> Doc/build/html/library/idle.html +(help.copy_strip)=> Lib/idlelib/help.html -HelpParser - Parses idle.html generated from idle.rst by Sphinx -and renders to tk Text. +HelpParser - Parse help.html and and render to tk Text. -HelpText - Displays formatted idle.html. +HelpText - Display formatted help.html. -HelpFrame - Contains text, scrollbar, and table-of-contents. +HelpFrame - Contain text, scrollbar, and table-of-contents. (This will be needed for display in a future tabbed window.) -HelpWindow - Display idleframe in a standalone window. +HelpWindow - Display HelpFrame in a standalone window. + +copy_strip - Copy idle.html to help.html, rstripping each line. show_idlehelp - Create HelpWindow. Called in EditorWindow.help_dialog. """ @@ -36,7 +39,7 @@ if use_ttk:
IDLE Help ##
The overridden handle_xyz methods handle a subset of html tags. The supplied text should have the needed tag configurations. @@ -62,7 +65,7 @@ class HelpParser(HTMLParser): self.tags = '' if self.level == 0 else 'l'+str(self.level) def handle_starttag(self, tag, attrs):
"Handle starttags in idle.html."[](#l3.52)
"Handle starttags in help.html."[](#l3.53) class_ = ''[](#l3.54) for a, v in attrs:[](#l3.55) if a == 'class':[](#l3.56)
@@ -120,7 +123,7 @@ class HelpParser(HTMLParser): self.text.insert('end', s, self.tags) def handle_endtag(self, tag):
"Handle endtags in idle.html."[](#l3.61)
"Handle endtags in help.html."[](#l3.62) if tag in ['h1', 'h2', 'h3', 'span', 'em']:[](#l3.63) self.indent(0) # clear tag, reset indent[](#l3.64) if self.show and tag in ['h1', 'h2', 'h3']:[](#l3.65)
@@ -136,7 +139,7 @@ class HelpParser(HTMLParser): self.indent(amt=-1) def handle_data(self, data):
"Handle date segments in idle.html."[](#l3.70)
"Handle date segments in help.html."[](#l3.71) if self.show and not self.hdrlink:[](#l3.72) d = data if self.pre else data.replace('\n', ' ')[](#l3.73) if self.tags == 'h1':[](#l3.74)
@@ -149,7 +152,7 @@ class HelpParser(HTMLParser): class HelpText(Text):
- "Display help.html." def init(self, parent, filename): "Configure tags and feed file to parser." Text.init(self, parent, wrap='word', highlightthickness=0,
@@ -188,6 +191,7 @@ class HelpText(Text): class HelpFrame(Frame):
- "Display html text, scrollbar, and toc." def init(self, parent, filename): Frame.init(self, parent) text = HelpText(self, filename)
@@ -202,6 +206,7 @@ class HelpFrame(Frame): toc.grid(column=0, row=0, sticky='nw') def contents_widget(self, text):
"Create table of contents."[](#l3.96) toc = Menubutton(self, text='TOC')[](#l3.97) drop = Menu(toc, tearoff=False)[](#l3.98) for tag, lbl in text.parser.contents:[](#l3.99)
@@ -211,7 +216,7 @@ class HelpFrame(Frame): class HelpWindow(Toplevel): -
- "Display frame with rendered html." def init(self, parent, filename, title): Toplevel.init(self, parent) self.wm_title(title)
@@ -221,11 +226,23 @@ class HelpWindow(Toplevel): self.grid_rowconfigure(0, weight=1) +def copy_strip():
- "Copy idle.html to idlelib/help.html, stripping trailing whitespace."
- src = join(abspath(dirname(dirname(dirname(file)))),
'Doc', 'build', 'html', 'library', 'idle.html')[](#l3.116)
- dst = join(abspath(dirname(file)), 'help.html')
- with open(src, 'rb') as inn,[](#l3.118)
open(dst, 'wb') as out:[](#l3.119)
for line in inn:[](#l3.120)
out.write(line.rstrip() + '\n')[](#l3.121)
- print('idle.html copied to help.html')
- "Create HelpWindow; called from Idle Help event handler."
- filename = join(abspath(dirname(file)), 'help.html') if not isfile(filename):
dirpath = join(abspath(dirname(dirname(dirname(__file__)))),[](#l3.129)
'Doc', 'build', 'html', 'library')[](#l3.130)
# try copy_strip, present message[](#l3.131)
HelpWindow(parent, filename, 'IDLE Help') if name == 'main':return [](#l3.132)
--- a/Misc/NEWS +++ b/Misc/NEWS @@ -81,10 +81,13 @@ Library IDLE ---- +- Issue #24861: Most of idlelib is private and subject to change.
- Issue #25199: Idle: add synchronization comments for future maintainers. -- Issue #16893: Replace help.txt with idle.html for Idle doc display.
- The new idlelib/idle.html is copied from Doc/build/html/idle.html. +- Issue #16893: Replace help.txt with help.html for Idle doc display.
- The new idlelib/help.html is rstripped Doc/build/html/library/idle.html. It looks better than help.txt and will better document Idle as released. The tkinter html viewer that works for this file was written by Rose Roseman. The now unused EditorWindow.HelpDialog class and helt.txt file are deprecated. @@ -200,27 +203,6 @@ Library
- Issue #23572: Fixed functools.singledispatch on classes with falsy metaclasses. Patch by Ethan Furman. -IDLE ----- - -- Issue #24861: Most of idlelib is private and subject to change.
- Use idleib.idle.* to start Idle. See idlelib.init.doc. - -- Issue #25199: Idle: add synchronization comments for future maintainers. - -- Issue #16893: Replace help.txt with idle.html for Idle doc display.
- The new idlelib/idle.html is copied from Doc/build/html/library/idle.html.
- It looks better than help.txt and will better document Idle as released.
- The tkinter html viewer that works for this file was written by Mark Roseman.
- The now unused EditorWindow.HelpDialog class and helt.txt file are deprecated. - -- Issue #24199: Deprecate unused idlelib.idlever with possible removal in 3.6. - -- Issue #24782: In Idle extension config dialog, replace tabs with sorted list.
- Patch by Mark Roseman. - -- Issue #24790: Remove extraneous code (which also create 2 & 3 conflicts). - Documentation -------------