python (3.11.7)

(root)/
lib/
python3.11/
idlelib/
__pycache__/
help.cpython-311.opt-1.pyc

eM.TdZddlmZddlmZmZmZmZddlm	Z	ddl
mZmZm
Z
ddlmZmZmZmZddl
mZddlmZGd	d
eZGddeZGd
deZGddeZdZdZedkr'ddlmZedddddl m!Z!e!edSdS)a help.py: Implement the Idle help menu.
Contents are subject to revision at any time, without notice.


Help => About IDLE: display About Idle dialog

<to be moved here from help_about.py>


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 - Parse help.html and render to tk Text.

HelpText - Display formatted help.html.

HelpFrame - Contain text, scrollbar, and table-of-contents.
(This will be needed for display in a future tabbed 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.
)
HTMLParser)abspathdirnameisfilejoin)python_version)ToplevelTextMenu)Frame
Menubutton	ScrollbarStylefont)idleConfc2eZdZdZdZd	dZdZdZdZdS)

HelpParsera~Render help.html into a text widget.

    The overridden handle_xyz methods handle a subset of html tags.
    The supplied text should have the needed tag configurations.
    The behavior for unsupported tags, such as table, is undefined.
    If the tags generated by Sphinx change, this class, especially
    the handle_starttag and handle_endtags methods, might have to also.
    ctj|d||_d|_d|_d|_d|_d|_d|_d|_	d|_
d|_g|_d|_
d|_dS)NT)convert_charrefsFr)r__init__texttagschartagsshowhdrlinklevelprehprefix	nested_dl
simplelisttocheaderprevtag)selfrs  @/BuggyBox/python/3.11.7/bootstrap/lib/python3.11/idlelib/help.pyrzHelpParser.__init__3swD48888		
	
cx|xj|z
c_|jdkrdndt|jz|_dS)z#Change indent (+1, 0, -1) and tags.rrlN)rstrr)r&amts  r'indentzHelpParser.indentCs8

c

*//BBs3tz??/B			r(cjd}|D]
\}}|dkr|}d}|dkr|dgkr	d|_n|dkr|dkr	d|_n|d	krK|jrD|jd
s7|jdd}|r|sd
nd}nj|dkr|dkr	d|_nU|dkr|dkr	d|_n@|dkr	d|_n1|dvr?|ddkr
d}d|_nd|_|n|dkr|j	d
krd|_
n|dkr|jrdnd}n|dkr|j
sd
nd}d|_
n|dkr|d}n|dkr1d|_|jr|jdd
d|_
nV|dkr|dkrd|_nB|d kr||_
n4|d!vr0|jr"d|_|jdd
||_
|jr(|jd||j
|jfd|f|_d"S)#zHandle starttags in help.html.rclasssection)ididleTdivclearerFprzend-1c linestartzend-1cz


spanrversionmodifiedem)ulolsimpledlliz
* z

* dtddendpreblocka
headerlinkh1)h2h3N)rr%rgetisspacerfindr"r.rr!rinsertrrr$)r&tagattrsclass_rEvslastlines        r'handle_starttagzHelpParser.handle_starttagHs		DAqG||).)9 9 9DII
E\\f	11DII
CZZDLZaZy}}%7BBH"G8+;+;+=+=G4AA
F]]v!DMM
F]]v)::: DMM
D[[ DMM
L
 
 {{8$$**"&"'KKMMMM
D[[zA~~!%
D[[/7xAA
D[["n6$A"DNN
D[[KKMMMAA
E\\DHy
0	  ///"DII
CZZFl22DLL
D[[DII
L
 
 y
0 	  ///DI9	CIUA	4='ABBBc{r(cj|dvr]|jrN|dkrdn	|dkrdnd}|j||jz|jdfd|_nH|dvrd|_n<|d	krd
|_n.|dkrd
|_	d|_n|dvr|
d
d
|f|_dS)zHandle endtags in help.html.rGrHrIrIz        rHz    rrM)r8r:rEFr)r;rBr<r>N)rr#appendr$rindexrrrrr.r%)r&rNr.s   r'
handle_endtagzHelpParser.handle_endtags$$$y
Q(+t**$'4KK&&!3TY__X5N5N OPPPDII
N
"
"DMM
CZZ DLL
E\\DHDII
&
&
&KKOOOs|r(c6|jr|js|jr|n|dd}|jdkr;	|d|d|_n#t$r
d|_YnwxYw|jdvrn|jdkrA|dt|j|jkr|t|jd}|xj	|
z
c_	|jd||j|j
fdSdSdS)	z"Handle date segments in help.html.r7 rGrrrVNrC)rrrreplacerrXr 
ValueErrorlenr$striprrMr)r&datads   r'handle_datazHelpParser.handle_datas89	CT\	C=dll4&=&=AyD  &#$Qqwws||^#4DLL!&&&#%DLLL&y...LB&&aDL)))*dl::#dl++,,-Aqwwyy(IUA	4='ABBBBB	C	C	C	Cs"AA32A3N)r))	__name__
__module____qualname____doc__rr.rTrYrbr(r'rr*sx CCCC
8#8#8#t$$$*CCCCCr(rceZdZdZdZdZdS)HelpTextzDisplay help.html.c
tjdddd}tjdddd}d|zdz}tj||d	d
dd
|||gd
}|gd}|df|d<|d|ddf|d|ddf|d|ddf|d|ddf|d|dfd|d|dfd d!d"d#$|d%d d &|d'd(d(&|d)d*d*&|d+d,d,&t
||_t|d-.5}|	}d/d/d/n#1swxYwY|j
|d0|d1<d/S)2z'Configure tags and feed file to parser.mainEditorWindowwidthint)typeheightwordr)wraphighlightthicknesspadxborderwidthrmrp)
TkDefaultFontarial	helvetica)TkFixedFontmonacocourierrr:italicrrGboldrHrIrz#f6f6ff)r
backgroundrD
r)solidz#eeffcc)rlmargin1rxreliefrl1)rlmargin2l22l3Kl4dzutf-8)encodingNdisabledstate)r	GetOptionr
rfindfont
tag_configurerparseropenreadfeed)	r&parentfilenameuwideuhigh
normalfont	fixedfontfcontentss	         r'rzHelpText.__init__s"6>7OOO"6>8%PPPE	Q
dFA!5	H	H	H	H]]#J#J#JKK
MM"F"F"FGG	"B'V4z2x&@AAA4z2v&>???4z2v&>???4z2v&>???5	29MMM:YObg)		E	E	E4"r:::4"r:::4"r:::4#<<< &&
(W
-
-
-	 vvxxH	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 """"W


s.GGGcJ|D]}|dtj|Dvr3tj|d|}|dcS|dtj|Dvr|cSdS)z4Return name of first font family derived from names.c3>K|]}|VdSNlower.0xs  r'	<genexpr>z$HelpText.findfont.<locals>.<genexpr>s*KKa		KKKKKKr()rootT)nameexistsrfamilyc3>K|]}|VdSrrrs  r'rz$HelpText.findfont.<locals>.<genexpr>sF"G"G&'#$''))"G"G"G"G"G"Gr(N)rtkfontnamesFontactualfamilies)r&rrrs    r'rzHelpText.findfonts		Dzz||KK6<T3J3J3JKKKKK{TEEE{{}}X...."G"G+1?+E+E+E"G"G"GGGG			r(N)rcrdrerfrrrgr(r'riris8###:r(riceZdZdZdZdZdS)	HelpFramez&Display html text, scrollbar, and toc.cFtj||t||x|_}t	||_d|d<|jd|d||x|_}t||j
x|_}|j|d<|
dd	|dd	|ddd
|ddd|dd
ddS)Nzhelpframe.TFramestyler)r)commandyscrollcommandrr)weightnw)rowcolumnstickynsewns)rrrirrr	configuretoc_menur#ryviewscrollsetrowconfigurecolumnconfiguregrid)r&rrrr#rs      r'rzHelpFrame.__init__s!
tV$$$#D(333	D6]]
*W

/D<NOOOt,,,3(tzBBBBf!'
!A&&&Qq)))Qq...		a&	111!D11111r(ct|d}t|d}jjD]!\}}|||ffd	"||d<|S)z+Create table of contents as drop-down menu.TOC)rF)tearoffc.|Sr)r)dexrs r'<lambda>z$HelpFrame.toc_menu.<locals>.<lambda>stzz#r()labelrmenu)r
rrr#add_command)r&rr#droplblrs `    r'rzHelpFrame.toc_menusyE***C'''	P	PHC330N0N0N0N0NOOOOF
r(N)rcrdrerfrrrgr(r'rrs8,,222 r(rceZdZdZdZdS)
HelpWindowz!Display frame with rendered html.c8tj|||||d|jt||ddd|dd|dddS)NWM_DELETE_WINDOWrr)rrrr)r)	r	rwm_titleprotocoldestroyrrgrid_columnconfiguregrid_rowconfigure)r&rrtitles    r'rzHelpWindow.__init__s$'''

e

($,777$!!&&aQv&FFF!!!A!...q+++++r(N)rcrdrerfrrgr(r'rrs)'',,,,,r(rc&ttttttddddd}ttttd}t	|d5}t	|d5}|D],}||d	z-	d
d
d
n#1swxYwYd
d
d
n#1swxYwYt|d|d
S)a^Copy idle.html to idlelib/help.html, stripping trailing whitespace.

    Files with trailing whitespace cannot be pushed to the git cpython
    repository.  For 3.x (on Windows), help.html is generated, after
    editing idle.rst on the master branch, with
      sphinx-build -bhtml . build/html
      python_d.exe -c "from idlelib.help import copy_strip; copy_strip()"
    Check build/html/library/idle.html, the help.html diff, and the text
    displayed by Help => IDLE Help.  Add a blurb and create a PR.

    It can be worthwhile to occasionally generate help.html without
    touching idle.rst.  Changes to the master version and to the doc
    build system may result in changes that should not changed
    the displayed text, but might break HelpParser.

    As long as master and maintenance versions of idle.rst remain the
    same, help.html can be backported.  The internal Python version
    number is not displayed.  If maintenance idle.rst diverges from
    the master version, then instead of backporting help.html from
    master, repeat the procedure above to generate a maintenance
    version.
    Docbuildhtmllibraryz	idle.html	help.htmlrbwb
Nz copied to )rrr__file__rwriterstripprint)srcdstinnoutlines     r'
copy_striprsz.wwwwx'8'899::;;7FI{<<C
wwx(());
7
7C	
c4-C	
c4-	-	-DIIdkkmme+,,,,	-------------------------------
S
"
"S
"
"#####s6
C20CC2C	C2"C	#C22C69C6cttttd}t	|sdSt||dt
zdS)z7Create HelpWindow; called from Idle Help event handler.rNzIDLE Help (%s))rrrrrrr)rrs  r'_helpwindowrsZGGH--..<<H(vx!1N4D4D!DEEEEEr(__main__)rkzidlelib.idle_test.test_helprF)	verbosityexit)runN)"rfhtml.parserros.pathrrrrplatformrtkinterr	r
rtkinter.ttkrr
rrrridlelib.configrrrirrrrrcunittestrkidlelib.idle_test.htestrrgr(r'<module>rs4#"""""222222222222######((((((((((;;;;;;;;;;;;""""""######{C{C{C{C{C{C{C{C|'''''t'''T8,,,,,,,,$$$BFFFzD	&!%@@@@++++++Cr(