• File: help.cpython-37.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/proc/self/root/opt/alt/python37/lib64/python3.7/idlelib/__pycache__/help.cpython-37.pyc
  • Date Modified: 10/26/2026 8:08 PM
  • File size: 10.17 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit
B

Nj-@sdZddlmZddlmZmZmZmZddlm	Z	ddl
mZmZm
Z
mZddlmZmZddl
mZddlmZGd	d
d
eZGddde
ZGd
ddeZGdddeZddZddZedkrddlmZeddddddlm Z e edS)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)ToplevelFrameTextMenu)
Menubutton	Scrollbar)font)idleConfc@s:eZdZdZddZdddZddZd	d
ZddZd
S)
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.
    cCs`tj|dd||_d|_d|_d|_d|_d|_d|_d|_	d|_
d|_g|_d|_
d|_dS)NT)Zconvert_charrefsFr)r__init__texttagschartagsshowhdrlinklevelprehprefix	nested_dl
simplelisttocheaderprevtag)selfrr!1/opt/alt/python37/lib64/python3.7/idlelib/help.pyr3szHelpParser.__init__cCs0|j|7_|jdkrdndt|j|_dS)z#Change indent (+1, 0, -1) and tags.rrlN)rstrr)r Zamtr!r!r"indentCszHelpParser.indentcCs>d}x|D]\}}|dkr
|}q
Wd}|dkr@|dkr@d|_n|dkrZ|dkrZd|_n|dkr|jr|jd	s|jd
d}|r|sdnd
}nx|dkr|dkrd|_n^|dkr|dkrd|_nD|dkrd|_n2|dkr|ddkrd
}d|_nd|_|n|dkr2|j	d	krd|_
n|dkrN|jrHdnd}n|dkrp|j
sddnd
}d|_
n|dkr|d
}n|dkrd|_|jr|jddd|_
nZ|dkr|dkrd|_n>|dkr||_
n,|d kr|jr
d|_|jdd||_
|jr0|jd||j
|jfd|f|_d!S)"zHandle starttags in help.html.rclassZdivZsectionTZ
sphinxsidebarFprzend-1c linestartzend-1cz


spanrZversionmodifiedem)ulolZsimpleZdlZliz
* z

* ZdtddendpreblockaZ
headerlinkh1)h2h3N)rrrgetisspacerfindrr&rrrinsertrrr)r tagZattrsZclass_r2vsZlastliner!r!r"handle_starttagHsh













zHelpParser.handle_starttagcCs|dkr^|jdkst|jrV|dkr(dn|dkr4dnd}|j||j|jdfd|_nH|d	krnd|_	n8|d
kr~d|_
n(|dkrd|_d|_n|d
kr|dd|f|_
dS)zHandle endtags in help.html.)r3r4r5rr5z        r4z    rr9)r*r+r2Fr)r,r/r-r.N)rAssertionErrorrrappendrrindexrrrrr&r)r r:r&r!r!r"
handle_endtags$
zHelpParser.handle_endtagcCs|jr|js|jr|n
|dd}|jdkr`y|d|d|_Wntk
r^d|_YnX|jdkr|jdkr|dt|j|jkr|t|jd}|j	|
7_	|jd||j|j
fdS)	z"Handle date segments in help.html.r) r3rr)r3r4r5Nr0)rrrreplacerr@r
ValueErrorlenrstriprr9r)r datadr!r!r"handle_datas


zHelpParser.handle_dataN)r#)	__name__
__module____qualname____doc__rr&r=rArIr!r!r!r"r*s
:rc@s eZdZdZddZddZdS)HelpTextzDisplay help.html.c	
Csvtjddddd}tjddddd}d|d}tj||d	d
dd
||d|d
ddg}|dddg}|df|d<|jd|ddfd|jd|ddfd|jd|ddfd|jd|ddfd|jd|dfd d!|jd"|d#fd$d%d&d'd(|jd)d$d$d*|jd+d,d,d*|jd-d.d.d*|jd/d0d0d*t||_t|d1d2}|	}Wd3QRX|j
|d4|d5<d3S)6z'Configure tags and feed file to parser.mainZEditorWindowwidthint)typeheightZwordr)ZwrapZhighlightthicknessZpadxborderwidthrPrSZ
TkDefaultFontZarialZ	helveticaZTkFixedFontZmonacoZcourierrr+Zitalic)rr3Zboldr4r5rz#f6f6ff)r
backgroundr1
r#Zsolidz#eeffcc)rlmargin1rWZreliefr\l1)r_Zlmargin2l22l3Kl4dzutf-8)encodingNZdisabledstate)rZ	GetOptionr
rfindfontZ
tag_configurerparseropenreadZfeed)	r parentfilenameZuwideZuhighZ
normalfontZ	fixedfontfcontentsr!r!r"rs0
zHelpText.__init__cCsnxh|D]`}|ddtj|dDkrDtj|d|d}|dS|ddtj|dDkr|SqWdS)	z4Return name of first font family derived from names.css|]}|VqdS)N)lower).0xr!r!r"	<genexpr>sz$HelpText.findfont.<locals>.<genexpr>)rootT)nameexistsruZfamilycss|]}|VqdS)N)rq)rrrsr!r!r"rtsN)rqtkfontnamesZFontZactualZfamilies)r ryrvrr!r!r"ris
zHelpText.findfontN)rJrKrLrMrrir!r!r!r"rNsrNc@s eZdZdZddZddZdS)	HelpFramez&Display html text, scrollbar, and toc.cCst||t|||_}|d|d<|||_}t||jd|_}|j	|d<|j
ddd|jddd|jdddd|jddd	d|jdd
dddS)Nr\)commandZyscrollcommandrr#)weightZnw)rowcolumnstickynsewns)
r	rrNrtoc_menurr
yviewscrollsetZrowconfigureZcolumnconfiguregrid)r rmrnrrrr!r!r"rs
zHelpFrame.__init__csTt|dd}t|dd}x.jjD]"\}}|j||ffdd	dq"W||d<|S)	z+Create table of contents as drop-down menu.ZTOC)rF)Ztearoffcs
|S)N)r)dex)rr!r"<lambda>z$HelpFrame.toc_menu.<locals>.<lambda>)Zlabelr{Zmenu)rrrjrZadd_command)r rrZdropZlblrr!)rr"rszHelpFrame.toc_menuN)rJrKrLrMrrr!r!r!r"rzsrzc@seZdZdZddZdS)
HelpWindowz!Display frame with rendered html.cCsZt|||||d|jt||jdddd|jddd|jddddS)NZWM_DELETE_WINDOWrr)r~r}rr#)r|)	rrZwm_titleZprotocolZdestroyrzrZgrid_columnconfigureZgrid_rowconfigure)r rmrntitler!r!r"rs
zHelpWindow.__init__N)rJrKrLrMrr!r!r!r"rsrc
Csttttttddddd}ttttd}t|d<}t|d&}x|D]}||d	qRWWd
QRXWd
QRXt|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.
    ZDocZbuildZhtmlZlibraryz	idle.htmlz	help.htmlrbwb
Nz copied to )rrr__file__rkwriterstripprint)srcdstZinnoutliner!r!r"
copy_strips
*rcCs4ttttd}t|sdSt||dtdS)z7Create HelpWindow; called from Idle Help event handler.z	help.htmlNzIDLE Help (%s))rrrrrrr)rmrnr!r!r"
show_idlehelpsr__main__)rOzidlelib.idle_test.test_helprF)	verbosityexit)runN)!rMZhtml.parserrZos.pathrrrrplatformrZtkinterrr	r
rZtkinter.ttkrr
rrxZidlelib.configrrrNrzrrrrJZunittestrOZidlelib.idle_test.htestrr!r!r!r"<module>s$~*