ok

Mini Shell

Direktori : /opt/alt/python36/lib64/python3.6/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/idlelib/__pycache__/calltip_w.cpython-36.pyc

3

*j�a��@s�dZddlmZmZmZmZddlmZdZdZ	dZ
dZd
ZdZ
Gdd
�d
e�Zdd�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>>�<Key-Escape>�
<FocusOut>z<<calltipwindow-checkhide>>�<KeyRelease>�<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|�j|�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/python36/lib64/python3.6/idlelib/calltip_w.pyrs
zCalltipWindow.__init__cCs�t|jjd�jd�d�}||jkr2|j|jf}n|df}|jjd|�}|snt|jjd��}d|d<d|d<|dd|d|dfS)z$Choose the position of the call-tip.�insert�.rz%d.%d���)�int�
anchor_widget�index�splitrrZbbox�list)r�curlineZanchor_indexZboxrrr�get_position#s
zCalltipWindow.get_positioncsLt|jjd�jd�d�}||jkr(dS||_|jjd�tt|�j�dS)z Reposition the window if needed.rrrN)	r r!r"r#rZseer
r�position_window)rr%)rrrr'2s
zCalltipWindow.position_windowcs`||_|js|jrdS|jjt|�tt|jj|�jd��\|_	|_
tt|�j
�|j�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�	tipwindowr!Zmark_set�
MARK_RIGHT�mapr r"r#rrr
r�showtip�_bind_events)rrZ	parenleftZ
parenright)rrrr+;s	zCalltipWindow.showtipc	Cs0t|j|jtdtd|jdd�|_|jj�dS)zCreate the call-tip widget.z#ffffe0r�font)rZjustifyZ
backgroundZreliefZborderwidthr-N)rr(rrrr!r�pack)rrrr�showcontentsPszCalltipWindow.showcontentsNcCs�|js
dStt|jjd�jd��\}}||jksT||jkrD||jksT|jjddt	�r`|j
�dS|j�|jdk	r�|jj
|j�|jjt|j�|_dS)z4Handle CHECK_HIDE_EVENT: call hidetip or reschedule.Nrr�>�break)r(r*r r!r"r#rrZcomparer)�hidetipr'rZafter_cancel�after�CHECKHIDE_TIME�checkhide_event)r�eventr%Zcurcolrrrr5Ws

zCalltipWindow.checkhide_eventcCs|js
dS|j�dS)z%Handle HIDE_EVENT by calling hidetip.Nr1)r(r2)rr6rrr�
hide_eventrszCalltipWindow.hide_eventcs�|js
dSy|jj�Wntk
r,YnXd|_d|_|_|_y|jjt	�Wntk
rjYnXy|j
�Wnttfk
r�YnXtt
|�j�dS)zHide the call-tip.N)r(rZdestroyrrrrr!Z
mark_unsetr)�_unbind_events�
ValueErrorr
rr2)r)rrrr2zs"zCalltipWindow.hidetipcCsp|jjt|j�|_xtD]}|jjt|�qW|jjt|j�|jjt	|j
�|_xtD]}|jjt	|�qVWdS)zBind event handlers.N)
r!�bind�CHECKHIDE_EVENTr5r�CHECKHIDE_SEQUENCES�	event_addr3r4�
HIDE_EVENTr7r�HIDE_SEQUENCES)r�seqrrrr,�s



zCalltipWindow._bind_eventscCshxtD]}|jjt|�qW|jjt|j�d|_xtD]}|jjt|�q8W|jjt|j�d|_dS)zUnbind event handlers.N)	r<r!Zevent_deleter;Zunbindrr?r>r)rr@rrrr8�s

zCalltipWindow._unbind_events)N)�__name__�
__module__�__qualname__�__doc__rr&r'r+r/r5r7r2r,r8�
__classcell__rr)rrrs
	
rcs�ddlm}m}m}m}||�}|jd�tt|j�j	d�dd��\}}|jd|d|df�||�}|j
||dd	�|jd
d�|j�t
|���fdd
�}	�fdd�}
|jdd�|jdd�|jd|	�|jd|
�|j�dS)Nr)�Toplevel�Textr�BOTHzTest call-tips�+rz
250x100+%d+%d��)ZsideZfill�expandrzstring.splitcs�jddd�dS)Nz(s='Hello world')r�end)r+)r6)�calltiprr�calltip_show�sz%_calltip_window.<locals>.calltip_showcs�j�dS)N)r2)r6)rNrr�calltip_hide�sz%_calltip_window.<locals>.calltip_hidez<<calltip-show>>�(z<<calltip-hide>>�))�tkinterrFrGrrH�titler*r Zgeometryr#r.r�updaterr=r:Z	focus_set)�parentrFrGrrH�top�x�yrrOrPr)rNr�_calltip_window�s"
 rZ�__main__)�mainz idlelib.idle_test.test_calltip_wrF)�	verbosity�exit)�runN)rr)r	r
)rDrSrrrrZidlelib.tooltiprr>r?r;r<r4r)rrZrAZunittestr\Zidlelib.idle_test.htestr_rrrr�<module>s 

Zerion Mini Shell 1.0