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__/calltip_w.cpython-37.pyc

B

� f��@s�dZddlmZmZmZmZddlmZdZdZ	dZ
dZdZd	Z
Gd
d�de�Zdd
�Zedkr�ddlmZedddd�ddlmZee�dS)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>�dZcalltipwindowregion_rightcsveZdZdZ�fdd�Zdd�Z�fdd�Z�fdd	�Zd
d�Zdd
d�Z	dd�Z
�fdd�Zdd�Zdd�Z
�ZS)�
CalltipWindowz+A call-tip widget for tkinter text widgets.csDtt|��|�d|_|_d|_|_|_d|_|_	d|_
dS)z}Create a call-tip; shown by showtip().

        text_widget: a Text widget with code for which call-tips are desired
        N)�superr�__init__�label�text�	parenline�parencol�lastline�hideid�checkhideid�checkhide_after_id)�selfZtext_widget)�	__class__��6/opt/alt/python37/lib64/python3.7/idlelib/calltip_w.pyr
s
zCalltipWindow.__init__cCs�t|j�d��d�d�}||jkr2|j|jf}n|df}|j�d|�}|snt|j�d��}d|d<d|d<|dd|d|dfS)z$Choose the position of the call-tip.�insert�.rz%d.%d���)�int�
anchor_widget�index�splitr
rZbbox�list)r�curlineZanchor_indexZboxrrr�get_position#s
zCalltipWindow.get_positioncsLt|j�d��d�d�}||jkr(dS||_|j�d�tt|���dS)z Reposition the window if needed.rrrN)	rrrrrZseer	r�position_window)rr!)rrrr#2s
zCalltipWindow.position_windowcs^||_|js|jsdS|j�t|�tt|j�|��d��\|_	|_
tt|��
�|��dS)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�	tipwindowrZmark_set�
MARK_RIGHT�maprrrr
rr	r�showtip�_bind_events)rrZ	parenleftZ
parenright)rrrr';s	zCalltipWindow.showtipc
Cs2t|j|jtddtd|jdd�|_|j��dS)zCreate the call-tip widget.z#ffffd0Zblackr�font)rZjustifyZ
backgroundZ
foregroundZreliefZborderwidthr)N)rr$rrrrr�pack)rrrr�showcontentsPs
zCalltipWindow.showcontentsNcCs�|js
dStt|j�d��d��\}}||jksT||jkrD||jksT|j�ddt	�r`|�
�dS|��|jdk	r�|j�
|j�|j�t|j�|_dS)z4Handle CHECK_HIDE_EVENT: call hidetip or reschedule.Nrr�>�break)r$r&rrrrr
rZcomparer%�hidetipr#rZafter_cancel�after�CHECKHIDE_TIME�checkhide_event)r�eventr!Zcurcolrrrr1Xs

zCalltipWindow.checkhide_eventcCs|js
dS|��dS)z%Handle HIDE_EVENT by calling hidetip.Nr-)r$r.)rr2rrr�
hide_eventsszCalltipWindow.hide_eventc	s�|js
dSy|j��Wntk
r,YnXd|_d|_|_|_y|j�t	�Wntk
rjYnXy|�
�Wnttfk
r�YnXtt
|���dS)zHide the call-tip.N)r$rZdestroyrr
rrrZ
mark_unsetr%�_unbind_events�
ValueErrorr	rr.)r)rrrr.{s"zCalltipWindow.hidetipcCsp|j�t|j�|_xtD]}|j�t|�qW|j�t|j�|j�t	|j
�|_xtD]}|j�t	|�qVWdS)zBind event handlers.N)
r�bind�CHECKHIDE_EVENTr1r�CHECKHIDE_SEQUENCES�	event_addr/r0�
HIDE_EVENTr3r�HIDE_SEQUENCES)r�seqrrrr(�s



zCalltipWindow._bind_eventscCshxtD]}|j�t|�qW|j�t|j�d|_xtD]}|j�t|�q8W|j�t|j�d|_dS)zUnbind event handlers.N)	r8rZevent_deleter7Zunbindrr;r:r)rr<rrrr4�s

zCalltipWindow._unbind_events)N)�__name__�
__module__�__qualname__�__doc__r
r"r#r'r+r1r3r.r(r4�
__classcell__rr)rrrs
	
rcs�ddlm}m}m}m}||�}|�d�tt|���	d�dd��\}}|�d|d|df�||�}|j
||dd	�|�d
d�|��t
|���fdd
�}	�fdd�}
|�dd�|�dd�|�d|	�|�d|
�|��dS)Nr)�Toplevel�Textr�BOTHzTest call-tips�+rz
250x100+%d+%d��)ZsideZfill�expandrzstring.splitcs��ddd�dS)Nz(s='Hello world')r�end)r')r2)�calltiprr�calltip_show�sz%_calltip_window.<locals>.calltip_showcs���dS)N)r.)r2)rJrr�calltip_hide�sz%_calltip_window.<locals>.calltip_hidez<<calltip-show>>�(z<<calltip-hide>>�))�tkinterrBrCrrD�titler&rZgeometryrr*r�updaterr9r6Z	focus_set)�parentrBrCrrD�top�x�yrrKrLr)rJr�_calltip_window�s"
 rV�__main__)�mainz idlelib.idle_test.test_calltip_wrF)�	verbosity�exit)�runN)r@rOrrrrZidlelib.tooltiprr:r;r7r8r0r%rrVr=ZunittestrXZidlelib.idle_test.htestr[rrrr�<module>s 

Hacked By AnonymousFox1.0, Coded By AnonymousFox