Plan 9 from Bell Labs’s /usr/web/sources/contrib/stallion/root/sys/lib/python2.7/idlelib/CallTipWindow.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�`^c@s}dZddlTdZdZdZdZd	Zd
Zddd��YZd
�Z	e
dkryddlmZee	�ndS(s�A CallTip window class for Tkinter/IDLE.

After ToolTip.py, which uses ideas gleaned from PySol
Used by the CallTips IDLE extension.

i�(t*s<<calltipwindow-hide>>s<Key-Escape>s
<FocusOut>s<<calltipwindow-checkhide>>s<KeyRelease>s<ButtonRelease>idtcalltipwindowregion_righttCallTipcBsJeZd�Zd�Zd�Zdd�Zd�Zd�Zd�Z	RS(cCsO||_d|_|_d|_|_d|_d|_|_d|_	dS(N(
twidgettNonet	tipwindowtlabelt	parenlinetparencoltlastlinethideidtcheckhideidtcheckhide_after_id(tselfR((s+/sys/lib/python2.7/idlelib/CallTipWindow.pyt__init__s		cCs(t|jjd�jd�d�}||jkr8dS||_|jjd�||jkr�|jjd|j|jf�}n|jjd|�}|s�t	|jjd��}d|d<d|d<n|d|jj
�d}|d|d	|jj�}|jj
d
||f�dS(s;Check if needs to reposition the window, and if so - do it.tinsertt.iNs%d.%ds%d.0iiis+%d+%d(tintRtindextsplitR	tseeRtbboxRtlisttwinfo_rootxtwinfo_rootyRtwm_geometry(R
tcurlinetboxtxty((s+/sys/lib/python2.7/idlelib/CallTipWindow.pytposition_windows %	

cCs�||_|js|jr dS|jjt|�tt|jj|�jd��\|_	|_
t|j�|_}|j�|j
d�y#|jjdd|jdd�Wntk
r�nXt|d|jd	td
ddtd
dd|jd�|_|jj�|jjt|j�|_x!tD]}|jjt|�q3W|jjt|j�|jjt|j �|_!x!t"D]}|jjt|�q�WdS(sMShow the calltip, bind events which will close it and reposition it.
        NRis!::tk::unsupported::MacWindowStyletstylethelptnoActivatesttexttjustifyt
backgrounds#ffffe0trelieftborderwidthtfont(#R"RRtmark_sett
MARK_RIGHTtmapRRRRRtToplevelRtwm_overrideredirectttktcallt_wtTclErrortLabeltLEFTtSOLIDRtpacktbindtCHECKHIDE_VIRTUAL_EVENT_NAMEtcheckhide_eventRtCHECKHIDE_SEQUENCESt	event_addtaftertCHECKHIDE_TIMEtHIDE_VIRTUAL_EVENT_NAMEt
hide_eventR
tHIDE_SEQUENCES(R
R"t	parenleftt
parenrightttwtseq((s+/sys/lib/python2.7/idlelib/CallTipWindow.pytshowtip0s6	-





cCs�|js
dStt|jjd�jd��\}}||jks|||jkrd||jks||jjddt	�r�|j
�nJ|j�|jdk	r�|jj|j�n|jjt|j�|_dS(NRRt>(RR*RRRRRRtcompareR)thidetipRRRtafter_cancelR:R;R7(R
teventRtcurcol((s+/sys/lib/python2.7/idlelib/CallTipWindow.pyR7Ws	*

cCs|js
dS|j�dS(N(RRF(R
RH((s+/sys/lib/python2.7/idlelib/CallTipWindow.pyR=is	cCs�|js
dSx!tD]}|jjt|�qW|jjt|j�d|_x!tD]}|jjt	|�qWW|jjt	|j
�d|_
|jj�d|_|jj�d|_|jj
t�d|_|_|_dS(N(RR8Rtevent_deleteR6tunbindRRR>R<R
Rtdestroyt
mark_unsetR)RRR	(R
RB((s+/sys/lib/python2.7/idlelib/CallTipWindow.pyRFos 	
	
	
	
	cCs
t|j�S(N(tboolR(R
((s+/sys/lib/python2.7/idlelib/CallTipWindow.pyt	is_active�sN(
t__name__t
__module__RRRCRR7R=RFRO(((s+/sys/lib/python2.7/idlelib/CallTipWindow.pyRs			'		cs�t���jd�ttttjd|j����\}}}}�jd||df�dd�fd��Y}|�}dS(Ns
Test calltipss[x+]s+%d+%di�t	MyEditWincs)eZ�fd�Zd�Zd�ZRS(cs�t��}|_|jdtdtdd�|jdd��j�t|�|_|j	dd�|j	d	d
�|j
d|j�|j
d	|j�|j
��j�dS(NtsidetfilltexpandiRsstring.splits<<calltip-show>>t(s<<calltip-hide>>t)(tTextR"R4R2tBOTHRtupdateRtcalltipR9R5tcalltip_showtcalltip_hidet	focus_settmainloop(R
R"(troot(s+/sys/lib/python2.7/idlelib/CallTipWindow.pyR�s

cSs|jjddd�dS(NsHello worldRtend(R[RC(R
RH((s+/sys/lib/python2.7/idlelib/CallTipWindow.pyR\�scSs|jj�dS(N(R[RF(R
RH((s+/sys/lib/python2.7/idlelib/CallTipWindow.pyR]�s(RPRQRR\R]((R`(s+/sys/lib/python2.7/idlelib/CallTipWindow.pyRR�s	((tTkttitleRR*RtreRtgeometry(tparenttwidththeightRRRRteditwin((R`s+/sys/lib/python2.7/idlelib/CallTipWindow.pyt_calltip_window�s	
3t__main__(trunN(s<Key-Escape>s
<FocusOut>(s<KeyRelease>s<ButtonRelease>((
t__doc__tTkinterR<R>R6R8R;R)RRjRPtidlelib.idle_test.htestRl(((s+/sys/lib/python2.7/idlelib/CallTipWindow.pyt<module>s
w	

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].