Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib64/python3.7/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/idlelib/__pycache__/squeezer.cpython-37.opt-2.pyc

B

YI~d(2�@s�ddlZddlZddlmZddlmZddlm	Z	ddl
mZddlm
Z
ddd�ZGd	d
�d
ej�ZGdd�d�Ze��ed
kr�ddlmZedddd�dS)�N)�idleConf)�	view_text)�Hovertip)�macosx�PcCs�d}d}d}d}x�t�d|�D]~}|��|}||7}||7}||dkrp||krb||d|7}|d7}d}n$||||7}||kr�|d7}|}|d7}qW|t|�|7}|dkr�||d|7}n|d8}|S)N�r�z[\t\n]�
)�re�finditer�start�len)�sZ	linewidthZtabwidth�posZ	linecountZcurrent_column�m�numchars�r�5/opt/alt/python37/lib64/python3.7/idlelib/squeezer.py�count_lines_with_wrappings.rc@sFeZdZdd�Zdd�Zddd�Zddd	�Zdd
d�ZdZd
d�Z	dS)�ExpandingButtonc
s��|_||_||_||_|j|_}|j|_}|jj|_|dkrFdnd}d|�d|�d�}t	j
j|||ddd	�d
}	t||	dd�|�
d
|j�t��r�|�
d|j�n|�
d|j�|��fdd��d|_|�|j�dS)Nr�lines�linezSqueezed text (� z).z#FFFFC0z#FFFFE0)�textZ
backgroundZactivebackgroundz5Double-click to expand, right-click for more options.r)Zhover_delayz<Double-Button-1>z
<Button-2>z
<Button-3>cs�t|�t|�t|��S)N)�int)�offset�length)rrr�<lambda>z�z*ExpandingButton.__init__.<locals>.<lambda>)r�tags�
numoflines�squeezer�editwinr�per�bottom�	base_text�tk�Button�__init__rZbind�expandrZisAquaTk�context_menu_eventZselection_handle�is_dangerousZ
after_idle�set_is_dangerous)
�selfrrr r!r"rZline_pluralityZbutton_textZbutton_tooltip_textr)rrr(_s*

zExpandingButton.__init__csLd|j���|jdkpDt|j�dkpDt�fdd�t�d|j�D��|_dS)N�2i�iP�c3s |]}t|�d���kVqdS)rN)r
�group)�.0Z
line_match)�dangerous_line_lenrr�	<genexpr>�sz3ExpandingButton.set_is_dangerous.<locals>.<genexpr>z[^\n]+)	rZwinfo_widthr r
r�anyr
rr+)r-r)r1rr,s

z ExpandingButton.set_is_dangerousNcCs�|jdkr|��|jrTtjdd�ddddg�|jt|j�ftj|j	d�}|sTdS|j
�|j	�|�|j|j
�|j
�|�|jj�|�dS)	NzExpand huge output?z

z5The squeezed output is very long: %d lines, %d chars.z2Expanding it could make IDLE slow or unresponsive.z5It is recommended to view or copy the output instead.zReally expand?)�title�message�default�parent�break)r+r,�tkMessageBoxZaskokcancel�joinr r
rZCANCELrr%�insert�indexr�deleter!�expandingbuttons�remove)r-�eventZconfirmrrrr)�s$	

zExpandingButton.expandcCs|��|�|j�dS)N)Zclipboard_clearZclipboard_appendr)r-r@rrr�copy�szExpandingButton.copycCst|jd|jddd�dS)NzSqueezed Output ViewerFZnone)Zmodal�wrap)rrr)r-r@rrr�view�szExpandingButton.view))rArA)rCrCcCsf|j�dd|j|jf�tj|jdd�}x&|jD]\}}|j|t||�d�q2W|�	|j
|j�dS)Nr;z@%d,%dr)Ztearoff)�labelZcommandr8)rZmark_set�x�yr&ZMenu�rmenu_specsZadd_command�getattrZtk_popupZx_rootZy_root)r-r@ZrmenurDZmethod_namerrrr*�sz"ExpandingButton.context_menu_event)N)N)N)
�__name__�
__module__�__qualname__r(r,r)rArCrGr*rrrrrTs 



rc@s0eZdZedd��Zdd�Zdd�Zdd�Zd	S)
�SqueezercCstjdddddd�|_dS)N�mainZPyShellzauto-squeeze-min-linesrr.)�typer6)rZ	GetOption�auto_squeeze_min_lines)�clsrrr�reload�szSqueezer.reloadcsd|�_|j�_�|jj�_dt��d��t��d���_g�_d|j	f��fdd�	}||_	dS)N�Zborder�padxrcs�|dkr|||�S�j}t|�|kr.|||�S��|�}||krJ|||�St|||��}��dtj��jd|ddd���d���	���dtj
��j�|�dS)N�stdoutZiomark��)�windowrS�pady)
rOr
�count_linesrZmark_gravityr&ZRIGHT�
window_createZsee�updateZLEFTr>�append)rr�writerOr �expandingbutton)r-rrr�mywrite�s 





z"Squeezer.__init__.<locals>.mywrite)
r"rr#r$r%rZcgetZwindow_width_deltar>r])r-r"r_r)r-rrr(�s

zSqueezer.__init__cCst||jj�S)N)rr"�width)r-rrrrrYszSqueezer.count_linesc
Cs|j�tj�}x$dD]}||krPqW|j��dS|j�|tjd�\}}|j�||�}t|�dkr�|ddkr�|j�d|�}|dd�}|j	�
||�|�|�}t||||�}|jj
||dd	d
�t|j�}	x2|	dk�r|j�|j|	dd|��r|	d8}	q�W|j�|	|�dS)
N)rT�stderrr8z+1cr���r	z%s-1crUrV)rWrSrXr�>)r�	tag_namesr&ZINSERTZbellZ
tag_prevrange�getr
r<r%r=rYrrZr>Zcomparer;)
r-r@rdZtag_namer�endrr r^�irrr�squeeze_current_text_event s,	






z#Squeezer.squeeze_current_text_eventN)rIrJrK�classmethodrQr(rYrhrrrrrL�s?
rL�__main__)rMzidlelib.idle_test.test_squeezerrRF)�	verbosity�exit)r)r
Ztkinterr&Ztkinter.messageboxZ
messageboxr9Zidlelib.configrZidlelib.textviewrZidlelib.tooltiprZidlelibrrr'rrLrQrIZunittestrMrrrr�<module>s
8r


Hacked By AnonymousFox1.0, Coded By AnonymousFox