Your IP : 216.73.216.85


Current Path : /opt/alt/python37/lib64/python3.7/Tools/demo/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/Tools/demo/__pycache__/redemo.cpython-37.pyc

B

� f��@s<dZddlTddlZGdd�d�Zdd�Zedkr8e�dS)	zDBasic regular expression demonstration facility (Perl style syntax).�)�*Nc@s8eZdZdd�Zdd�Zdd�Zddd	�Zd
d
d�ZdS)�ReDemocCs||_t|jtdd�|_|jjttd�t|j�|_|jjtd�|j�	�|�
�t|jdtd�|_|jjttd�t|jtdd�|_|jjtd�|jjtd�t
|�|_|jjttd�t|�|_|j�d	�t|jd
|jd	|jd�|_|jjtd�t|jd
|jd|jd�|_|jjtd�t|jddd�|_|jjtdd�|jjddd�t|jdtd�|_|jjtd�t|j�|_|jjdtd�|j�d|j�|j�d|j�d|_ |��|j�!�}|j�!|dd�|dd��|j�!�}|j�!|dd�|dd��dS)Nz&Enter a Perl-style regular expression:)�anchor�text)�side�fill)r�)rrzEnter a string to search:)rr�firstzHighlight first match)r�variable�value�command)rzHighlight all matches�all�<�)�widthZheight�)r�expand�hit�yellow)�
backgroundzGroups:)rrz<Key>)"�masterZLabel�W�
promptdisplay�packZTOP�XZEntry�regexdisplayZ	focus_set�
addoptions�
statusdisplayZlabeldisplay�FrameZ	showframeZ	StringVar�showvar�setZRadiobutton�	recompileZshowfirstradio�LEFTZshowallradioZText�
stringdisplayZBOTH�
tag_configureZ
grouplabelZListbox�	grouplistZbind�
reevaluate�compiledZbindtags)�selfrZbtags�r)�6/opt/alt/python37/lib64/python3.7/Tools/demo/redemo.py�__init__
sZ





 
zReDemo.__init__c	Cs�g|_g|_g|_x�dD]�}t|j�ddkrPt|j�}|jtd�|j�|�t	t
|�j}t�}t
|||d||jd�}|jtd�|j�|�|j�|�qWdS)N)�
IGNORECASE�	MULTILINE�DOTALL�VERBOSE�r)r)r
rZoffvalueZonvaluer)r)ZframesZboxes�vars�lenrrrr�append�getattr�rerZIntVarZCheckbuttonr!r")r(�name�frame�val�varZboxr)r)r*rIs"


zReDemo.addoptionscCs(d}x|jD]}||��B}qW|}|S)Nr)r1�get)r(�flagsr9r)r)r*�getflags_s
zReDemo.getflagsNc
Cs�y6t�|j��|���|_|jd}|jjd|d�WnBtj	k
rx}z"d|_|jjdt
|�dd�Wdd}~XYnX|��dS)Nrr)rrzre.error: %sZred)r5�compilerr:r<r'rr�config�error�strr&)r(�eventZbg�msgr)r)r*r!fs

zReDemo.recompilec
Cs�y|j�ddt�Wntk
r(YnXy|j�ddt�Wntk
rRYnX|j�dt�|jsldS|jjddd�|jjddd�|j�dt�}d}d}x�|t	|�k�r�|j�
||�}|dkr�P|��\}}||kr�|d}d}nd}d	|}d	|}	|j�|||	�|dk�rx|j�
|�t|���}
|
�d|���x4tt	|
��D]$}d
||
|f}|j�t|��qPW|d}|j��dkr�Pq�W|dk�r�|jjddd
�n|jjdd�dS)Nrz1.0Zhit0rr)rZorangerz1.0 + %d charsz%2d: %rr	z
(no match))rrr)r)r#Z
tag_removeZENDZTclErrorr%�deleter'r$r:r2�search�spanZtag_addZyview_pickplace�list�groups�insert�group�rangerrr>)
r(rArZlastZnmatches�mr	�tagZpfirstZplastrG�i�gr)r)r*r&ssT


zReDemo.reevaluate)N)N)�__name__�
__module__�__qualname__r+rr<r!r&r)r)r)r*rs
?

rcCs(t�}t|�}|�d|j�|��dS)NZWM_DELETE_WINDOW)ZTkrZprotocol�quitZmainloop)�rootZdemor)r)r*�main�srT�__main__)�__doc__Ztkinterr5rrTrOr)r)r)r*�<module>s