Your IP : 3.147.52.243


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

3

��2a�(�@s�ddlZddlmZddlZddlmZmZmZddl	m
Z
ddddd	d
ddd
dddhZdZdZ
ejd�fdd�Zdd�ZGdd�d�Zej�edkr�ddlmZedddd�dS) �N)�maxsize)�TOP�X�SUNKEN)�idleConf�class�def�elif�else�except�finally�for�if�try�while�with�async�di�z^(\s*)(\w*)cCs|j|�j�S)N)�match�groups)�codeline�c�r�0/opt/alt/python36/lib64/python3.6/codecontext.py�get_spaces_firstwordsrcCsFt|�\}}t|�}t|�|ks,||dkr0t}|tko:|}|||fS)N�#)r�len�INFINITY�BLOCKOPENERS)rZspacesZ	firstword�indent�openerrrr�
get_line_infosr!c@s^eZdZdd�Zedd��Zdd�Zddd	�Zddd
�Zdd�Z	ddd�Z
dd�Zdd�ZdS)�CodeContextcCs^||_|j|_|jd|_tj|_d|_d|_dg|_|jj	t
|j�|_|jj	t
|j�|_dS)N�font�r�F���)rr&r%F)�editwin�text�textfontr"�colors�
contextcolors�context�
topvisible�info�after�UPDATEINTERVAL�timer_event�t1�CONFIGUPDATEINTERVAL�config_timer_event�t2)�selfr'rrr�__init__0szCodeContext.__init__cCs,tjdddddd�|_tjtj�d�|_dS)N�
extensionsr"Zmaxlines�int�)�type�defaultr,)rZ	GetOption�
context_depthZGetHighlightZCurrentThemer*)�clsrrr�reloadMszCodeContext.reloadc	Cs2y |jj|j�|jj|j�WnYnXdS)N)r(Zafter_cancelr2r5)r6rrr�__del__Ts
zCodeContext.__del__NcCs�|js�|jj|jjf}d}d}xP|D]H}||jj|j�d�7}||jj|jd��7}||jj|jd��7}q$Wtj	|jj
|j|jd|jddd||t
dd�
|_|jjd	|j�|jjttd
|jjd�n|jj�d|_dS)
Nr�padx�border�
background�
foregroundr$�disabled)	r#�bgZfg�height�widthrArBZrelief�statez<ButtonRelease-1>F)Zside�fill�expandZbefore�break)r,r'r(Z
text_frameZtkZgetintZ	pack_infoZcget�tkinterZText�topr)r+rZbind�
jumptoline�packrrZdestroy)r6�eventZwidgetsrArBZwidgetrrr�toggle_code_context_event\s*


z%CodeContext.toggle_code_context_eventr$rcCs�g}t}x�t||dd�D]x}|jj|�d�|�d��}t|�\}}	}
||kr|}|
dkrb|d7}|
r�||kr�||kr�|j|||	|
f�||krPqW|j�||fS)Nr$z.0z.endr
r	r&)r
r	)r�ranger(�getr!�append�reverse)r6�new_topvisibleZstopline�
stopindent�lines�
lastindentZlinenumrrr(r rrr�get_context�s
zCodeContext.get_contextcCsZt|jjd�jd�d�}|j|kr(dS|j|krf|j||j�\}}x�|jdd|krb|jd=qFWn`|jddd}x,|jdd|kr�|jdd}|jd=qzW|j||jddd|�\}}|jj|�||_dd�|j|jd�D�}|d�rdnd}t	|�||j
d<d|j
d	<|j
jd
d�|j
jddj
||d���d
|j
d	<dS)Nz@0,0�.rr$cSsg|]}|d�qS)�r)�.0�xrrr�
<listcomp>�sz3CodeContext.update_code_context.<locals>.<listcomp>rGZnormalrIz1.0�end�
rEr&r&r&r&r&r&r&)r9r(�index�splitr-r[r.�extendr=rr,�delete�insert�join)r6rWrYrZrXZcontext_stringsZ	showfirstrrr�update_code_context�s0



zCodeContext.update_code_contextcCspt|j�}|dkrd}n:tt|jjd���}td||j�d}|j||d}|jj	|�d��|j
�dS)Nr$rgrz.0)rr.r9�floatr,rc�maxr=r(Zyviewri)r6rQrYZnewtopZcontextline�offsetrrrrO�s
zCodeContext.jumptolinecCs$|jr|j�|jjt|j�|_dS)N)r,rir(r/r0r1r2)r6rrrr1�szCodeContext.timer_eventcCsv|jd}|jr`||jks&tj|jkr`||_tj|_|j|jd<|jd|jd<|jd|jd<|jjt|j�|_	dS)Nr#rCrD)
r(r,r)r"r*r+r/r3r4r5)r6Znewtextfontrrrr4�s
zCodeContext.config_timer_event)N)r$r)N)
�__name__�
__module__�__qualname__r7�classmethodr?r@rRr[rirOr1r4rrrrr"-s
&
(
r"�__main__)�mainz"idlelib.idle_test.test_codecontextr]F)�	verbosity�exit)�re�sysrrrMZtkinter.constantsrrrZidlelib.configrrr0r3�compilerr!r"r?rmZunittestrrrrrr�<module>s =

?>