Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.9/idlelib/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.9/idlelib/__pycache__/codecontext.cpython-39.opt-2.pyc

a

��g�,�@s�ddlZddlmZddlmZmZmZddlm	Z	m
Z
ddlmZhd�Z
e�d�fdd	�Zd
d�ZGdd
�d
�Ze��edkr�ddlmZedddd�dS)�N)�maxsize)�Frame�Text�TclError)�NSEW�SUNKEN)�idleConf>�async�except�class�finally�elif�try�if�else�while�with�def�forz^(\s*)(\w*)cCs|�|���S�N)�match�groups)�codeline�c�r�//usr/local/lib/python3.9/idlelib/codecontext.py�get_spaces_firstwordsrcCsFt|�\}}t|�}t|�|ks,||dkr0t}|tvo:|}|||fS)N�#)r�len�INFINITY�BLOCKOPENERS)r�spacesZ	firstword�indent�openerrrr�
get_line_infosr$c@sreZdZdZdd�Zdd�Zedd��Zdd	�Zddd�Z	ddd�Z
dd�Zddd�Zdd�Z
dd�Zdd�Zd
S)�CodeContext�dcCs||_|j|_|��dSr)�editwin�text�_reset)�selfr'rrr�__init__1szCodeContext.__init__cCs$d|_d|_d|_d|_dg|_dS)N�)r����F)�context�cell00�t1�
topvisible�info�r*rrrr)Fs
zCodeContext._resetcCstjdddddd�|_dS)N�
extensionsr%Zmaxlines�int�)�type�default)rZ	GetOption�
context_depth)�clsrrr�reloadMs�zCodeContext.reloadcCs:|jdur6z|j�|j�Wnty.Yn0d|_dSr)r1r(�after_cancelrr4rrr�__del__Ts
zCodeContext.__del__Nc

Csv|jdu�r |jj|jjf}d}d}|D]`}||jjur@|��n|��}||j�|d�7}||j�|�d��7}||j�|�d��7}q(t	|jjddd||t
dd�}|_|��|��|�
d|j�|��|jddtd�t�t��d	�}t|jj|d
d�|_|jjddtd�d}	n:|j��d|_|j��d|_|j�|j�|��d
}	|jjdd|	�d�d�dS)Nr�padx�borderr,�disabled)�height�widthZhighlightthicknessr?r@Zrelief�statez<ButtonRelease-1>)�row�columnZsticky�
linenumber�
background��bgZHideZShow�optionsz*ode*ontextz
 Code Context)Zmenu�indexZlabel�break)r/r'r(Z
text_frameZ	grid_infoZ	pack_infoZtkZgetintZcgetrr�update_font�update_highlight_colors�bind�
jumptoline�timer_eventZgridrr�GetHighlight�CurrentThemerr0Zdestroyr=r1r)Zupdate_menu_label)
r*�eventZwidgetsr?r@Zwidgetr3r/�line_number_colorsZmenu_statusrrr�toggle_code_context_event]sV
�
��
��


�z%CodeContext.toggle_code_context_eventr,rcCs�g}t}t||dd�D]z}|j�|�d�|�d��}t|�\}}	}
||kr|}|
dvr`|d7}|
r�||kr�||kr�|�|||	|
f�||krq�q|��||fS)Nr,r-�.0z.end)rr
)r�ranger(�getr$�append�reverse)r*�new_topvisibleZstopline�
stopindent�lines�
lastindentZlinenumrr"r(r#rrr�get_context�s
zCodeContext.get_contextcCsB|j�d�}|j|krdS|j|krT|�||j�\}}|jdd|kr�|jd=q6n\|jddd}|jdd|kr�|jdd}|jd=qf|�||jddd|�\}}|j�|�||_dd�|j|jd�D�}|dr�dnd}t|�||jd<d|jd	<|j�	d
d�|j�
dd�||d���d
|jd	<dS)Nz@0,0r-r,rcSsg|]}|d�qS)�r)�.0�xrrr�
<listcomp>��z3CodeContext.update_code_context.<locals>.<listcomp>rBZnormalrDz1.0�end�
rA)r'Z	getlinenor2rar3�extendr:rr/�delete�insert�join)r*r]r_r`r^Zcontext_stringsZ	showfirstrrr�update_code_context�s4

�
�
zCodeContext.update_code_contextcCs�z|j�d�Wn~ty�t|j�}|dkr6d}n:tt|j�d���}td||j�d}|j||d}|j	�
|�d��|��Yn0dS)Nz	sel.firstr,rkrrX)r/rLrrr3r6�float�maxr:r(Zyviewrm)r*rUr_ZnewtopZcontextline�offsetrrrrQ�s
zCodeContext.jumptolinecCs*|jdur&|��|j�|j|j�|_dSr)r/rmr(Zafter�UPDATEINTERVALrRr1r4rrrrR�s
zCodeContext.timer_eventcCs(|jdur$t�|jdd�}||jd<dS)N�mainZEditorWindow�font)r/rZGetFontr()r*rsrrrrN�s
zCodeContext.update_fontcCsf|jdur6t�t��d�}|d|jd<|d|jd<|jdurbt�t��d�}|jj|dd�dS)Nr/rHZ
foregroundrGrI)r/rrSrTr0Zconfig)r*ZcolorsrVrrrrO�s


�z#CodeContext.update_highlight_colors)N)r,r)N)�__name__�
__module__�__qualname__rqr+r)�classmethodr<r>rWrarmrQrRrNrOrrrrr%-s
	
8
(
r%�__main__)rrz"idlelib.idle_test.test_codecontextrbF)�	verbosity�exit)�re�sysrr�tkinterrrrZtkinter.constantsrrZidlelib.configrr �compilerr$r%r<rtZunittestrrrrrr�<module>s[

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists