python (3.12.0)

(root)/
lib/
python3.12/
idlelib/
__pycache__/
help.cpython-312.opt-1.pyc

̑eO.*dZddlmZddlmZmZmZmZddlm	Z	ddl
mZmZm
Z
ddlmZmZmZmZddl
mZddlmZGd	d
eZGddeZGd
deZGddeZdZdZedk(r ddlmZedddddl m!Z!e!eyy)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)idleConfc0eZdZdZdZddZdZdZdZy)	
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|_y)NT)convert_charrefsFr)r__init__texttagschartagsshowhdrlinklevelprehprefix	nested_dl
simplelisttocheaderprevtag)selfrs  @/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/idlelib/help.pyrzHelpParser.__init__3smD48		
	
c|xj|z
c_|jdk(rd|_ydt|jz|_y)z#Change indent (+1, 0, -1) and tags.rrlN)rstrr)r&amts  r'indentzHelpParser.indentCs4

c
**/B	s3tzz?/B	r(cd}|D]
\}}|dk(s|}d}|dk(r|dgk(r	d|_n|dk(r|dk(r	d|_n|d	k(rO|jrC|jd
s4|jjdd}|r|j	sd
nd}nj|dk(r|dk(r	d|_nW|dk(r|dk(r	d|_nD|dk(r	d|_n6|dvr6|j
ddk7r
d}d|_nd|_|jn|dk(r|jd
kDrd|_
n|dk(r|jrdnd}n|dk(r|jsd
nd}d|_
n|dk(r|jd}n|dk(r7d|_|jr|jjdd
d|_
nY|dk(r
|dk(rd|_nG|d k(r||_
n:|d!vr6|jr#d|_|jjdd
||_
|jr3|jjd||j|j
fd|f|_y")#zHandle starttags in help.html.rclasssection)ididleTdivclearerFprzend-1c linestartzend-1cz


spanrversionmodifiedem)ulolsimpledlliz
* z

* dtddendpreblocka
headerlinkh1)h2h3N)rr%rgetisspacerfindr"r-rr!rinsertrrr$)r&tagattrsclass_rDvslastlines        r'handle_starttagzHelpParser.handle_starttagHs 	DAqG|	
).)9 9DI
E\f	1DI
CZDLLayy}}%7BH"8+;+;+=4A
F]v!DM
F]v):: DM
D[ DM
L
 {{8$*"&"'KKM
D[zzA~!%
D[//xA
D["nn$A"DN
D[KKMA
E\DHyy		  /"DI
CZFl2DL
D[DI
L
 yy 		  /DI99IIUA		4=='ABc{r(cp|dvrg|jrS|dk(rdn|dk(rdnd}|jj||jz|jjdfd|_nB|dvrd|_n6|d	k(rd
|_n)|dk(rd
|_	d|_n|dvr|jd
d
|f|_y)zHandle endtags in help.html.rFrGrHrHz        rGz    rrL)r7r9rDFr)r:rAr;r=N)rr#appendr$rindexrrrrr-r%)r&rMr-s   r'
handle_endtagzHelpParser.handle_endtags$$yy(+t*$'4K&!3TYY__X5N OPDI
N
"DM
CZ DL
E\DHDI
&
&KKOs|r(cX|jr|js|jr|n|jdd}|jdk(r	|d|jd|_|jdvro|jdk7r=|dt|j|jk(r|t|jd}|xj|jz
c_	|jjd||j|jfyyy#t$r
d|_YwxYw)	z"Handle date segments in help.html.r6 rFrrrUNrB)rrrreplacerrWr 
ValueErrorlenr$striprrLr)r&datads   r'handle_datazHelpParser.handle_datas99T\\dll4&=AyyD &#$Qqwws|#4DLyy..LLB&aDLL)*dll:#dll+,-Aqwwy(IIUA		4=='AB*9
"&#%DL&s
DD)(D)N))	__name__
__module____qualname____doc__rr-rSrXrar(r'rr*s# C
8#t$*Cr(rceZdZdZdZdZy)HelpTextzDisplay help.html.c
~tjdddd}tjdddd}d|zdz}tj||d	d
dd
|||j	gd
}|j	gd}|df|d<|jd|ddf|jd|ddf|jd|ddf|jd|ddf|jd|dfd|jd|dfd d!d"d#$|jd%d d &|jd'd(d(&|jd)d*d*&|jd+d,d,&t
||_t|d-.5}|j}d/d/d/|jjd0|d1<y/#1swY*xYw)2z'Configure tags and feed file to parser.mainEditorWindowwidthint)typeheightwordr)wraphighlightthicknesspadxborderwidthrmrp)
TkDefaultFontarial	helvetica)TkFixedFontmonacocourierrr9italicrrFboldrGrHrz#f6f6ff)r
backgroundrC
rbsolidz#eeffcc)rlmargin1rxreliefrl1)rlmargin2l22l3Kl4dzutf-8)encodingNdisabledstate)r	GetOptionr
rfindfont
tag_configurerparseropenreadfeed)	r&parentfilenameuwideuhigh
normalfont	fixedfontfcontentss	         r'rzHelpText.__init__s""6>7O""6>8%PE	Q

dFA!5	H]]#JK
MM"FG	"B'V4z2x&@A4z2v&>?4z2v&>?4z2v&>?5	29M:YObg)		E4"r:4"r:4"r:4#< &
(W
-	 vvxH	 ""W
	 	 s9F33F<c(|D]}|jdtj|Dvr-tj|d|}|j	dcS|jdtj
|Dvs|cSy)z4Return name of first font family derived from names.c3<K|]}|jywNlower.0xs  r'	<genexpr>z$HelpText.findfont.<locals>.<genexpr>sKa	K)rootT)nameexistsrfamilyc3<K|]}|jywrrrs  r'rz$HelpText.findfont.<locals>.<genexpr>s "G&'#$'')"GrN)rtkfontnamesFontactualfamilies)r&rrrs    r'rzHelpText.findfonts}	Dzz|K6<<T3JKK{{TE{{}X.."G+1??+E"GG
	r(N)rcrdrerfrrrgr(r'riris#:r(riceZdZdZdZdZy)	HelpFramez&Display html text, scrollbar, and toc.ctj||t||x|_}t	||_d|d<|j
j
d|d|j|x|_}t||jx|_}|j|d<|jdd	|jdd	|jddd
|jddd|jdd
dy)Nzhelpframe.TFramestyler)r)commandyscrollcommandrrbweightnw)rowcolumnstickynsewns)rrrirrr	configuretoc_menur#ryviewscrollsetrowconfigurecolumnconfiguregrid)r&rrrr#rs      r'rzHelpFrame.__init__s
tV$#D(33	D6]
*W


/D<NOt,,3(tzzBBf!'
!A&Qq)Qq.		a&	1!D1r(ct|d}t|d}jjD]\}}|j	||ffd	||d<|S)z+Create table of contents as drop-down menu.TOC)rF)tearoffc&j|Sr)r)dexrs r'<lambda>z$HelpFrame.toc_menu.<locals>.<lambda>stzz#r()labelrmenu)r
rrr#add_command)r&rr#droplblrs `    r'rzHelpFrame.toc_menus\E*C'	PHC330NO	PF
r(N)rcrdrerfrrrgr(r'rrs,2 r(rceZdZdZdZy)
HelpWindowz!Display frame with rendered html.ctj|||j||jd|jt||j
ddd|jdd|jddy)NWM_DELETE_WINDOWrr)rrrrbr)	r	rwm_titleprotocoldestroyrrgrid_columnconfiguregrid_rowconfigure)r&rrtitles    r'rzHelpWindow.__init__ss$'

e

($,,7$!&&aQv&F!!!A!.q+r(N)rcrdrerfrrgr(r'rrs
',r(rcttttttddddd}ttttd}t	|d5}t	|d5}|D]$}|j|j
d	z&	d
d
d
d
d
d
t|d|y
#1swY"xYw#1swY&xYw)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_striprs.wwwwx'89:;7FI{<C
wwx();
7C	
c4-C	
c4-	-DIIdkkme+,	---
SESE
"#	----s$'
C4*CCC		CCcttttd}t	|syt||dt
zy)z7Create HelpWindow; called from Idle Help event handler.rNzIDLE Help (%s))rrrrrrr)rrs  r'
show_idlehelprs8GGH-.<H(vx!1N4D!DEr(__main__)rkzidlelib.idle_test.test_helprF)	verbosityexit)runN)"rfhtml.parserros.pathrrrrplatformrtkinterr	r
rtkinter.ttkrr
rrrridlelib.configrrrirrrrrcunittestrkidlelib.idle_test.htestrrgr(r'<module>rs4#22#((;;"#{C{C|'t'T8,,$@Fz	&!%@+
r(