Your IP : 18.189.192.214


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



���]� �@s�ddlZddlmZmZmZmZmZddlZddlm	Z
ddlmZddddd	d
ddd
ddhZ
dZdZejd�dd�ZGdd�d�ZdS)�N)�TOP�LEFT�X�W�SUNKEN)�maxsize)�idleConf�class�def�elif�else�except�finally�for�if�try�while�with�di�z^(\s*)(\w*)cCs|j|�j�S)N)�match�groups)�s�c�r�0/opt/alt/python35/lib64/python3.5/CodeContext.py�<lambda>src@s�eZdZdd gfgZejddddddd	�Zejddd
dddd�Zejddd
dddd�Zdd�Z	ddd�Z
dd�Zdddd�Zdd�Z
dd�Zdd�ZdS)!�CodeContext�options�!Code Conte_xt�<<toggle-code-context>>�
extensionsZnumlines�type�int�default��bgcolor�strZ	LightGray�fgcolorZBlackcCs�||_|j|_|jd|_d|_dg|_d|_tjdddd	d
dd�}|r�|j�|jj	dd
�|jj
t|j�|jj
t
|j�dS)N�fontr��Fr r�visibler!�boolr#z<<toggle-code-context>>T���)rr-r*F)�editwin�text�textfont�label�info�
topvisibler�	GetOption�toggle_code_context_eventZsetvar�after�UPDATEINTERVAL�timer_event�FONTUPDATEINTERVAL�font_timer_event)�selfr.r+rrr�__init__"s			
zCodeContext.__init__NcCs�|jsC|jj|jjf}d}xM|D]E}||jj|j�d�7}||jj|jd��7}q.Wd}x-|D]%}||jj|jd��7}q�Wtj	|jj
dd|jddtdt
d	|jd
|jd|jddd|d|d
t�
|_|jjdtdtddd|jj�n|jj�d|_tjdddt|jdk	��tj�dS)Nr�padx�borderr/�
r)ZanchorZjustifyr(�bgZfg�widthZreliefZside�fill�expandFZbeforer rr+)r1r.r/Z
text_frameZtkZgetintZ	pack_infoZcget�tkinterZLabel�top�
context_depthrrr0r%r'r�packrrZdestroyrZ	SetOptionr&ZSaveUserCfgFiles)r;�eventZwidgetsr=Zwidgetr>rrrr57s0	
 #
#	
	z%CodeContext.toggle_code_context_eventcCs�|jjd|d|�}t|�\}}|tko>|}t|�t|�kso|t|�dkrxt}nt|�}|||fS)Nz%d.0z%d.end�#)r/�get�getspacesfirstword�BLOCKOPENERS�len�INFINITY)r;�linenumr/ZspacesZ	firstword�opener�indentrrr�
get_line_info[s.	zCodeContext.get_line_infor)rc
Cs�g}t}x�t||dd�D]�}|j|�\}}}	||kr#|}|	dkri|d7}|	r�||kr�||kr�|j||||	f�||kr#Pq#W|j�||fS)Nr)rrr-)rr)rN�rangerR�append�reverse)
r;�new_topvisibleZstopline�
stopindent�lines�
lastindentrOrQr/rPrrr�get_contextks

zCodeContext.get_contextcCs�t|jjd�jd�d�}|j|kr8dS|j|kr�|j||j�\}}x�|jd
d|kr�|jd=qeWn�|j|kr|jddd}x6|jd
d|kr�|jdd}|jd=q�W|j||jddd|�\}}|jj|�||_dgtd|j	t
|j��}|dd�|j|j	d�D�7}dj|�|jd	<dS)Nz@0,0�.rr)r*cSsg|]}|d�qS)�r)�.0�xrrr�
<listcomp>�s	z3CodeContext.update_code_context.<locals>.<listcomp>r?r/r-r-r-r-r-r-r-)
r"r/�index�splitr3rZr2�extend�maxrFrM�joinr1)r;rVrXrYrWZcontext_stringsrrr�update_code_context�s*%			&(zCodeContext.update_code_contextcCs-|jr|j�|jjt|j�dS)N)r1rer/r6r7r8)r;rrrr8�s	
zCodeContext.timer_eventcCsX|jd}|jr>||jkr>||_|j|jd<|jjt|j�dS)Nr()r/r1r0r6r9r:)r;Znewtextfontrrrr:�s

	zCodeContext.font_timer_event)rr)�__name__�
__module__�__qualname__Zmenudefsrr4rFr%r'r<r5rRrZrer8r:rrrrrs$ r)rDZtkinter.constantsrrrrr�re�sysrrNZidlelib.configHandlerrrLr7r9�compilerKrrrrr�<module>s(

?>