Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 107

Warning: Cannot modify header information - headers already sent by (output started at /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php:1) in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 234

Warning: Cannot modify header information - headers already sent by (output started at /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php:1) in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 235

Warning: Cannot modify header information - headers already sent by (output started at /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php:1) in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 236

Warning: Cannot modify header information - headers already sent by (output started at /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php:1) in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 237

Warning: Cannot modify header information - headers already sent by (output started at /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php:1) in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 238

Warning: Cannot modify header information - headers already sent by (output started at /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php:1) in /home/zoomride2022/public_html/myzoomride.com/wp-includes/certificates/system.php on line 239
U i_&@sdZddlZddlmZmZddlmZddlmZddZ Gdd d eZ d d Z e d krdd l mZeddddddlmZee dS)zReplace dialog for IDLE. Inherits SearchDialogBase for GUI. Uses idlelib.searchengine.SearchEngine for search capability. Defines various replace related functions like replace, replace all, and replace+find. N) StringVarTclError)SearchDialogBase) searchenginecCs<|}t|}t|ds(t|||_|j}||dS)zCreate or reuse a singleton ReplaceDialog instance. The singleton dialog saves user entries and preferences across instances. Args: text: Text widget containing the text to be searched. _replacedialogN)Z_rootrgethasattr ReplaceDialogropen)textrootengineZdialogr./opt/python38/lib/python3.8/idlelib/replace.pyreplaces    rcseZdZdZdZdZfddZddZdd Zd d Z d d dZ d!ddZ d"ddZ ddZ d#ddZd$ddZddZddZd%ddZZS)&r z3Dialog for finding and replacing a pattern in text.zReplace DialogReplacecst||t||_dS)aCreate search dialog for finding and replacing text. Uses SearchDialogBase as the basis for the GUI and a searchengine instance to prepare the search. Attributes: replvar: StringVar containing 'Replace with:' value. replent: Entry widget for replvar. Created in create_entries(). ok: Boolean used in searchengine.search_text to indicate whether the search includes the selection. N)super__init__rreplvar)selfr r  __class__rrr%s zReplaceDialog.__init__cCst||z|d}Wntk r2d}YnXz|d}Wntk rZd}YnX|ph|d}|pp|}|||d|_dS)zMake dialog visible on top of others and ready to use. Also, highlight the currently selected text and set the search to include the current selection (self.ok). Args: text: Text widget being searched. sel.firstNsel.lastinsertT)rr indexrshow_hitok)rr firstlastrrrr 5s    zReplaceDialog.opencCs"t||d|jd|_dS)z8Create base and additional label and text entry widgets.z Replace with:rN)rcreate_entriesZ make_entryrZreplentrrrrr Ls zReplaceDialog.create_entriescCsJt||d|j|d|j|jd|jdd|d|jdS)zCreate base and additional command buttons. The additional buttons are for Find, Replace, Replace+Find, and Replace All. ZFindrz Replace+FindT)Zisdefz Replace AllN)rcreate_command_buttonsZ make_buttonfind_it replace_itdefault_command replace_allr!rrrr"Qs  z$ReplaceDialog.create_command_buttonsNcCs|ddS)zHandle the Find button.FN)do_findreventrrrr#]szReplaceDialog.find_itcCs||jr|dS)z]Handle the Replace button. If the find is successful, then perform replace. Nr'r do_replacer(rrrr$as zReplaceDialog.replace_itcCs"||jr|r|ddS)zHandle the Replace+Find button as the default command. First performs a replace and then, if the replace was successful, a find next. FNr*r(rrrr%is zReplaceDialog.default_commandcCsL|jrDz||}WqHtjk r@|j|dd}YqHXn|}|S)z.Expand replacement text if regular expression.zInvalid Replace ExpressionN)r ZisreexpandreerrorZ report_error)rmreplnewrrr_replace_expandts  zReplaceDialog._replace_expandcCs|j}|sdS|j}|j}|j||}|s@|dS|ddd|ddd|d}|d}|j rd}d}d}d} } | |jj ||||d |d }|sqx|\}} |d |d |d} | } | | |}|dkrqx| \}}d ||f} d ||f} || kr2|d | n4|d | | | krT|| | |rf|| ||t|}d }q|| r| r|| | |dS)aHandle the Replace All button. Search text for occurrences of the Find value and replace each of them. The 'wrap around' value controls the start point for searching. If wrap isn't set, then the searching starts at the first occurrence after the current selection; if wrap is set, the replacement starts at the first line. The replacement is always done top-to-bottom in the text. Nsel1.0endhitrTF)wrapr%d.0%d.%dr)r getprogrrr search_textbell tag_removestartZiswrapundo_block_startZsearch_forwardgroupr2spanmark_setdeleterlenundo_block_stoprclose)rr)progr0r reslinecolrrrr/charsZorigr1ijrrrr&s^                zReplaceDialog.replace_allFc Csv|jsdS|j}|j|d|}|s4|dS|\}}|\}}d||f}d||f} ||| d|_dS)z|Search for and highlight next occurrence of pattern in text. No text replacement is done with this option. FNr:T)r r;r r<r=rBrr) rrr rIrJr/rMrNrrrrrr's     zReplaceDialog.do_findc Cs|j}|sdS|j}z|d}}|d}Wntk rLd}YnX|sd|d}}}t|\}}|d|d|d}|||} |sdS| | |j } | dkrdS| d|| | r|||| r||| ||||dd|_dS) z6Replace search pattern in text with replacement value.FrrNrr9r7T)r r;r rrrZ get_line_colrmatchr2rrCr@rArDrrFrr) rrHr rposrrJrKrLr/r1rrrr+s:      zReplaceDialog.do_replacecCsv|j}|d||ddd|d|||ddd||krR|d|n|d|||d|dS)aHighlight text between first and last indices. Text is highlighted via the 'hit' tag and the marked section is brought into view. The colors from the 'hit' tag aren't currently shown when the text is displayed. This is due to the 'sel' tag being added first, so the colors in the 'sel' config are seen instead of the colors for 'hit'. rr3r4r5r6N)r rCr>tag_addZseeZupdate_idletasks)rrrr rrrrs   zReplaceDialog.show_hitcCs t|||jddddS)z%Close the dialog and remove hit tags.r6r4r5N)rrGr r>r(rrrrGs zReplaceDialog.close)N)N)N)N)F)N)__name__ __module__ __qualname____doc__titleZiconrr r r"r#r$r%r2r&r'r+rrG __classcell__rrrrr s      ;  r c sddlm}m}mmddlm}m}||}|dt t | ddd\}}| d||dfd d }d d } ||} | || d d|_| _ ddfdd} || d| d} | dS)Nr)ToplevelTextENDSEL)FrameButtonzTest ReplaceDialog+r7z+%d+%dcSsdSNrrrrrr@sz)_replace_dialog..undo_block_startcSsdSr`rrrrrrFsz(_replace_dialog..undo_block_stopZgray)Zinactiveselectbackgroundrz"This is a sample sTring Plus MORE.cs(dtddS)Nr4)rQrr>rrZr[r rr show_replace&sz%_replace_dialog..show_replacer)r Zcommand)tkinterrXrYrZr[Z tkinter.ttkr\r]rVmapintZgeometrysplitpackr@rFrZ focus_set) parentrXrYr\r]topxyr@rFframerbZbuttonrrar_replace_dialog s&    rm__main__)mainzidlelib.idle_test.test_replaceF) verbosityexit)run)rUr-rcrrZidlelib.searchbaserZidlelibrrr rmrRZunittestroZidlelib.idle_test.htestrsrrrrs  o!