Sindbad~EG File Manager

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

�

%Μg����dZddlmZmZmZmZddlmZdZdZ	dZ
dZdZd	Z
Gd
�de�Zd�Zed
k(r ddlmZeddd��ddlmZee�yy)zvA call-tip window class for Tkinter/IDLE.

After tooltip.py, which uses ideas gleaned from PySol.
Used by calltip.py.
�)�Label�LEFT�SOLID�TclError)�TooltipBasez<<calltipwindow-hide>>)z<Key-Escape>z
<FocusOut>z<<calltipwindow-checkhide>>)z<KeyRelease>z<ButtonRelease>�d�calltipwindowregion_rightc�f��eZdZdZ�fd�Zd�Z�fd�Z�fd�Zd�Zdd�Z	d�Z
�fd	�Zd
�Zd�Z
�xZS)
�
CalltipWindowz+A call-tip widget for tkinter text widgets.c���t�|�|�dx|_|_dx|_x|_|_dx|_|_d|_	y)z}Create a call-tip; shown by showtip().

        text_widget: a Text widget with code for which call-tips are desired
        N)
�super�__init__�label�text�	parenline�parencol�lastline�hideid�checkhideid�checkhide_after_id)�self�text_widget�	__class__s  ��./usr/local/lib/python3.12/idlelib/calltip_w.pyrzCalltipWindow.__init__sL���	����%�!%�%��
�T�Y�9=�=���=�����)-�-���d�&�"&���c��t|jjd�jd�d�}||jk(r|j|j
f}n|df}|jj
d|z�}|s.t|jj
d��}d|d<d|d<|ddz|d|dzfS)z$Choose the position of the call-tip.�insert�.rz%d.%d���)�int�
anchor_widget�index�splitrr�bbox�list)r�curline�anchor_index�boxs    r�get_positionzCalltipWindow.get_position#s����d�(�(�.�.�x�8�>�>�s�C�A�F�G���d�n�n�$� �N�N�D�M�M�:�L�#�Q�<�L�� � �%�%�g��&<�=����t�)�)�.�.�x�8�9�C��C��F��C��F��1�v��z�3�q�6�C��F�?�*�*rc����t|jjd�jd�d�}||jk(ry||_|jjd�t�|��y)z Reposition the window if needed.rrrN)r"r#r$r%r�seer
�position_window)rr(rs  �rr.zCalltipWindow.position_window2sc����d�(�(�.�.�x�8�>�>�s�C�A�F�G���d�m�m�#����
������x�(�
���!rc�L��||_|js|jsy|jjt|�tt|jj|�jd��\|_	|_
t�|�1�|j�y)a_Show the call-tip, bind events which will close it and reposition it.

        text: the text to display in the call-tip
        parenleft: index of the opening parenthesis in the text widget
        parenright: index of the closing parenthesis in the text widget,
                    or the end of the line if there is no closing parenthesis
        Nr)r�	tipwindowr#�mark_set�
MARK_RIGHT�mapr"r$r%rrr
�showtip�_bind_events)rr�	parenleft�
parenrightrs    �rr4zCalltipWindow.showtip;s�����	��>�>��������#�#�J�
�;�(+���#�#�)�)�)�4�:�:�3�?�)A�%����
�	�������rc��t|j|jtddtd|j
d��|_|jj�y)zCreate the call-tip widget.z#ffffd0�blackr �font)r�justify�
background�
foreground�relief�borderwidthr:N)rr0rrrr#r�pack)rs r�showcontentszCalltipWindow.showcontentsPsD���4�>�>��	�	�4�&/�G�"'�Q� $� 2� 2�6� :�<��
�	
�
�
���rc�2�|jsytt|jj	d�jd��\}}||jks?||jk(r||jks!|jjddt�r|j�y|j�|j�%|jj|j�|jjt|j �|_y)z4Handle CHECK_HIDE_EVENT: call hidetip or reschedule.Nrr�>�break)r0r3r"r#r$r%rr�comparer2�hidetipr.r�after_cancel�after�CHECKHIDE_TIME�checkhide_event)r�eventr(�curcols    rrJzCalltipWindow.checkhide_eventXs����~�~���c�4�#5�#5�#;�#;�H�#E�#K�#K�C�#P�Q�����T�^�^�#��t�~�~�%�&�D�M�M�*A����%�%�h��Z�@��L�L�N��	
�����"�"�.����+�+�D�,C�,C�D����$�$�^�T�5I�5I�J�	
��rc�>�|jsy|j�y)z%Handle HIDE_EVENT by calling hidetip.NrD)r0rF)rrKs  r�
hide_eventzCalltipWindow.hide_eventss���~�~������rc�r��|jsy	|jj�d|_dx|_x|_|_	|jjt�	|j�t�|�5�y#t$rY�gwxYw#t$rY�:wxYw#ttf$rY�>wxYw)zHide the call-tip.N)r0r�destroyrrrrr#�
mark_unsetr2�_unbind_events�
ValueErrorr
rF)rrs �rrFzCalltipWindow.hidetip{s�����~�~��	��J�J��� ���
�9=�=���=�����	����)�)�*�5�	����!�
	�����!�	��	���	��	��
�*�%�	��	�s5�B�B�'B$�	B�B�	B!� B!�$B6�5B6c��|jjt|j�|_t
D]"}|jj
t|��$|jjt|j�|jjt|j�|_tD]"}|jj
t|��$y)zBind event handlers.N)
r#�bind�CHECKHIDE_EVENTrJr�CHECKHIDE_SEQUENCES�	event_addrHrI�
HIDE_EVENTrNr�HIDE_SEQUENCES�r�seqs  rr5zCalltipWindow._bind_events�s����-�-�2�2�?�37�3G�3G�I���&�C����(�(��#�>�'���� � ���1E�1E�F��(�(�-�-�j�.2�o�o�?���!�C����(�(��S�9�"rc�t�tD]"}|jjt|��$|jj	t|j
�d|_tD]"}|jjt|��$|jj	t|j�d|_y)zUnbind event handlers.N)	rWr#�event_deleterV�unbindrrZrYrr[s  rrRzCalltipWindow._unbind_events�s���&�C����+�+�O�S�A�'����!�!�/�4�3C�3C�D����!�C����+�+�J��<�"����!�!�*�d�k�k�:���r�N)�__name__�
__module__�__qualname__�__doc__rr+r.r4rArJrNrFr5rR�
__classcell__)rs@rrrs8���5�'�
+�"��*��6��2
:�	rrc�D��ddlm}m}m}m}||�}|jd�t
t|j�jd�dd�\}}|jd|dz|dzfz�||�}|j||d�	�|jd
d�|j�t|���fd�}	�fd
�}
|jdd�|jdd�|jd|	�|jd|
�|j!�y)Nr)�Toplevel�Textr�BOTHzTest call-tips�+r z
250x100+%d+%d��)�side�fill�expandrzstring.splitc�,���jddd�y)Nz(s='Hello world')r�end)r4�rK�calltips �r�calltip_showz%_calltip_window.<locals>.calltip_show�s������+�X�u�=rc�&���j�yr`)rFrrs �r�calltip_hidez%_calltip_window.<locals>.calltip_hide�s
������rz<<calltip-show>>�(z<<calltip-hide>>�))�tkinterrgrhrri�titler3r"�geometryr%r@r�updaterrXrU�	focus_set)�parentrgrhrri�top�x�yrrtrvrss           @r�_calltip_windowr��s����2�2�
�6�
�C��I�I����s�F�O�O�%�+�+�C�0���4�5�D�A�q��L�L��A��G�Q��W�#5�5�6���9�D��I�I�4�d�1�I�-��K�K��.�)��J�J�L��D�!�G�>���N�N�%�s�+��N�N�%�s�+��I�I� �,�/��I�I� �,�/��N�N�r�__main__)�mainz idlelib.idle_test.test_calltip_wrF)�	verbosity�exit)�runN)rdryrrrr�idlelib.tooltiprrYrZrVrWrIr2rr�ra�unittestr��idlelib.idle_test.htestr��rr�<module>r�sr���
1�0�'�
%�
�/��/��9����
(�
�V�K�V�r�2�z����	+�q�u�E�+����r

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