OwlCyberSecurity - MANAGER
Edit File: calltip_w.cpython-37.pyc
B ����� f�������������������@���s����d�Z�ddlmZmZmZmZ�ddlmZ�dZdZ dZ dZdZd Z G�d d��de�Zdd ��Zedkr�ddlmZ�edddd��ddlmZ�ee��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>�d���Zcalltipwindowregion_rightc�������������������sv���e�Zd�ZdZ��fdd�Zdd��Z��fdd�Z��fdd �Zd d��Zdd d�Z dd��Z ��fdd�Zdd��Zdd��Z ���ZS�)� CalltipWindowz+A call-tip widget for tkinter text widgets.c����������������sD���t�t|���|��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__c�������������C���s����t�|�j�d��d�d��}||�jkr2|�j|�jf}n|df}|�j�d|��}|snt|�j�d��}d|d<�d|d<�|d�d�|d�|d��fS�)z$Choose the position of the call-tip.�insert�.r���z%d.%d������������)�int� anchor_widget�index�splitr ���r���Zbbox�list)r����curlineZanchor_indexZboxr���r���r����get_position#���s���� zCalltipWindow.get_positionc����������������sL���t�|�j�d��d�d��}||�jkr(dS�||�_|�j�d��tt|������dS�)z Reposition the window if needed.r���r���r���N) r���r���r���r���r���Zseer ���r����position_window)r���r!���)r���r���r���r#���2���s���� zCalltipWindow.position_windowc����������������s^���||�_�|�js|�j�sdS�|�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���� tipwindowr���Zmark_set� MARK_RIGHT�mapr���r���r���r ���r���r ���r����showtip�_bind_events)r���r���Z parenleftZ parenright)r���r���r���r'���;���s���� zCalltipWindow.showtipc���������� ���C���s2���t�|�j|�jtddtd|�jd�d�|�_|�j����dS�)zCreate the call-tip widget.z#ffffd0Zblackr����font)r���ZjustifyZ backgroundZ foregroundZreliefZborderwidthr)���N)r���r$���r���r���r���r���r����pack)r���r���r���r����showcontentsP���s ����zCalltipWindow.showcontentsNc�������������C���s����|�j�s dS�tt|�j�d��d��\}}||�jk�sT||�jkrD||�jksT|�j�ddt �r`|�� ���dS�|�����|�jdk r�|�j� |�j��|�j�t|�j�|�_dS�)z4Handle CHECK_HIDE_EVENT: call hidetip or reschedule.Nr���r����>�break)r$���r&���r���r���r���r���r ���r���Zcomparer%����hidetipr#���r���Zafter_cancel�after�CHECKHIDE_TIME�checkhide_event)r����eventr!���Zcurcolr���r���r���r1���X���s���� zCalltipWindow.checkhide_eventc�������������C���s���|�j�s dS�|�����dS�)z%Handle HIDE_EVENT by calling hidetip.Nr-���)r$���r.���)r���r2���r���r���r���� hide_events���s����zCalltipWindow.hide_eventc���������� ������s����|�j�s dS�y|�j����W�n�tk r,���Y�nX�d|�_d�|�_�|�_|�_y|�j�t ��W�n�tk rj���Y�nX�y|�� ���W�n�ttfk r����Y�nX�tt |������dS�)zHide the call-tip.N)r$���r���Zdestroyr���r ���r���r���r���Z mark_unsetr%����_unbind_events� ValueErrorr ���r���r.���)r���)r���r���r���r.���{���s"����zCalltipWindow.hidetipc�������������C���sp���|�j��t|�j�|�_xtD�]}|�j��t|��qW�|�j��t|�j��|�j��t |�j �|�_xtD�]}|�j��t |��qVW�dS�)zBind event handlers.N) r����bind�CHECKHIDE_EVENTr1���r����CHECKHIDE_SEQUENCES� event_addr/���r0���� HIDE_EVENTr3���r����HIDE_SEQUENCES)r����seqr���r���r���r(�������s���� zCalltipWindow._bind_eventsc�������������C���sh���xt�D�]}|�j�t|��qW�|�j�t|�j��d|�_xtD�]}|�j�t|��q8W�|�j�t|�j��d|�_dS�)zUnbind event handlers.N) r8���r���Zevent_deleter7���Zunbindr���r;���r:���r���)r���r<���r���r���r���r4�������s���� zCalltipWindow._unbind_events)N)�__name__� __module__�__qualname__�__doc__r ���r"���r#���r'���r+���r1���r3���r.���r(���r4���� __classcell__r���r���)r���r���r������s��� r���c����������������s����ddl�m}m}m}m}�||��}|�d��tt|����� d�dd����\}}|�d|d�|d�f���||�}|j ||dd ��|�d d��|����t |�����fdd �} ��fdd�} |�dd��|�dd��|�d| ��|�d| ��|����d�S�)Nr���)�Toplevel�Textr����BOTHzTest call-tips�+r���z 250x100+%d+%d��������)ZsideZfill�expandr���zstring.splitc����������������s�������ddd��d�S�)Nz(s='Hello world')r����end)r'���)r2���)�calltipr���r����calltip_show����s����z%_calltip_window.<locals>.calltip_showc����������������s����������d�S�)N)r.���)r2���)rJ���r���r����calltip_hide����s����z%_calltip_window.<locals>.calltip_hidez<<calltip-show>>�(z<<calltip-hide>>�))�tkinterrB���rC���r���rD����titler&���r���Zgeometryr���r*���r����updater���r9���r6���Z focus_set)�parentrB���rC���r���rD����top�x�yr���rK���rL���r���)rJ���r����_calltip_window����s"���� rV����__main__)�mainz idlelib.idle_test.test_calltip_wr���F)� verbosity�exit)�runN)r@���rO���r���r���r���r���Zidlelib.tooltipr���r:���r;���r7���r8���r0���r%���r���rV���r=���ZunittestrX���Zidlelib.idle_test.htestr[���r���r���r���r����<module>���s ����