Your IP : 216.73.216.213


Current Path : /opt/alt/python36/lib64/python3.6/Tools/demo/__pycache__/
Upload File :
Current File : //opt/alt/python36/lib64/python3.6/Tools/demo/__pycache__/redemo.cpython-36.pyc

3

� 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�|jj	�|j
�t|jdtd�|_|jjttd�t|jtdd�|_|jjtd�|jjtd�t
|�|_|jjttd�t|�|_|jjd	�t|jd
|jd	|jd�|_|jjtd�t|jd
|jd|jd�|_|jjtd�t|jddd�|_|jjtdd�|jjddd�t|jdtd�|_|jjtd�t|j�|_|jjdtd�|jjd|j�|jjd|j�d|_ |j�|jj!�}|jj!|dd�|dd��|jj!�}|jj!|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/python36/lib64/python3.6/Tools/demo/redemo.py�__init__
sZ





 
zReDemo.__init__c	Cs�g|_g|_g|_x�d
D]�}t|j�ddkrPt|j�}|jtd�|jj|�t	t
|�j}t�}t
|||d||jd�}|jtd	�|jj|�|jj|�qWdS)N�
IGNORECASE�	MULTILINE�DOTALL�VERBOSE�r)r)r
rZoffvalueZonvaluer)r)r,r-r.r/)ZframesZboxes�vars�lenrrrr�append�getattr�rerZIntVarZCheckbuttonr!r")r(�name�frame�val�varZboxr)r)r*rIs(

zReDemo.addoptionscCs(d}x|jD]}||j�B}qW|}|S)Nr)r1�get)r(�flagsr9r)r)r*�getflags_s
zReDemo.getflagsNcCs�y6tj|jj�|j��|_|jd}|jjd|d�WnBtj	k
rx}z$d|_|jjdt
|�dd�WYdd}~XnX|j�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|jjddt�Wntk
r(YnXy|jjddt�Wntk
rRYnX|jjdt�|jsldS|jjddd�|jjddd�|jjdt�}d}d}x�|t	|�k�r�|jj
||�}|dkr�P|j�\}}||kr�|d}d}nd}d	|}d	|}	|jj|||	�|dk�rx|jj
|�t|j��}
|
jd|j��x4tt	|
��D]$}d
||
|f}|jjt|��qPW|d}|jj�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|�}|jd|j�|j�dS)NZWM_DELETE_WINDOW)ZTkrZprotocol�quitZmainloop)�rootZdemor)r)r*�main�srT�__main__)�__doc__Ztkinterr5rrTrOr)r)r)r*�<module>s