Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/idlelib/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/idlelib/__pycache__/squeezer.cpython-312.opt-2.pyc

�

&Μg"2����	ddlZddlZddlmZddlmZddlmZddlm	Z	ddl
mZdd�ZGd�d	ej�ZGd
�d�Zej!�edk(rdd
lmZeddd��yy)�N)�
messagebox)�idleConf)�	view_text)�Hovertip)�macosxc�P�	d}d}d}d}tjd|�D][}|j�|z
}||z
}||z
}||dk(r||kDr||dz
|zz
}|dz
}d}n||||zz
z
}||kDr|dz
}|}|dz
}�]|t|�|z
z
}|dkDr
||dz
|zz
}|S|dz}|S)N�r�z[\t\n]�
)�re�finditer�start�len)�s�	linewidth�tabwidth�pos�	linecount�current_column�m�numcharss        �-/usr/local/lib/python3.12/idlelib/squeezer.py�count_lines_with_wrappingrs����H�
�C��I��N�
�[�[��A�
&���7�7�9�s�?���x����(�"��
�S�6�T�>��	�)��n�q�0�Y�>�>�	���N�I��N�
�h�.�8�*C�D�D�N��	�)��Q��	�!)���q���;'�@�c�!�f�s�l�"�N�����n�q�(�Y�6�6�	�
��	�Q��	���c�<�eZdZ	d�Zd�Zd	d�Zd	d�Zd	d�ZdZd�Z	y)
�ExpandingButtonc����|_||_||_||_|jx|_}|j
x|_}|jj|_|dk7rdnd}d|�d|�d�}tjj|||dd�	�d
}	t||	d��|jd
|j�tj �r|jd|j"�n|jd|j"�|j%�fd��d|_|j)|j*�y)Nr
�lines�linezSqueezed text (� z).z#FFFFC0z#FFFFE0)�text�
background�activebackgroundz5Double-click to expand, right-click for more options.�P)�hover_delayz<Double-Button-1>z
<Button-2>z
<Button-3>c�J���t|�t|�t|�zS�N)�int)�offset�lengthrs  �r�<lambda>z*ExpandingButton.__init__.<locals>.<lambda>zs���1�S��[��V��s�6�{�1J�#Kr)r�tags�
numoflines�squeezer�editwinr!�per�bottom�	base_text�tk�Button�__init__r�bind�expandr�isAquaTk�context_menu_event�selection_handle�is_dangerous�
after_idle�set_is_dangerous)
�selfrr,r-r.r/r!�line_plurality�button_text�button_tooltip_texts
 `        rr5zExpandingButton.__init___s$��������	�$��� ��
�!)�!1�!1�1���w�"�<�<�'��	�D� ���+�+���$.�!�O����'�
�|�1�^�4D�B�G��
�	�	���4��K�&/�)�	�	M�
D�	�	��*��;��	�	�%�t�{�{�3��?�?���I�I�l�D�$;�$;�<��I�I�l�D�$;�$;�<����K�	M�!�������-�-�.rc���d|jj�z�|jdkDxsLt|j�dkDxs2t�fd�t
jd|j�D��|_y)N�2i�iP�c3�X�K�|]!}t|jd���k\���#y�w)rN)r�group)�.0�
line_match�dangerous_line_lens  �r�	<genexpr>z3ExpandingButton.set_is_dangerous.<locals>.<genexpr>�s/������"@�J��J�$�$�Q�'�(�,>�>�"@�s�'*z[^\n]+)	r!�winfo_widthr-rr�anyrr
r;)r>rHs @rr=z ExpandingButton.set_is_dangeroussm����$�)�)�"7�"7�"9�9���O�O�d�"�
�����K�%��
���"$�+�+�i����"@��
�	
�rNc��	|j�|j�|jrgtjddj	gd��|j
t
|j�fztj|j��}|sy|jj|�}|jj||j|j�|jj|�|jj!||j|j�|j"j$j'|�y)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=r�askokcancel�joinr-rr�CANCELr!�indexr2�insertr,�deleter/�on_squeezed_expandr.�expandingbuttons�remove)r>�event�confirmrUs    rr7zExpandingButton.expand�s���	����$��!�!�#���� �,�,�+����%��
�o�o�s�4�6�6�{�3�4�#�)�)��y�y�	"�G����	�	����%�������e�T�V�V�T�Y�Y�7������d�#����'�'��t�v�v�t�y�y�A��
�
�&�&�-�-�d�3rc�\�	|j�|j|j�yr')�clipboard_clear�clipboard_appendr�r>r[s  r�copyzExpandingButton.copy�s'��	�	
�������d�f�f�%rc�N�	t|jd|jdd��y)NzSqueezed Output ViewerF�none)�modal�wrap)rr!rr`s  r�viewzExpandingButton.view�s%��	�	�$�)�)�5�t�v�v��F�	,r))rara)rfrfc�^�|jjdd|j|jfz�t	j
|jd��}|jD]"\}}|j|t||����$|j|j|j�y)NrVz@%d,%dr)�tearoff)�label�commandrQ)r!�mark_set�x�yr3�Menu�rmenu_specs�add_command�getattr�tk_popup�x_root�y_root)r>r[�rmenuri�method_names     rr9z"ExpandingButton.context_menu_event�s����	�	���8�X����%�'�'�0B�%B�C�����	�	�1�-��"&�"2�"2��E�;����E�7�4��3M��N�#3�
���u�|�|�U�\�\�2�rr')
�__name__�
__module__�__qualname__r5r=r7rarfror9�rrrrTs-��	�/�@	
�4�>&�,��K�rrc�0�eZdZ	ed��Zd�Zd�Zd�Zy)�Squeezerc�D�	tjddddd��|_y)N�main�PyShellzauto-squeeze-min-linesr(rC)�typerO)r�	GetOption�auto_squeeze_min_lines)�clss r�reloadzSqueezer.reload�s%��/�%-�%7�%7��I�7���&
��"rc�0���	|�_|jx�_�|jj�_dt�j
d��t�j
d��zz�_g�_d|jf��fd�	}||_	y)N��border�padxrzc����|dk7r	|||�S�j}t|�|kr	|||�S�j|�}||kr	|||�St|||��}�j	dt
j��jd|dd���jd��j��j	dt
j��jj|�y)N�stdout�iomark����windowr��pady)
r�r�count_linesr�mark_gravityr3�RIGHT�
window_create�see�update�LEFTrY�append)rr,�writer�r-�expandingbuttonr>r!s      ��r�mywritez"Squeezer.__init__.<locals>.mywrite�s�����x���Q��~�%�&*�%@�%@�"��1�v�.�.��Q��~�%��)�)�!�,�J��2�2��Q��~�%�.�a��z�4�H�O�
���h����1����x��$%�A�
�
/��H�H�X���K�K�M����h����0�
�!�!�(�(��9r)
r/r!r0r1r2r(�cget�window_width_deltarYr�)r>r/r�r!s`  @rr5zSqueezer.__init__�s����	����"�<�<�'��	�D�!���+�+���#$���	�	�(�#�$���	�	�&�!�"�
#�#
���
!#����g�m�m�	:�< ��
rc�D�	t||jj�Sr')rr/�width)r>rs  rr�zSqueezer.count_liness ��		�)��D�L�L�,>�,>�?�?rc��	|jjtj�}dD]}||vs�n|jj	�y|jj|tjdz�\}}|jj
||�}t|�dkDr+|ddk(r#|jjd|z�}|dd}|jj||�|j|�}t||||�}|jj||dd	�
�t|j�}|dkDre|jj|j|dz
d|�r8|dz}|dkDr.|jj|j|dz
d|�r�8|jj!||�y)
N)r��stderrrQz+1cr���rz%s-1cr�r�r�r
�>)r!�	tag_namesr3�INSERT�bell�
tag_prevrange�getrrUr2rWr�rr�rY�comparerV)	r>r��tag_namer�endrr-r��is	         r�squeeze_current_textzSqueezer.squeeze_current_text"s���	��I�I�'�'��	�	�2�	�,�H��9�$��-�

�I�I�N�N����Y�Y�,�,�X�r�y�y�5�7H�I�
��s��I�I�M�M�%��%���q�6�A�:�!�B�%�4�-��)�)�/�/�'�C�-�0�C��#�2��A�	
�����e�S�)��%�%�a�(�
�)�!�X�z�4�H��	
�	�	����o�%&�Q�	 �	0�
��%�%�&���!�e��	�	�)�)�$�*?�*?��!��*D�*-��@�
��F�A��!�e��	�	�)�)�$�*?�*?��!��*D�*-��@�	
���$�$�Q��8�rN)rwrxry�classmethodr�r5r�r�rzrrr|r|�s,���
�
��
�= �~@�-rr|�__main__)r~zidlelib.idle_test.test_squeezerr�F)�	verbosity�exit)r$)r�tkinterr3r�idlelib.configr�idlelib.textviewr�idlelib.tooltipr�idlelibrrr4rr|r�rw�unittestr~rzrr�<module>r�sr��� 
���#�&�$��5�pq�b�i�i�q�hG�G�T	�����z����	*�a�e�D�r

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