Ë &Žªýµâlãó6—dZddlmZddlmZmZmZmZddlm Z ddl m Z m Z m Z ddlmZmZmZmZddl mZddlmZdd lmZGd „d e«ZGd „d e «ZGd„de«ZGd„de «Zd„Zd„Zedk(r ddl m!Z!e!ddd¬«ddl"m#Z#e#e«yy)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 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 the text part of idle.html to help.html while rstripping each line. show_idlehelp - Create HelpWindow. Called in EditorWindow.help_dialog. é)Ú HTMLParser)ÚabspathÚdirnameÚisfileÚjoin)Úpython_version)ÚToplevelÚTextÚMenu)ÚFrameÚ MenubuttonÚ ScrollbarÚStyle©Úfont)ÚidleConf)Ú color_configcó0—eZdZdZd„Zdd„Zd„Zd„Zd„Zy) Ú 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. cóÚ—tj|d¬«||_d|_d|_d|_d|_d|_d|_d|_ d|_ g|_ d|_ d|_ y)NT)Úconvert_charrefsÚFr)rÚ__init__ÚtextÚtagsÚchartagsÚhdrlinkÚlevelÚpreÚhprefixÚ nested_dlÚ simplelistÚtocÚheaderÚprevtag)Úselfrs ú#/usr/lib/python3.12/idlelib/help.pyrzHelpParser.__init__4sf€Ü×јD°4Õ8؈Œ ؈Œ ؈Œ ؈Œ ؈Œ ؈ŒØˆŒ ؈ŒØˆŒØˆŒØˆŒ ؈� ócó–—|xj|z c_|jdk(rd|_ydt|j«z|_y)z#Change indent (+1, 0, -1) and tags.rrÚlN)rÚstrr)r&Úamts r'ÚindentzHelpParser.indentCs4€à � Š �cÑ� ØŸ*™*¨š/�Bˆ� ¨s´3°t·z±z³?Ñ/Bˆ� r(cóØ—d}|D] \}}|dk(sŒ |}Œd}|dk(rO|jrC|jds4|jjdd«}|r|j«sdnd}�nD|d k(r|d k(r d |_�n1|d k(r|d k(r d |_�n|d k(r d |_�n|d vr6|j d«dk7r d}d|_nd|_|j«nÖ|dk(r|jdkDrÂd|_ nº|dk(rd}n²|dk(r|jsdnd}d|_ n•|dk(r|j«d}n}|d k(r+d|_ |jjdd«d|_ nM|dk(r |dk(rd|_ n;|dk(r||_ n.|dvr*d|_|jjdd«||_ |jjd||j|jf«d|f|_y)zHandle starttags in help.html.rÚclassÚprzend-1c linestartzend-1cz Ú ÚspanrÚversionmodifiedÚem)ÚulÚolÚsimpleéÿÿÿÿTFÚdlÚliz * ÚdtÚddÚendÚpreblockÚaÚ headerlinkÚh1)Úh2Úh3N)r%rÚgetÚisspacerÚfindr"r-rr!rÚinsertrrr$)r&ÚtagÚattrsÚclass_r?ÚvÚsÚlastlines r'Úhandle_starttagzHelpParser.handle_starttagHsЀàˆÛ‰DˆAˆqØ�G‹|Ø‘ðð ˆØ �#Š:˜$Ÿ,š,¨t¯|©|¸Aªð—y‘y—}‘}Ð%7¸ÓBˆHÙ"¨8×+;Ñ+;Ô+=‘À4ŠAØ �FŠ]˜v¨šØ!ˆDŽMØ �FŠ]˜vÐ):Ò:Ø ˆDŽMØ �DŠ[Ø ˆDŽMØ �LÑ Ø�{‰{˜8Ó$¨Ò*Ø�Ø"&�•à"'�”Ø �K‰K�MØ �DŠ[Ø�z‰z˜AŠ~Ø!%�•Ø �DŠ[؉AØ �DŠ[Ø"Ÿnšn‘°$ˆAØ"ˆD�NØ �DŠ[Ø �K‰KŒM؉AØ �EŠ\؈DŒHØ �I‰I× Ñ ˜U FÔ +Ø"ˆD�IØ �CŠZ˜F lÒ2؈D�LØ �DŠ[؈D�IØ �LÑ ØˆDŒKØ �I‰I× Ñ ˜U FÔ +؈DŒIØ � ‰ ×ј  D§I¡I¨t¯}©}Ð#=Ô>ؘc�{ˆ� r(cóz—|dvrl|jdk(sJ‚|dk(rdn|dk(rdnd}|jj||jz|jj d«f«d|_nB|d vrd|_n6|d k(rd |_n)|d k(rd |_ d|_n|d vr|jd«d |f|_ y)zHandle endtags in help.html.©rArBrCrrCz rBz rrG)r2r4r?Fr)r5r<r6r8N) rr#Úappendr$rÚindexrrrrr-r%)r&rHr-s r'Ú handle_endtagzHelpParser.handle_endtag{sº€à Ð$Ñ $Ø—:‘: ’?Ð "�?Ø$'¨4¢K‘jØ # t¢ ‘fØð ð �H‰H�O‰O˜V D§K¡KÑ/°·±·±ÀÓ1JÐKÔ L؈D�IØ �NÑ "؈D�MØ �CŠZØ ˆD�LØ �EŠ\؈DŒH؈D�IØ Ð&Ñ &Ø �K‰K˜ŒOؘs�|ˆ� r(có€—|j�s|jr|n|jdd«}|jdk(r; |d|j d«|_|j j «sd|_|jdvro|j dk7r=|dt|j «|j k(r|t|j «d}|xj|j«z c_ |jjd||j|jf«yy#t$r d|_YŒÄwxYw) z"Handle date segments in help.html.r1Ú rANrrPrr=)rrÚreplacerrRr ÚisdigitÚ ValueErrorÚlenr$ÚstriprrGr)r&ÚdataÚds r'Ú handle_datazHelpParser.handle_data�s€à�|‹|ØŸš‘ d§l¡l°4¸Ó&=ˆAØ�y‰y˜DÒ ð&Ø#$ ] a§g¡g¨c£lÐ#3�D”LØŸ<™<×/Ñ/Ô1Ø')˜œ ð�y‰yÐ.Ñ.Ø—L‘L BÒ&Ø�aœ˜DŸL™LÓ)Ð*¨d¯l©lÒ:Øœ#˜dŸl™lÓ+Ð,Ð-�AØ— ’ ˜qŸw™w›yÑ(• Ø �I‰I× Ñ ˜U A¨¯ © °4·=±=Ð'AÕ Bðøô"ò&Ø#%�D–Lð&ús¾:D*Ä*D=Ä<D=N)é) Ú__name__Ú __module__Ú __qualname__Ú__doc__rr-rNrSr]©r(r'rr+s#„ñò óCò 1#òf$ó(Cr(rcó—eZdZdZd„Zd„Zy)ÚHelpTextzDisplay help.html.c ó˜—tjdddd¬«}tjdddd¬«}d|zdz}tj||d d d d ||¬ «|j gd ¢«}|j gd¢«}t |«|df|d<|j d|ddf¬«|j d|ddf¬«|j d|ddf¬«|j d|ddf¬«|j d|df¬«|d}|j d|dfd|¬ «|j d!dd¬"«|j d#d$d$¬"«|j d%d&d&¬"«|j d'd(d(¬"«t|«|_t|d)¬*«5}|j«} d+d+d+«|jj «d,|d-<y+#1swYŒ*xYw).z'Configure tags and feed file to parser.ÚmainÚ EditorWindowÚwidthÚint)ÚtypeÚheightééÚwordré)ÚwrapÚhighlightthicknessÚpadxÚ borderwidthrirl)Ú TkDefaultFontÚarialÚ helvetica)Ú TkFixedFontÚmonacoÚcourieré rr4ÚitalicrrAéÚboldrBérCérÚselectbackgroundr>é é)rÚlmargin1Ú backgroundÚl1)r„Úlmargin2Úl2é2Úl3éKÚl4édúutf-8©ÚencodingNÚdisabledÚstate) rÚ GetOptionr rÚfindfontrÚ tag_configurerÚparserÚopenÚreadÚfeed) r&ÚparentÚfilenameÚuwideÚuhighÚ normalfontÚ fixedfontÚprebackÚfÚcontentss r'rzHelpText.__init__¤sÙ€ä×"Ñ" 6¨>¸7ÈÔOˆÜ×"Ñ" 6¨>¸8È%ÔPˆØ�E‘ ˜Q‘ˆÜ � ‰ �d˜F¨ÀAب!°5Àõ Hð—]‘]Ò#JÓKˆ Ø—M‘MÒ"FÓGˆ Ü�TÔØ" BÐ'ˆˆV‰ Ø ×ј4 z°2°xÐ&@ÐÔAØ ×ј4 z°2°vÐ&>ÐÔ?Ø ×ј4 z°2°vÐ&>ÐÔ?Ø ×ј4 z°2°vÐ&>ÐÔ?Ø ×ј5¨ °2 ÐÔ7ØÐ)Ñ*ˆØ ×ј:¨Y¸¨OÀbØ&-ð ô /à ×ј4¨"°rÐÔ:Ø ×ј4¨"°rÐÔ:Ø ×ј4¨"°rÐÔ:Ø ×ј4¨#¸ÐÔ<ä  Ó&ˆŒ Ü �( WÕ -°Ø—v‘v“xˆH÷.à � ‰ ×јÔ"Ø"ˆˆWŠ ÷.Ð -ús ÆGÇG có(—|D]�}|j«d„tj|¬«D«vr-tj|d|¬«}|j «dcS|j«d„tj |¬«D«vsŒ‹|cSy)z4Return name of first font family derived from names.c3ó<K—|]}|j«–—Œy­w©N©Úlower©Ú.0Úxs r'Ú z$HelpText.findfont..Æsèø€ÐKÑ3J¨a §¡§ Ñ3Jùó‚)ÚrootT)ÚnameÚexistsr­Úfamilyc3ó<K—|]}|j«–—Œy­wr¥r¦r¨s r'r«z$HelpText.findfont..Ésèø€ð"GÙ+E að#$§'¡'§)Ù+Eùr¬N)r§ÚtkfontÚnamesÚFontÚactualÚfamilies)r&r³r®rs r'r”zHelpText.findfontÃsx€ãˆDØ�z‰z‹|ÑK´6·<±<ÀTÕ3JÓKÑKÜ—{‘{¨°TÀÔE�Ø—{‘{“} XÑ.Ò.Ø—‘“ñ"GÜ+1¯?©?ÀÕ+Eó"GòGà’ ñ r(N)r_r`rarbrr”rcr(r'rere¢s„Ùò#ó>r(recó—eZdZdZd„Zd„Zy)Ú HelpFramez&Display html text, scrollbar, and toc.có—tj||«t||«x|_}t |«|_d|d<|j j d|d¬«|j|«x|_}t||j¬«x|_ }|j|d<|jdd¬ «|jdd¬ «|jddd ¬ «|jddd ¬ «|jdd d¬ «y)Nzhelpframe.TFrameÚstyler…)r…)ÚcommandÚyscrollcommandrr^©ÚweightÚnw)ÚrowÚcolumnÚstickyÚnsewéÚns)r rrerrrºÚ configureÚtoc_menur#rÚyviewÚscrollÚsetÚ rowconfigureÚcolumnconfigureÚgrid)r&ršr›rr#rÉs r'rzHelpFrame.__init__Ðsë€Ü �‰�t˜VÔ$Ü# D¨(Ó3Ð3ˆŒ �Dܘ6“]ˆŒ Ø*ˆˆW‰ Ø � ‰ ×ÑÐ/¸DÀÑz$HelpFrame.toc_menu..ås ø€¸t¿z¹zÈ#¼r()Úlabelr»Úmenu)r r r–r#Ú add_command)r&rr#ÚdropÚlblrÒs ` r'rÇzHelpFrame.toc_menuàsUø€ä˜ EÔ*ˆÜ�C Ô'ˆØŸ ™ Ÿœ‰HˆC�Ø × Ñ  3¸3Ô0NÐ Õ Oð(àˆˆF‰ ؈ r(N)r_r`rarbrrÇrcr(r'r¸r¸Îs„Ù,ò2ó r(r¸có—eZdZdZd„Zy)Ú HelpWindowz!Display frame with rendered html.có4—tj||«|j|«|jd|j«t ||«|_|j jddd¬«|jdd¬«|jdd¬«y)NÚWM_DELETE_WINDOWrrÃ)rÁrÀrÂr^r½) r rÚwm_titleÚprotocolÚdestroyr¸ÚframerÍÚgrid_columnconfigureÚgrid_rowconfigure)r&ršr›Útitles r'rzHelpWindow.__init__ìs{€Ü×ј$ Ô'Ø � ‰ �eÔØ � ‰ Ð(¨$¯,©,Ô7ܘt XÓ.ˆŒ Ø � ‰ �‰˜q a°ˆÔ7Ø ×!Ñ! !¨AÐ!Ô.Ø ×јq¨ÐÕ+r(N)r_r`rarbrrcr(r'rÚrÚês „Ù'ó,r(rÚc óØ—tttttt««««ddddd«}tttt««d«}t |dd¬ «5}t |d d¬ «5}d }|D]3}d |vrd }d|vrn'|sŒ|j |j «dz«Œ5ddd«ddd«t|›d|›�«y#1swYŒ"xYw#1swYŒ&xYw)asCopy the text part of idle.html to idlelib/help.html while 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 change 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. ÚDocÚbuildÚhtmlÚlibraryz idle.htmlú help.htmlÚrrŽr�ÚwFz
Tz
r1Nz copied to )rrrÚ__file__r—ÚwriterZÚprint)ÚsrcÚdstÚinnÚoutÚcopyÚlines r'Ú copy_striprõös΀ô. Œw”wœw¤w¬xÓ'8Ó9Ó:Ó;Ø �7˜F I¨{ó <€Cä Œw”wœxÓ(Ó)¨;Ó 7€Cä ˆc�3 Õ )¨S´$°s¸CÈ'Õ2RÐVY؈ۈDØ$¨Ñ,°T¨dØ&¨$Ñ.±Ú�S—Y‘Y˜tŸz™z›|¨dÑ2Õ3ð÷3S× )ô ˆSˆE�˜S˜EÐ "Õ#÷3SÐ2Rú× )Ð )ús*Á)C Á8CÂ$CÂ3C ÃC ÃC à C)cóŽ—tttt««d«}t |«syt ||dt «z«S)z7Create HelpWindow; called from Idle Help event handler.réNz IDLE Doc (%s))rrrrìrrÚr)ršr›s r'Ú show_idlehelpr÷s:€ä”GœG¤HÓ-Ó.° Ó<€HÜ �(Ô àÜ �f˜h¨¼.Ó:JÑ(JÓ KÐKr(Ú__main__)rgzidlelib.idle_test.test_helprÄF)Ú verbosityÚexit)ÚrunN)$rbÚ html.parserrÚos.pathrrrrÚplatformrÚtkinterr r r Ú tkinter.ttkr r rrrr²Úidlelib.configrÚidlelib.colorizerrrrer¸rÚrõr÷r_ÚunittestrgÚidlelib.idle_test.htestrûrcr(r'Úrs™ðñõ4#ß2Ó2Ý#ç(Ñ(ß;Ó;Ý"å#Ý*ôtC�ôtCôn)ˆtô)ôX�ôô8 ,�ô ,ò"$òJLð ˆzÒÝÙÐ &°!¸%Õ@å+Ùˆ Õð r(