Your IP : 216.73.216.213


Current Path : /opt/alt/python35/lib64/python3.5/Tools/demo/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/Tools/demo/__pycache__/redemo.cpython-35.pyc



��Yf��@sRdZddlTddlZGdd�d�Zdd�ZedkrNe�dS)	zDBasic regular expression demonstration facility (Perl style syntax).�)�*Nc@sReZdZdd�Zdd�Zdd�Zddd	�Zdd
d�ZdS)�ReDemoc
Cs||_t|jdtdd�|_|jjdtdt�t|j�|_|jjdt�|jj	�|j
�t|jdddt�|_|jjdtdt�t|jdtdd�|_|jjdt�|jjdt�t
|�|_|jjdtdt�t|�|_|jjd�t|jdd	d
|jddd|j�|_|jjdt�t|jdd
d
|jddd|j�|_|jjdt�t|jdddd�|_|jjdtdd�|jjddd�t|jdddt�|_|jjdt�t|j�|_|jjdddt�|jjd|j�|jjd|j�d|_ |j�|jj!�}|jj!|dd�|dd��|jj!�}|jj!|dd�|dd��dS)NZanchor�textz&Enter a Perl-style regular expression:�side�fill�zEnter a string to search:�firstzHighlight first match�variable�value�commandzHighlight all matches�all�width�<Zheight��expand��hit�
background�yellowzGroups:z<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/python35/lib64/python3.5/Tools/demo/redemo.py�__init__
sZ	

			
(zReDemo.__init__c
Cs�g|_g|_g|_x�dD]�}t|j�ddkrpt|j�}|jdt�|jj|�t	t
|�}t�}t|d	|d
|ddd|d
|j
�}|jdt�|jj|�|jj|�q"WdS)N�
IGNORECASE�LOCALE�	MULTILINE�DOTALL�VERBOSE�rrr	rZoffvalueZonvaluerr)r+r,r-r.r/)ZframesZboxes�vars�lenrrrr�append�getattr�reZIntVarZCheckbuttonr r!)r'�name�frame�val�varZboxr(r(r)rIs*			
		zReDemo.addoptionscCs4d}x!|jD]}||j�B}qW|}|S)Nr)r1�get)r'�flagsr9r(r(r)�getflags`s
zReDemo.getflagsNcCs�yNtj|jj�|j��|_|jd}|jjddd|�WnTtj	k
r�}z1d|_|jjddt
|�dd�WYdd}~XnX|j�dS)Nrrrzre.error: %sZred)r5�compilerr:r<r&rr�config�error�strr%)r'�eventZbg�msgr(r(r)r gs
	zReDemo.recompilec
CsNy|jjddt�Wntk
r.YnXy|jjddt�Wntk
r]YnX|jjdt�|js~dS|jjddd�|jjddd�|jjdt�}d}d}xA|t	|�kr|jj
||�}|dkrP|j�\}}||kr3|d}d}nd}d	|}d	|}	|jj|||	�|dkr�|jj
|�t|j��}
|
jd|j��xAtt	|
��D]-}d
||
|f}|jjt|�q�W|d}|jj�dkr�Pq�W|dkr7|jjdd
dd�n|jjdd�dS)Nrz1.0Zhit0rrrZorangerz1.0 + %d charsz%2d: %rrrz
(no match)r)r"Z
tag_removeZENDZTclErrorr$Zdeleter&r#r:r2�search�spanZtag_addZyview_pickplace�list�groups�insert�group�rangerrr>)
r'rArZlastZnmatches�mr�tagZpfirstZplastrF�i�gr(r(r)r%tsT

	
	



zReDemo.reevaluate)�__name__�
__module__�__qualname__r*rr<r r%r(r(r(r)rs
?
rcCs6t�}t|�}|jd|j�|j�dS)NZWM_DELETE_WINDOW)ZTkrZprotocol�quitZmainloop)�rootZdemor(r(r)�main�s	rS�__main__)�__doc__Ztkinterr5rrSrNr(r(r(r)�<module>s
�