Füƒa7 ã@sËddlTddlmZddlmZdd„Zdd„Zdd „Zd d „ZGd d „d eƒZ dd„Z e dkrÇddl Z e j dddddƒddlmZee ƒdS)é)Ú*)Ú SearchEngine)ÚSearchDialogBasecCsC|jƒ}tj|ƒ}t|dƒs<t||ƒ|_|jS)z3Create or find the singleton SearchDialog instance.Ú _searchdialog)Z_rootrÚgetÚhasattrÚ SearchDialogr)ÚtextÚrootÚengine©r ú*/usr/lib/python3.5/idlelib/SearchDialog.pyÚ_setups  rcCs(|jddƒ}t|ƒj||ƒS)z9Handle the editor edit menu item and corresponding event.z sel.firstzsel.last)rrÚopen)r Úpatr r r ÚfindsrcCst|ƒj|ƒS)z9Handle the editor edit menu item and corresponding event.)rÚ find_again)r r r r rsrcCst|ƒj|ƒS)z9Handle the editor edit menu item and corresponding event.)rÚfind_selection)r r r r rsrc@sCeZdZdd„Zddd„Zdd„Zdd „ZdS) rcCs'tj|ƒ|jd|jdƒdS)Nz Find Nexté)rÚcreate_widgetsZ make_buttonÚdefault_command)Úselfr r r rs zSearchDialog.create_widgetsNcCs'|jjƒsdS|j|jƒdS)N)r Úgetprogrr )rZeventr r r r!szSearchDialog.default_commandc CsT|jjƒs |j|ƒdS|jjƒs3dS|jj|ƒ}|rB|\}}|jƒ\}}d||f}d||f}yH|jdƒ} |jdƒ} | |krÐ| |krÐ|jƒdSWntk råYnX|j dddƒ|j d||ƒ|j d|jj ƒr*|p-|ƒ|j dƒd S|jƒdSdS) NFz%d.%dz sel.firstzsel.lastZselz1.0ÚendÚinsertT)r ZgetpatrrZ search_textÚspanÚindexZbellZTclErrorÚ tag_removeÚtag_addZmark_setZisbackZsee) rr ZresÚlineÚmÚiÚjÚfirstZlastZselfirstZsellastr r r r&s4    %  zSearchDialog.find_againcCs5|jddƒ}|r(|jj|ƒ|j|ƒS)Nz sel.firstzsel.last)rr Z setcookedpatr)rr rr r r rCszSearchDialog.find_selection)Ú__name__Ú __module__Ú __qualname__rrrrr r r r rs   rcsÏt|ƒ}|jdƒttttjd|jƒƒƒƒ\}}}}|jd||dfƒt|ddƒ‰ˆj ƒˆj ddd ƒ‡fd d †}t |d d d|ƒ}|j ƒdS)zDisplay search test box.zTest SearchDialogz[x+]z+%d+%dé–ZinactiveselectbackgroundZgrayrzThis is a sample string. écs=ˆjtdtƒtˆƒjˆƒˆjtdtƒdS)Nz1.0)rZSELZENDrrrr )r r r Ú show_findTsz!_search_dialog..show_findr zSearch (selection ignored)ZcommandN) ZToplevelÚtitleÚlistÚmapÚintÚreÚsplitZgeometryZTextZpackrZButton)ÚparentZboxÚwidthZheightÚxÚyr)Zbuttonr )r r Ú_search_dialogJs  3 r4Ú__main__Nz#idlelib.idle_test.test_searchdialogÚ verbosityéÚexitF)Úrun)ZtkinterZidlelibrZidlelib.SearchDialogBaserrrrrrr4r$ZunittestÚmainZidlelib.idle_test.htestr9r r r r Ús     /