Your IP : 18.116.24.238


Current Path : /opt/alt/python36/lib64/python3.6/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/idlelib/__pycache__/help.cpython-36.opt-2.pyc

3

��2a=,�@s�ddlmZddlmZmZmZmZddlmZddl	m
Z
mZmZm
Z
ddlmZmZddl	mZddlmZGdd	�d	e�ZGd
d�de�ZGdd
�d
e�ZGdd�de
�Zdd�Zdd�Zedkr�ddlmZedddd�ddlmZee�dS)�)�
HTMLParser)�abspath�dirname�isfile�join)�python_version)�Toplevel�Frame�Text�Menu)�
Menubutton�	Scrollbar)�font)�idleConfc@s6eZdZdd�Zd
dd�Zdd�Zdd	�Zd
d�ZdS)�
HelpParsercCsZtj|dd�||_d|_d|_d|_d|_d|_d|_d|_	d|_
d|_g|_d|_
dS)NT)Zconvert_charrefs�Fr)r�__init__�text�tags�chartags�show�hdrlink�level�pre�hprefix�	nested_dl�
simplelist�toc�header)�selfr�r �)/opt/alt/python36/lib64/python3.6/help.pyr3szHelpParser.__init__�cCs0|j|7_|jdkrdndt|j�|_dS)Nrr�l)r�strr)r�amtr r r!�indentBszHelpParser.indentcCsd}x|D]\}}|dkr
|}q
Wd}|dkr@|dkr@d|_�n�|dkrZ|dkrZd|_�n�|dkrr|d	krrd
}�nv|dkr�|dkr�d|_�n\|dkr�|d
kr�d|_�nB|dkr�d|_�n0|d"kr�|jd�d#kr�d}d|_nd|_|j��n�|dk�r
|jdk�r�d|_n�|dk�r&|j�r dnd}n�|dk�rH|j�s<d
nd}d|_n�|dk�r`|j�d}n�|dk�r�d|_|j�r�|jj	dd
�d|_
nZ|dk�r�|dk�r�d|_n>|dk�r�||_
n,|d$k�r�|j�r�d|_|jj	dd
�||_
|j�r|jj	d||j
|jf�dS)%Nr�classZdiv�sectionTZ
sphinxsidebarF�p�firstz

�spanrZversionmodified�em�ul�olZsimpler"�
ZdlrZliz
* z

* Zdt�dd�end�preblock�aZ
headerlink�h1�h2�h3)r-r.���)r5r6)
rr�findrr&rrrr�insertrrr)r�tagZattrs�class_r3�v�sr r r!�handle_starttagFsd











zHelpParser.handle_starttagcCs�|dkrT|jd�|jr�|dkr$dn|dkr0dnd}|jj||j|jjd�f�nJ|dkrdd|_n:|dkrtd|_n*|d
kr�d|_	d|_
n|dkr�|jdd�dS)Nr4r5r6rz        z    rr9r+r,r3Frr-r0r.r")r%)r4r5r6)r+r,)r-r0r.r7)r&rr�appendrr�indexrrrr)rr:r&r r r!�
handle_endtag|s 
 zHelpParser.handle_endtagc
Cs�|jr�|jr�|jr|n
|jdd�}|jdkrby|d|jd��|_Wntk
r`d|_YnX|jd	kr�|jdkr�|dt|j��|jkr�|t|j�d�}|j	|j
�7_	|jjd||j|j
f�dS)
Nr/� r4rrr5r6r1)r4r5r6)rrr�replacerr@r�
ValueError�lenr�striprr9r)r�data�dr r r!�handle_data�s


zHelpParser.handle_dataN)r")�__name__�
__module__�__qualname__rr&r>rArIr r r r!r*s
	
6rc@seZdZdd�Zdd�ZdS)�HelpTextc	
Csvtjddddd�}tjddddd�}d|d}tj||d	d
dd
||d�|jd
ddg�}|jdddg�}|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��}|j	�}WdQRX|jj
|�d3|d4<dS)5N�mainZEditorWindow�width�int)�type�height��Zwordr�)�wrapZhighlightthicknessZpadx�borderwidthrOrRZ
TkDefaultFontZarialZ	helveticaZTkFixedFontZmonacoZcourier�rr,Zitalic)rr4�Zboldr5�r6�rz#f6f6ff)r�
backgroundr2�
�r"Zsolidz#eeffcc)r�lmargin1rWZreliefr\�l1)r_Zlmargin2�l2�2�l3�K�l4�dzutf-8)�encodingZdisabled�state)rZ	GetOptionr
r�findfontZ
tag_configurer�parser�open�readZfeed)	r�parent�filenameZuwideZuhighZ
normalfontZ	fixedfont�f�contentsr r r!r�s0
zHelpText.__init__cCsnxh|D]`}|j�dd�tj|d�D�krDtj|d|d�}|j�dS|j�dd�tj|d�D�kr|SqWdS)Ncss|]}|j�VqdS)N)�lower)�.0�xr r r!�	<genexpr>�sz$HelpText.findfont.<locals>.<genexpr>)�rootT)�name�existsruZfamilycss|]}|j�VqdS)N)rq)rrrsr r r!rt�s)rq�tkfont�namesZFont�actualZfamilies)rryrvrr r r!ri�s
zHelpText.findfontN)rJrKrLrrir r r r!rM�srMc@seZdZdd�Zdd�ZdS)�	HelpFramecCs�tj||�t||�|_}|d|d<|j|�|_}t||jd�|_}|j	|d<|j
ddd�|jddd�|jdddd�|jddd	d�|jdd
dd�dS)Nr\)�commandZyscrollcommandrr")�weightZnw)�row�column�sticky�nsew��ns)
r	rrMr�toc_menurr
�yview�scroll�setZrowconfigureZcolumnconfigure�grid)rrmrnrrr�r r r!r�s
zHelpFrame.__init__csTt|dd�}t|dd�}x.�jjD]"\}}|j||f�fdd�	d�q"W||d<|S)	NZTOC)rF)Ztearoffcs
�j|�S)N)r�)�dex)rr r!�<lambda>�sz$HelpFrame.toc_menu.<locals>.<lambda>)Zlabelr|Zmenu)rrrjrZadd_command)rrrZdropZlblr�r )rr!r��szHelpFrame.toc_menuN)rJrKrLrr�r r r r!r{�sr{c@seZdZdd�ZdS)�
HelpWindowcCsZtj||�|j|�|jd|j�t||�jdddd�|jddd�|jddd�dS)NZWM_DELETE_WINDOWrr�)rr~r�r")r})	rrZwm_titleZprotocolZdestroyr{r�Zgrid_columnconfigureZgrid_rowconfigure)rrmrn�titler r r!r�s
zHelpWindow.__init__N)rJrKrLrr r r r!r��sr�cCs�tttttt����ddddd�}tttt��d�}t|d��<}t|d��&}x|D]}|j|j�d	�qRWWdQRXWdQRXt|�d
|���dS)NZDocZbuildZhtmlZlibraryz	idle.htmlz	help.html�rb�wb�
z copied to )rrr�__file__rk�write�rstrip�print)�src�dstZinn�out�liner r r!�
copy_strip�s
*r�cCs4tttt��d�}t|�sdSt||dt��dS)Nz	help.htmlzIDLE Help (%s))rrrr�rr�r)rmrnr r r!�
show_idlehelpsr��__main__)rNzidlelib.idle_test.test_helpr�F)�	verbosity�exit)�runN) Zhtml.parserrZos.pathrrrr�platformrZtkinterrr	r
rZtkinter.ttkrr
rrxZidlelib.configrrrMr{r�r�r�rJZunittestrNZidlelib.idle_test.htestr�r r r r!�<module>s"v* 

?>