Ë q+¹’¼ÆÝãóª—dZddlmZmZmZmZddlmZdZdZ dZ dZ dZ d Z Gd „d e«Zd „Zed k(r ddlmZeddd¬«ddlmZee«yy)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<>)z z z<>)z zédÚcalltipwindowregion_rightcóf‡—eZdZdZˆfd„Zd„Zˆfd„Zˆfd„Zd„Zd d„Z d„Z ˆfd „Z d „Z d „Z ˆxZS) Ú CalltipWindowz+A call-tip widget for tkinter text widgets.có”•—t‰|�|«dx|_|_dx|_x|_|_dx|_|_d|_ y)z}Create a call-tip; shown by showtip(). text_widget: a Text widget with code for which call-tips are desired N) ÚsuperÚ__init__ÚlabelÚtextÚ parenlineÚparencolÚlastlineÚhideidÚ checkhideidÚcheckhide_after_id)ÚselfÚ text_widgetÚ __class__s €ú(/usr/lib/python3.12/idlelib/calltip_w.pyrzCalltipWindow.__init__sLø€ô ‰Ñ˜Ô%à!%Ð%ˆŒ �T”YØ9=Ð=ˆŒÐ=˜œ¨¬Ø)-Ð-ˆŒ �dÔ&Ø"&ˆÕócóˆ—t|jjd«jd«d«}||jk(r|j|j f}n|df}|jj d|z«}|s.t|jj d««}d|d<d|d<|ddz|d|dzfS)z$Choose the position of the call-tip.ÚinsertÚ.rz%d.%dééé)ÚintÚ anchor_widgetÚindexÚsplitrrÚbboxÚlist)rÚcurlineÚ anchor_indexÚboxs rÚ get_positionzCalltipWindow.get_position#s¾€ä�d×(Ñ(×.Ñ.¨xÓ8×>Ñ>¸sÓCÀAÑFÓGˆØ �d—n‘nÒ $Ø ŸN™N¨D¯M©MÐ:‰Là# Q˜<ˆLØ× Ñ ×%Ñ% g° Ñ&<Ó=ˆÙÜ�t×)Ñ)×.Ñ.¨xÓ8Ó9ˆCàˆC�‰F؈C�‰FØ�1‰v˜‰z˜3˜q™6 C¨¡F™?Ð*Ð*rcóò•—t|jjd«jd«d«}||jk(ry||_|jj d«t ‰|�«y)z Reposition the window if needed.rrrN)r"r#r$r%rÚseer Úposition_window)rr(rs €rr.zCalltipWindow.position_window2scø€ä�d×(Ñ(×.Ñ.¨xÓ8×>Ñ>¸sÓCÀAÑFÓGˆØ �d—m‘mÒ #Ø ØˆŒ Ø ×Ñ×јxÔ(Ü ‰ÑÕ!rcóL•—||_|js |jsy|jjt|«t t |jj|«jd««\|_ |_ t‰|�1«|j«y)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#Úmark_setÚ MARK_RIGHTÚmapr"r$r%rrr ÚshowtipÚ _bind_events)rrÚ parenleftÚ parenrightrs €rr4zCalltipWindow.showtip;sø€ðˆŒ Ø �>Š> §¢Ø à ×Ñ×#Ñ#¤J° Ô;Ü(+Ü �×#Ñ#×)Ñ)¨)Ó4×:Ñ:¸3Ó?ó)AÑ%ˆŒ˜œ ô ‰‰Ôà ×ÑÕrc óº—t|j|jtddtd|j d¬«|_|j j«y)zCreate the call-tip widget.z#ffffd0Úblackr Úfont)rÚjustifyÚ backgroundÚ foregroundÚreliefÚ borderwidthr:N)rr0rrrr#rÚpack)rs rÚ showcontentszCalltipWindow.showcontentsPsD€ä˜4Ÿ>™>°· ± Ä4Ø&/¸GÜ"'°QØ $× 2Ñ 2°6Ñ :ô<ˆŒ ð � ‰ �‰Õrcó2—|jsytt|jj d«j d««\}}||j ks?||j k(r||jks!|jjddt«r|j«y|j«|j�%|jj|j«|jjt|j «|_ y)z4Handle CHECK_HIDE_EVENT: call hidetip or reschedule.NrrÚ>Úbreak)r0r3r"r#r$r%rrÚcomparer2Úhidetipr.rÚ after_cancelÚafterÚCHECKHIDE_TIMEÚcheckhide_event)rÚeventr(Úcurcols rrJzCalltipWindow.checkhide_eventXsÞ€à�~Š~ðôœc 4×#5Ñ#5×#;Ñ#;¸HÓ#E×#KÑ#KÈCÓ#PÓQ‰ˆ�Ø �T—^‘^Ò #Ø �t—~‘~Ò %¨&°D·M±MÒ*AØ × Ñ × %Ñ % h°´ZÔ @Ø �L‰LŒNØð ×ÑÔà × "Ñ "Ð .Ø × Ñ × +Ñ +¨D×,CÑ,CÔ Dà × Ñ × $Ñ $¤^°T×5IÑ5IÓ Jð Ôàrcó>—|jsy|j«y)z%Handle HIDE_EVENT by calling hidetip.NrD)r0rF)rrKs rÚ hide_eventzCalltipWindow.hide_eventss€à�~Š~àØ � ‰ ŒØrcór•—|jsy |jj«d|_dx|_x|_|_ |jjt« |j«t‰|�5«y#t$rYŒgwxYw#t$rYŒ:wxYw#ttf$rYŒ>wxYw)zHide the call-tip.N)r0rÚdestroyrrrrr#Ú mark_unsetr2Ú_unbind_eventsÚ ValueErrorr rF)rrs €rrFzCalltipWindow.hidetip{sµø€à�~Š~Ø ð Ø �J‰J× Ñ Ô ðˆŒ à9=Ð=ˆŒÐ=˜œ¨¬ð Ø × Ñ × )Ñ )¬*Ô 5ð Ø × Ñ Ô !ô ‰‰Õøô!ò Ù ð ûôò Ù ð ûô œ*Ð%ò á ð ús5�BÁBÁ'B$ BÂB B! B!Â$B6Â5B6cóÀ—|jjt|j«|_t D]"}|jj t|«Œ$|jjt|j«|jjt|j«|_ tD]"}|jj t|«Œ$y)zBind event handlers.N) r#ÚbindÚCHECKHIDE_EVENTrJrÚCHECKHIDE_SEQUENCESÚ event_addrHrIÚ HIDE_EVENTrNrÚHIDE_SEQUENCES©rÚseqs rr5zCalltipWindow._bind_events”s¤€à×-Ñ-×2Ñ2´?Ø37×3GÑ3GóIˆÔç&ˆCØ × Ñ × (Ñ (¬¸#Õ >ð'à ×Ñ× Ñ ¤°×1EÑ1EÔFØ×(Ñ(×-Ñ-¬jØ.2¯o©oó?ˆŒ ç!ˆCØ × Ñ × (Ñ (¬°SÕ 9ñ"rcót—tD]"}|jjt|«Œ$|jj t|j «d|_t D]"}|jjt|«Œ$|jj t|j«d|_y)zUnbind event handlers.N) rWr#Ú event_deleterVÚunbindrrZrYrr[s rrRzCalltipWindow._unbind_events s‡€ç&ˆCØ × Ñ × +Ñ +¬O¸SÕ Að'à ×Ñ×!Ñ!¤/°4×3CÑ3CÔD؈Ôß!ˆCØ × Ñ × +Ñ +¬J¸Õ <ð"à ×Ñ×!Ñ!¤*¨d¯k©kÔ:؈� r©N)Ú__name__Ú __module__Ú __qualname__Ú__doc__rr+r.r4rArJrNrFr5rRÚ __classcell__)rs@rr r s8ø„Ù5ô 'ò +ô"ôò*óò6ôò2 :ö rr cóD‡ —ddlm}m}m}m}||«}|j d«t t|j«jd«dd«\}}|jd|dz|dzfz«||«}|j||d¬ «|jd d «|j«t|«Š ˆ fd „} ˆ fd „} |jdd«|jdd«|jd| «|jd| «|j!«y)Nr)ÚToplevelÚTextrÚBOTHzTest call-tipsÚ+r z 250x100+%d+%dé¯é–)ÚsideÚfillÚexpandrz string.splitcó,•—‰jddd«y)Nz(s='Hello world')rÚend)r4©rKÚcalltips €rÚ calltip_showz%_calltip_window..calltip_show¹sø€Ø�‰Ð+¨X°uÕ=rcó&•—‰j«yr`)rFrrs €rÚ calltip_hidez%_calltip_window..calltip_hide»s ø€Ø�‰Õrz<>Ú(z<>Ú))ÚtkinterrgrhrriÚtitler3r"Úgeometryr%r@rÚupdater rXrUÚ focus_set) ÚparentrgrhrriÚtopÚxÚyrrtrvrss @rÚ_calltip_windowr‚¬sóø€ß2Ó2á �6Ó €C؇I�IÐÔÜ Œs�F—O‘OÓ%×+Ñ+¨CÓ0°°Ð4Ó 5�D€A€q؇L�L� A¨¡G¨Q°©WÐ#5Ñ5Ô6Ù �‹9€D؇I�I�4˜d¨1€IÔ-؇K�K�˜.Ô)؇J�J„Lä˜DÓ!€Gô>ôà‡N�NÐ% sÔ+؇N�NÐ% sÔ+؇I�IÐ  ,Ô/؇I�IÐ  ,Ô/à‡N�NÕrÚ__main__)Úmainz idlelib.idle_test.test_calltip_wrF)Ú verbosityÚexit)ÚrunN)rdryrrrrÚidlelib.tooltiprrYrZrVrWrIr2r r‚raÚunittestr„Úidlelib.idle_test.htestr‡©rrÚrŒsrðñ÷ 1Ó0å'à %€ Ø/€Ø/€Ø9ÐØ€à (€ ôV�KôVòrð2 ˆzÒÝÙÐ +°q¸uÕEå+ÙˆÕð r