Your IP : 18.220.94.189


Current Path : /opt/alt/python35/lib64/python3.5/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/idlelib/__pycache__/help.cpython-35.opt-2.pyc



���]�*�@sRddlmZddlmZmZmZmZmZddlm	Z	ddl
mZmZm
Z
mZmZmZmZddl
mZddlmZdZer�ddlmZGd	d
�d
e�ZGdd�de�ZGd
d�de
�ZGdd�de�Zdd�Zdd�ZedkrNddlm Z e e�dS)�)�
HTMLParser)�abspath�dirname�isdir�isfile�join)�python_version)�Tk�Toplevel�Frame�Text�	Scrollbar�Menu�
Menubutton)�font)�idleConfF)rc@sOeZdZdd�Zddd�Zdd�Zdd	�Zd
d�ZdS)
�
HelpParsercCs�tj|dd�||_d|_d|_d|_d|_d|_d|_d|_	d|_
d|_g|_d|_
dS)NZconvert_charrefsT�Fr)r�__init__�text�tags�chartags�show�hdrlink�level�pre�hprefix�	nested_dl�
simplelist�toc�header)�selfr�r"�)/opt/alt/python35/lib64/python3.5/help.pyr4s											zHelpParser.__init__�cCs>|j|7_|jdkr$dndt|j�|_dS)Nrr�l)r�strr)r!�amtr"r"r#�indentCszHelpParser.indentcCs�d}x&|D]\}}|dkr
|}q
Wd}|dkrY|dkrYd|_n8|dkr}|dkr}d|_n|dkr�|d	kr�d
}n�|dkr�|dkr�d|_n�|dkr�|d
kr�d|_n�|dkr�d|_n�|d"krG|jd�d#kr1d}d|_n	d|_|j�nJ|dkrn|jdkr�d|_n#|dkr�|jr�dnd}n�|dkr�|js�d
nd}d|_n�|dkr�|j�d}n�|dkrd|_|jr|jj	dd
�d|_
nv|dkr?|dkr?d|_nR|dkrW||_
n:|d$kr�|jr�d|_|jj	dd
�||_
|jr�|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/r0���)r7r8)
rr�findrr(rrrr�insertrrr )r!�tagZattrs�class_r5�v�sr"r"r#�handle_starttagGsd
		

							zHelpParser.handle_starttagcCs�|dkrJ|jd�|jr�|jj|j|jjd�f�nm|dkrbd|_nU|d	krzd
|_n=|dkr�d
|_	d|_
n|dkr�|jdd�dS)Nr6r7r8rr;r-r.rr5Frr/r2r0r'r$)r6r7r8)r-r.)r/r2r0r9)r(rr�appendr r�indexrrrr)r!r<r"r"r#�
handle_endtag}s
	(	zHelpParser.handle_endtagcCs�|jr�|jr�|jr"|n|jdd�}|jdkr_|d|jd��|_|jd	kr�|jdkr�|dt|j��|jkr�|t|j�d�j�}|j	|7_	|j
jd||j|jf�dS)
Nr1� r6rr7r8rr3)r6r7r8)
rrr�replacerrBr�len�stripr rr;r)r!�data�dr"r"r#�handle_data�s!"zHelpParser.handle_dataN)�__name__�
__module__�__qualname__rr(r@rCrJr"r"r"r#r+s
	6rc@s(eZdZdd�Zdd�ZdS)�HelpTextc	Cs1tjddddd�}tjddddd�}d|d}tj||d	d
ddd
dddd|d|�|jdddg�}|jdddg�}|df|d<|jdd|ddf�|jdd|ddf�|jdd|ddf�|jdd|d df�|jd!d|dfd"d#�|jd$d|d%fd&d'dd(d)d*d"d+�|jd,d&d'd-d'�|jd.d&d/d-d/�|jd0d&d1d-d1�|jd2d&d3d-d3�t|�|_t|d4d5��}|j	�}WdQRX|jj
|�d6|d7<dS)8N�mainZEditorWindow�width�type�intZheight���wrapZwordZhighlightthicknessrZpadx�ZborderwidthZ
TkDefaultFontZarialZ	helveticaZTkFixedFontZmonacoZcourier�rr.Zitalicr6�Zboldr7�r8�r�
backgroundz#f6f6ffr4�
Zlmargin1�r$ZreliefZsolidz#eeffcc�l1Zlmargin2�l2�2�l3�K�l4�d�encodingzutf-8�disabled�state)rZ	GetOptionrr�findfontZ
tag_configurer�parser�open�readZfeed)	r!�parent�filenameZuwideZuhighZ
normalfontZ	fixedfont�f�contentsr"r"r#r�s0zHelpText.__init__cCs�x�|D]�}|j�dd�tjd|�D�krdtjd|ddd|�}|j�dS|j�dd�tjd|�D�kr|SqWdS)	Ncss|]}|j�VqdS)N)�lower)�.0�xr"r"r#�	<genexpr>�sz$HelpText.findfont.<locals>.<genexpr>�root�name�existsT�familycss|]}|j�VqdS)N)rp)rqrrr"r"r#rs�s)rp�tkfont�namesZFont�actual�families)r!ryrurr"r"r#rh�s
+zHelpText.findfontN)rKrLrMrrhr"r"r"r#rN�srNc@s(eZdZdd�Zdd�ZdS)�	HelpFramecCs�tj||�t||�}|d|d<t|d|j�}|j|d<|jddd�|jddd�|j|�j	ddddd	d
�|j	ddddd	d�|j	ddddd	d
�dS)Nr[�commandZyscrollcommandr�weightr$�column�row�stickyZnw�nsew��ns)
rrrNr
�yview�setZrowconfigureZcolumnconfigure�toc_menu�grid)r!rlrmrZscrollr"r"r#r�s
%zHelpFrame.__init__c	stt|dd�}t|dd�}x?�jjD]1\}}|jd|d|�fdd��q1W||d	<|S)
NrZTOCZtearoffFZlabelr}cs
�j|�S)N)r�)�dex)rr"r#�<lambda>�sz$HelpFrame.toc_menu.<locals>.<lambda>Zmenu)rrrirZadd_command)r!rrZdropZlblr�r")rr#r��s)
zHelpFrame.toc_menuN)rKrLrMrr�r"r"r"r#r|�sr|c@seZdZdd�ZdS)�
HelpWindowcCstj||�|j|�|jd|j�t||�jdddddd�|jddd�|jddd�dS)	NZWM_DELETE_WINDOWrrr�r�r�r~r$)	r
rZwm_title�protocolZdestroyr|r�Zgrid_columnconfigureZgrid_rowconfigure)r!rlrm�titler"r"r#r�s
%zHelpWindow.__init__N)rKrLrMrr"r"r"r#r��sr�cCs�tttttt����ddddd�}tttt��d�}t|d��H}t|d��/}x%|D]}|j|j�d	�qyWWdQRXWdQRXtd
�dS)NZDocZbuildZhtmlZlibraryz	idle.htmlz	help.html�rb�wbs
zidle.html copied to help.html)rrr�__file__rj�write�rstrip�print)�src�dstZinn�out�liner"r"r#�
copy_strip�s
)r�cCsFtttt��d�}t|�s+dSt||dt��dS)Nz	help.htmlzIDLE Help (%s))rrrr�rr�r)rlrmr"r"r#�
show_idlehelpsr��__main__)�runN)!Zhtml.parserrZos.pathrrrrr�platformr�tkinterr	r
rrr
rrrrxZidlelib.configHandlerrZuse_ttkZtkinter.ttkrrNr|r�r�r�rKZidlelib.idle_test.htestr�r"r"r"r#�<module>s"(4o* 

?>