Viewing File: /opt/alt/python35/lib64/python3.5/idlelib/__pycache__/CallTipWindow.cpython-35.opt-1.pyc



©ÕYf“ã@s›dZddlmZmZmZmZmZdZdZdZ	dZ
d	Zd
ZGdd„dƒZ
d
d„Zedkr—ddlmZeeƒdS)z…A CallTip window class for Tkinter/IDLE.

After ToolTip.py, which uses ideas gleaned from PySol
Used by the CallTips IDLE extension.
é)ÚToplevelÚLabelÚLEFTÚSOLIDÚTclErrorz<<calltipwindow-hide>>ú<Key-Escape>ú
<FocusOut>z<<calltipwindow-checkhide>>ú<KeyRelease>ú<ButtonRelease>édZcalltipwindowregion_rightc@sgeZdZdd„Zdd„Zdd„Zddd	„Zd
d„Zdd
„Zdd„Z	dS)ÚCallTipcCsO||_d|_|_d|_|_d|_d|_|_d|_dS)N)	ÚwidgetÚ	tipwindowÚlabelÚ	parenlineÚparencolÚlastlineÚhideidÚcheckhideidÚcheckhide_after_id)Úselfr
©rú:/opt/alt/python35/lib64/python3.5/idlelib/CallTipWindow.pyÚ__init__s		zCallTip.__init__cCs%t|jjdƒjdƒdƒ}||jkr8dS||_|jjdƒ||jkr…|jjd|j|jfƒ}n|jjd|ƒ}|sÍt	|jjdƒƒ}d|d<d|d<|d|jj
ƒd}|d|d	|jjƒ}|jj
d
||fƒdS)z;Check if needs to reposition the window, and if so - do it.ÚinsertÚ.rNz%d.%dz%d.0éééz+%d+%d)Úintr
ÚindexÚsplitrZseerZbboxrÚlistÚwinfo_rootxÚwinfo_rootyrZwm_geometry)rÚcurlineZboxÚxÚyrrrÚposition_windows %	

zCallTip.position_windowcCs´||_|js|jr dS|jjt|ƒtt|jj|ƒjdƒƒ\|_	|_
t|jƒ|_}|jƒ|j
dƒy#|jjdd|jddƒWntk
rÇYnXt|d|jd	td
ddtd
dd|jdƒ|_|jjƒ|jƒ|jjt|jƒ|_x!tD]}|jjt|ƒq>W|jjt|jƒ|jjt |j!ƒ|_"x!t#D]}|jjt |ƒq“WdS)zMShow the calltip, bind events which will close it and reposition it.
        Nrrz!::tk::unsupported::MacWindowStyleZstyleÚhelpZnoActivatesÚtextZjustifyZ
backgroundz#ffffe0ZreliefZborderwidthZfont)$r*rr
Zmark_setÚ
MARK_RIGHTÚmaprr r!rrrr(Zwm_overrideredirectZtkZcallZ_wrrrrrÚpackZliftÚbindÚCHECKHIDE_VIRTUAL_EVENT_NAMEÚcheckhide_eventrÚCHECKHIDE_SEQUENCESÚ	event_addÚafterÚCHECKHIDE_TIMEÚHIDE_VIRTUAL_EVENT_NAMEÚ
hide_eventrÚHIDE_SEQUENCES)rr*Z	parenleftZ
parenrightZtwÚseqrrrÚshowtip/s8	-






zCallTip.showtipNcCsÔ|js
dStt|jjdƒjdƒƒ\}}||jks|||jkrd||jks||jjddt	ƒr‰|j
ƒnG|jƒ|jdk	rµ|jj
|jƒ|jjt|jƒ|_dS)Nrrú>)rr,rr
r r!rrZcomparer+Úhidetipr(rZafter_cancelr3r4r0)rÚeventr%Zcurcolrrrr0Ws	*

zCallTip.checkhide_eventcCs|js
dS|jƒdS)N)rr;)rr<rrrr6is	zCallTip.hide_eventcCsê|js
dSx!tD]}|jjt|ƒqW|jjt|jƒd|_x!tD]}|jjt|ƒqWW|jjt|j	ƒd|_	|j
jƒd|_
|jjƒd|_|jjt
ƒd|_|_|_dS)N)rr1r
Zevent_deleter/Zunbindrr7r5rrZdestroyZ
mark_unsetr+rrr)rr8rrrr;os 	
	
	
	
	zCallTip.hidetipcCs
t|jƒS)N)Úboolr)rrrrÚ	is_active„szCallTip.is_active)
Ú__name__Ú
__module__Ú__qualname__rr(r9r0r6r;r>rrrrrs(rc	s&ddlm}m}m}m}||ƒ}|jdƒ|jd|jƒd|jƒdfƒ||ƒ}|j	d|d|d	d
ƒ|j
ddƒ|jƒt|ƒ‰‡fd
d†}‡fdd†}|j
ddƒ|j
ddƒ|jd|ƒ|jd|ƒ|jƒdS)Nr)rÚTextrÚBOTHz
Test calltipsz
200x100+%d+%déÈé–ZsideZfillÚexpandrrzstring.splitcsˆjdddƒdS)Nz(s=Hello world)rÚend)r9)r<)ÚcalltiprrÚcalltip_show•sz%_calltip_window.<locals>.calltip_showcsˆjƒdS)N)r;)r<)rHrrÚcalltip_hide—sz%_calltip_window.<locals>.calltip_hidez<<calltip-show>>ú(z<<calltip-hide>>ú))ÚtkinterrrBrrCÚtitleZgeometryr#r$r-rÚupdaterr2r.Z	focus_set)	ÚparentrrBrrCÚtopr*rIrJr)rHrÚ_calltip_windowˆs""

rRÚ__main__)ÚrunN)rr)r	r
)Ú__doc__rMrrrrrr5r7r/r1r4r+rrRr?Zidlelib.idle_test.htestrTrrrrÚ<module>s(x
Back to Directory File Manager