Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib64/python3.7/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/idlelib/__pycache__/replace.cpython-37.opt-2.pyc

B

YI~d�&�@s�ddlZddlmZmZddlmZddlmZdd�ZGdd�de�Z	d	d
�Z
edkr�ddlm
Z
e
d
ddd�ddlmZee
�dS)�N)�	StringVar�TclError)�SearchDialogBase)�searchenginecCs<|��}t�|�}t|d�s(t||�|_|j}|�|�dS)N�_replacedialog)Z_rootr�get�hasattr�
ReplaceDialogr�open)�text�root�engineZdialog�r�4/opt/alt/python37/lib64/python3.7/idlelib/replace.py�replaces	

rcs�eZdZdZdZ�fdd�Zdd�Zdd�Zd	d
�Zddd
�Z	d dd�Z
d!dd�Zdd�Zd"dd�Z
d#dd�Zdd�Zdd�Zd$dd�Z�ZS)%r	zReplace Dialog�Replacecst��||�t|�|_dS)N)�super�__init__r�replvar)�selfrr
)�	__class__rrr%s
zReplaceDialog.__init__cCs�t�||�y|�d�}Wntk
r2d}YnXy|�d�}Wntk
rZd}YnX|ph|�d�}|pp|}|�||�d|_dS)Nz	sel.firstzsel.last�insertT)rr
�indexr�show_hit�ok)rr�first�lastrrrr
5s	

zReplaceDialog.opencCs"t�|�|�d|j�d|_dS)Nz
Replace with:r)r�create_entriesZ
make_entryrZreplent)rrrrrLs
zReplaceDialog.create_entriescCsJt�|�|�d|j�|�d|j�|jd|jdd�|�d|j�dS)NZFindrzReplace+FindT)ZisdefzReplace All)r�create_command_buttonsZmake_button�find_it�
replace_it�default_command�replace_all)rrrrrQs

z$ReplaceDialog.create_command_buttonsNcCs|�d�dS)NF)�do_find)r�eventrrrr]szReplaceDialog.find_itcCs|�|j�r|��dS)N)r#r�
do_replace)rr$rrrr aszReplaceDialog.replace_itcCs"|�|j�r|��r|�d�dS)NF)r#rr%)rr$rrrr!iszReplaceDialog.default_commandcCsL|j��rDy|�|�}WqHtjk
r@|j�|d�d}YqHXn|}|S)NzInvalid Replace Expression)r
Zisre�expand�re�errorZreport_error)r�m�repl�newrrr�_replace_expandts
zReplaceDialog._replace_expandcCs�|j��}|sdS|j��}|j}|j�||�}|s@|��dS|�ddd�|�ddd�|d}|d��}|j�	�r�d}d}d}d}	}
|�
�x�|jj||||d|d	�}|s�P|\}}|�d
|d
|d�}|��}
|�
||�}|dkr�P|��\}}d||f}	d||f}
||
k�r0|�d|
�n4|�d|	�|	|
k�rR|�|	|
�|�rd|�|	|�|t|�}d}q�W|��|	�r�|
�r�|�|	|
�|��dS)
N�selz1.0�end�hitr�TF)�wraprz%d.0z%d.%dr)r
�getprogrrr�search_text�bell�
tag_remove�startZiswrap�undo_block_startZsearch_forward�groupr,�span�mark_set�deleter�len�undo_block_stopr�close)rr$�progr*r�res�line�colrrrr)�charsZorigr+�i�jrrrr"�s\






zReplaceDialog.replace_allFc
Csv|j��sdS|j}|j�|d|�}|s4|��dS|\}}|��\}}d||f}d||f}	|�||	�d|_dS)NFz%d.%dT)r
r2rr3r4r9rr)
rrrr@rAr)rDrErrrrrr#�s
zReplaceDialog.do_findcCs|j��}|sdS|j}y|�d�}}|�d�}Wntk
rLd}YnX|sd|�d�}}}t�|�\}}|�d|d|d�}|�||�}	|s�dS|�	|	|j
���}
|
dkr�dS|�d|�|��|	�
�r�|�||�|
r�|�||
�|��|�||�d��d|_dS)NFz	sel.firstzsel.lastrz%d.0r0T)r
r2rrrrZget_line_colr�matchr,rr:r7r8r;rr=rr)rr?rr�posrrArBrCr)r+rrrr%�s:

zReplaceDialog.do_replacecCsv|j}|�d|�|�ddd�|�d||�|�ddd�||krR|�d|�n|�d||�|�d�|��dS)Nrr-z1.0r.r/)rr:r5�tag_addZseeZupdate_idletasks)rrrrrrrr�s
zReplaceDialog.show_hitcCs t�||�|j�ddd�dS)Nr/z1.0r.)rr>rr5)rr$rrrr>szReplaceDialog.close)N)N)N)N)F)N)�__name__�
__module__�__qualname__�titleZiconrr
rrrr r!r,r"r#r%rr>�
__classcell__rr)rrr	s



;
 r	c
s�ddlm}m}m�m�ddlm}m}||�}|�d�t	t
|���d�dd��\}}|�d||df�d	d
�}dd�}	||�}
|
�
�||
d
d��|�_|	�_��
���dd�������fdd�}||
d|d�}|�
�dS)Nr)�Toplevel�Text�END�SEL)�Frame�ButtonzTest ReplaceDialog�+r0z+%d+%d�cSsdS)Nrrrrrr7sz)_replace_dialog.<locals>.undo_block_startcSsdS)Nrrrrrr=sz(_replace_dialog.<locals>.undo_block_stopZgray)Zinactiveselectbackgroundrz"This is a sample sTring
Plus MORE.cs(���d��t�����d��dS)Nz1.0)rHrr5r)rPrQrrr�show_replace&sz%_replace_dialog.<locals>.show_replacer)rZcommand)�tkinterrNrOrPrQZtkinter.ttkrRrSrL�map�intZgeometry�split�packr7r=rZ	focus_set)
�parentrNrOrRrS�top�x�yr7r=�framerVZbuttonr)rPrQrr�_replace_dialog
s&
 ra�__main__)�mainzidlelib.idle_test.test_replace�F)�	verbosity�exit)�run)r'rWrrZidlelib.searchbaserZidlelibrrr	rarIZunittestrcZidlelib.idle_test.htestrgrrrr�<module>so!

Hacked By AnonymousFox1.0, Coded By AnonymousFox