Sindbad~EG File Manager

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

�

&Μg	���dZddl�Gd�d�ZGd�de�ZGd�de�Zd	�Zed
k(r ddlmZedd
d��ddl	m
Z
e
e�yy)z�Tools for displaying tool-tips.

This includes:
 * an abstract base-class for different kinds of tooltips
 * a simple text-only Tooltip class
�)�*c�:�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
y	)
�TooltipBasez abstract base class for tooltipsc� �||_d|_y)z�Create a tooltip.

        anchor_widget: the widget next to which the tooltip will be shown

        Note that a widget will only be shown when showtip() is called.
        N)�
anchor_widget�	tipwindow)�selfrs  �,/usr/local/lib/python3.12/idlelib/tooltip.py�__init__zTooltipBase.__init__
s��+������c�$�|j�y�N��hidetip�r	s r
�__del__zTooltipBase.__del__s�����rc��|jryt|j�x|_}|jd�	|jjdd|jdd�|j�|j�|jj�|jj�y#t$rY�`wxYw)zdisplay the tooltipN�z!::tk::unsupported::MacWindowStyle�style�help�noActivates)r�Toplevelr�wm_overrideredirect�tk�call�_w�TclError�position_window�showcontents�update_idletasks�lift�r	�tws  r
�showtipzTooltipBase.showtips����>�>��&�t�'9�'9�:�:����
���q�!�	�
�E�E�J�J�:�G�R�U�U��}�
.�
	
�����������'�'�)��������
�	��	�s�)B:�:	C�Cc���|j�\}}|jj�|z}|jj�|z}|jjd||fz�y)z&(re)-set the tooltip's screen position�+%d+%dN)�get_positionr�winfo_rootx�winfo_rootyr�wm_geometry)r	�x�y�root_x�root_ys     r
rzTooltipBase.position_window/sb��� � �"���1��#�#�/�/�1�A�5���#�#�/�/�1�A�5�����"�"�8�v�v�.>�#>�?rc�@�d|jj�dzfS)z(choose a screen position for the tooltip�r)r�winfo_heightrs r
r'zTooltipBase.get_position6s#���4�%�%�2�2�4�q�8�8�8rc��t�)z$content display hook for sub-classes)�NotImplementedErrorrs r
rzTooltipBase.showcontentsAs
��"�!rc�p�|j}d|_|r	|j�yy#t$rYywxYw�zhide the tooltipN)r�destroyrr"s  r
rzTooltipBase.hidetipFs>���^�^�����
�
��
�
�����
��
�s�)�	5�5N)�__name__�
__module__�__qualname__�__doc__rrr$rr'rr�rr
rr
s)��*����*@�	9�"�
	rrc�T��eZdZdZd	�fd�	Z�fd�Zd
d�Zd
d�Zd�Zd�Z	�fd�Z
�xZS)�OnHoverTooltipBasez?abstract base class for tooltips, with delayed on-hover displayc�B��t�|�|�||_d|_|jjd|j�|_|jjd|j�|_	|jjd|j�|_
y)aqCreate a tooltip with a mouse hover delay.

        anchor_widget: the widget next to which the tooltip will be shown
        hover_delay: time to delay before showing the tooltip, in milliseconds

        Note that a widget will only be shown when showtip() is called,
        e.g. after hovering over the anchor widget with the mouse for enough
        time.
        N�<Enter>�<Leave>�<Button>)�superr�hover_delay�	_after_idr�bind�_show_event�_id1�_hide_event�_id2�_id3)r	rrC�	__class__s   �r
rzOnHoverTooltipBase.__init__Us����	����'�&�������&�&�+�+�I�t�7G�7G�H��	��&�&�+�+�I�t�7G�7G�H��	��&�&�+�+�J��8H�8H�I��	rc�&��	|jjd|j�|jjd|j�|jjd|j�t�|��y#t
$rY�wxYw)Nr?r@rA)r�unbindrGrIrJrrBr�r	rKs �r
rzOnHoverTooltipBase.__del__gsv���	����%�%�i����;����%�%�i����;����%�%�j�$�)�)�<�	������	��	�s�A2B�	B�Bc�^�|jr|j�y|j�y)z$event handler to display the tooltipN)rC�scheduler$�r	�events  r
rFzOnHoverTooltipBase._show_eventps������M�M�O��L�L�Nrc�$�|j�y)z!event handler to hide the tooltipNrrQs  r
rHzOnHoverTooltipBase._hide_eventws�����rc��|j�|jj|j|j�|_y)z*schedule the future display of the tooltipN)�
unscheduler�afterrCr$rDrs r
rPzOnHoverTooltipBase.schedule{s4�������+�+�1�1�$�2B�2B�26�,�,�@��rc�f�|j}d|_|r|jj|�yy)z(cancel the future display of the tooltipN)rDr�after_cancel)r	�after_ids  r
rUzOnHoverTooltipBase.unschedule�s.���>�>���������+�+�H�5�rc�b��	|j�t�|�
�y#t$rY�wxYwr5)rUrrBrrNs �r
rzOnHoverTooltipBase.hidetip�s2���	��O�O��	������	��	�s�"�	.�.)��r)r7r8r9r:rrrFrHrPrUr�
__classcell__�rKs@r
r=r=Rs0���I�J�$���@�6��rr=c�.��eZdZdZ		d�fd�	Zd�Z�xZS)�HovertipzAA tooltip that pops up when a mouse hovers over an anchor widget.c�R��t�|�||��||_||_||_y)avCreate a text tooltip with a mouse hover delay.

        anchor_widget: the widget next to which the tooltip will be shown
        hover_delay: time to delay before showing the tooltip, in milliseconds

        Note that a widget will only be shown when showtip() is called,
        e.g. after hovering over the anchor widget with the mouse for enough
        time.
        �rCN)rBr�text�
foreground�
background)r	rrbrCrcrdrKs      �r
rzHovertip.__init__�s,���	����K��@���	�$���$��rc	��t|j|jttd|j
|j��}|j�y)Nr)rb�justify�relief�borderwidthrcrd)�Labelrrb�LEFT�SOLIDrcrd�pack)r	�labels  r
rzHovertip.showcontents�s8���d�n�n�4�9�9�d�#�!�"&�/�/�d�o�o�O��	�
�
�r)r[z#000000z#ffffe0)r7r8r9r:rrr\r]s@r
r_r_�s���G�8<�2;�%� rr_c��t|�}|jd�tt|j	�jd�dd�\}}|j	d||dzfz�t
|d��}|j�t|d��}|j�t|d	d
��t|d��}|j�t|d
d��y)NzTest tooltip�+rr&�zPlace your mouse over buttons)rbz"Button 1 -- 1/2 second hover delayz!This is tooltip text for button1.i�razButton 2 -- no hover delayz!This is tooltip
text for button2.)
r�title�map�int�geometry�splitrirl�Buttonr_)�parent�topr+r,rm�button1�button2s       r
�_tooltipr{�s���
�6�
�C��I�I�n���s�F�O�O�%�+�+�C�0���4�5�D�A�q��L�L��Q��C��L�(�)��#�;�<�E�	�J�J�L��S�C�D�G��L�L�N��W�9�s�K��S�;�<�G��L�L�N��W�:��Mr�__main__)�mainzidlelib.idle_test.test_tooltip�F)�	verbosity�exit)�runN)r:�tkinterrr=r_r{r7�unittestr}�idlelib.idle_test.htestr�r;rr
�<module>r�se����E�E�P<��<�~�!��2N��z����	)�Q�U�C�+���M�r

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