Your IP : 18.224.44.233


Current Path : /lib64/python2.7/idlelib/
Upload File :
Current File : //lib64/python2.7/idlelib/ColorDelegator.pyc

�
{fc@s�ddlZddlZddlZddlZddlmZddlmZeZ	d�Z
d�Zeje�ej
�Zejdej
�Zdefd��YZd	�Zed
kr�ddlmZee�ndS(i����N(t	Delegator(tidleConfcCsd|dj|�dS(s9Return a named group pattern matching list of alternates.s(?P<%s>t|t)(tjoin(tnamet
alternates((s./usr/lib64/python2.7/idlelib/ColorDelegator.pytany
scCs�dtdtj�d}gtt�D]!}|jd�s't|�^q'}|jd�dtd|�d}tddg�}d	}|d
}|d}|d}|d
}	td||	||g�}
|d|d|d|
dtddg�S(Ns\btKEYWORDt_tprints([^.'\"\\#]\b|^)tBUILTINtCOMMENTs#[^\n]*s((\br|u|ur|R|U|UR|Ur|uR|b|B|br|Br|bR|BR)?s'[^'\\\n]*(\\.[^'\\\n]*)*'?s"[^"\\\n]*(\\.[^"\\\n]*)*"?s''''[^'\\]*((\\.|'(?!''))[^'\\]*)*(''')?s'"""[^"\\]*((\\.|"(?!""))[^"\\]*)*(""")?tSTRINGRtSYNCs\n(Rtkeywordtkwlisttdirt__builtin__t
startswithtstrtremove(tkwRtbuiltinlisttbuiltintcommenttstringprefixtsqstringtdqstringt	sq3stringt	dq3stringtstring((s./usr/lib64/python2.7/idlelib/ColorDelegator.pytmake_pats!




s\s+(\w+)tColorDelegatorcBs�eZd�Zd�Zd�Zd�Zdd�Zdd�ZdZ	e
ZeZ
dd�ZdZdd�Zd�Zd	�Zd
�Zd�ZRS(
cCs-tj|�t|_t|_|j�dS(N(Rt__init__tprogtidprogtLoadTagDefs(tself((s./usr/lib64/python2.7/idlelib/ColorDelegator.pyR"'s
		cCs�|jdk	r|jd�ntj||�|dk	rk|j�|jd|j�|jdd�nt	|_
t|_dS(Ns<<toggle-auto-coloring>>s1.0tend(
tdelegatetNonetunbindRtsetdelegatet
config_colorstbindttoggle_colorize_eventtnotify_rangetTruetstop_colorizingtFalsetallow_colorizing(R&R(((s./usr/lib64/python2.7/idlelib/ColorDelegator.pyR+-s
	cCsJx6|jj�D]%\}}|r|j||�qqW|jd�dS(Ntsel(ttagdefstitemst
tag_configuret	tag_raise(R&ttagtcnf((s./usr/lib64/python2.7/idlelib/ColorDelegator.pyR,:scCs�tj�}i	tj|d�d6tj|d�d6tj|d�d6tj|d�d6tj|d	�d
6idd6dd6d
6idd6dd6d6tj|d�d6tj|d�d6|_tr�dG|jGHndS(NRRRRRRRR
t
definitiont
DEFINITIONt
backgroundt
foregroundRtTODOterrortERRORthitR5(RtCurrentThemetGetHighlightR)R5tDEBUG(R&ttheme((s./usr/lib64/python2.7/idlelib/ColorDelegator.pyR%@scCsG|j|�}|jj|||�|j||dt|��dS(Ns+%dc(tindexR(tinsertR/tlen(R&RGtcharsttags((s./usr/lib64/python2.7/idlelib/ColorDelegator.pyRHQscCs3|j|�}|jj||�|j|�dS(N(RGR(tdeleteR/(R&tindex1tindex2((s./usr/lib64/python2.7/idlelib/ColorDelegator.pyRLVscCs�|jd||�|jr.tr*dGHndS|jrQt|_trQdGHqQn|jr�trhdGHn|jd|j�|_ndS(NR?scolorizing already scheduledsstop colorizingsschedule colorizingi(	ttag_addtafter_idREt
colorizingR0R1R3taftert
recolorize(R&RMRN((s./usr/lib64/python2.7/idlelib/ColorDelegator.pyR/_s				cCsw|jr9|j}d|_tr)dGHn|j|�nt|_t|_|rs|jsg|j	�qs||_
ndS(Nscancel scheduled recolorizer(RPR)REtafter_cancelR2R3R0R1RQtdestroytclose_when_done(R&RVRP((s./usr/lib64/python2.7/idlelib/ColorDelegator.pytclosems						
cCs�|jr9|j}d|_tr)dGHn|j|�n|jre|jretrYdGHnt|_n|j|_|jr�|jr�|jd|j	�|_ntr�dG|jr�dp�dGHndS(Nscancel scheduled recolorizersstop colorizingisauto colorizing turnedtontofftbreak(
RPR)RERTR3RQR0R1RRRS(R&teventRP((s./usr/lib64/python2.7/idlelib/ColorDelegator.pyR.{s"			
cCs3d|_|js$tr dGHndS|js?tr;dGHndS|jrZtrVdGHndSz\t|_t|_tr}dGHnt	j
�}|j�t	j
�}tr�d||GHnWdt|_X|jr|jdd�rtr�dGHn|j
d	|j�|_n|jr/|j}d|_|j�ndS(
Nsno delegatesauto colorizing is offsalready colorizings
colorizing...s%.3f secondsR?s1.0sreschedule colorizingi(R)RPR(RER3RQR2R1R0ttimetclocktrecolorize_maint
tag_nextrangeRRRSRVRU(R&tt0tt1ttop((s./usr/lib64/python2.7/idlelib/ColorDelegator.pyRS�s@						

			cCs�d}x�tr�|jd|�}|s+Pn|\}}|jd||�|jd|�}|ro|d}nd}d}|}d}t}x|s�|}|j|d|�}t|dd�}d|j|d	�k}|j||�}	|	s�dSx*|j	j
�D]}
|j|
||�qW||	}|jj|�}x�|r4x�|j
�j�D]�\}}
|
r`|j|�\}}|j||d
||d
|�|
dkr|jj||�}|r|jd�\}}|jd
|d
||d
|�qqq`q`W|jj||j��}qGWd|j|d	�kr]|}d}nt}|s||jd|�n|j�|jr�tr�dGHndSq�Wq	WdS(Ns1.0R?Rits+%d lines linestartiids-1cs+%dctdeftclassR<scolorizing stopped(RdRe(R0R_t
tag_removet
tag_prevrangeR2RGtmint	tag_namestgetR5tkeysR#tsearcht	groupdictR6tspanROR$tmatchR'tupdateR1RE(R&tnexttitemtheadttailRJtlines_to_gettoktmarktlineR9tmtkeytvaluetatbtm1((s./usr/lib64/python2.7/idlelib/ColorDelegator.pyR^�sl	
	
				
	cCs1x*|jj�D]}|j|dd�qWdS(Ns1.0R'(R5RkRf(R&R9((s./usr/lib64/python2.7/idlelib/ColorDelegator.pytremovecolors�sN(t__name__t
__module__R"R+R,R%R)RHRLRPR0R3R2RQR/RVRWR.RSR^R(((s./usr/lib64/python2.7/idlelib/ColorDelegator.pyR!%s 		
					Ac	Cs�ddlm}m}ddlm}||�}|jd�|jd|j�d|j�df�d}||d	d
�}|j	ddd
d�|j
d|�|j�||�}t�}|j
|�dS(Ni����(tTopleveltText(t
PercolatorsTest ColorDelegators
200x100+%d+%di�i�s'if somename: x = 'abc' # comment
print
R=twhitetexpanditfilltbothRH(tTkinterR�R�tidlelib.PercolatorR�ttitletgeometrytwinfo_rootxtwinfo_rootytpackRHt	focus_setR!tinsertfilter(	tparentR�R�R�Rbtsourcettexttptd((s./usr/lib64/python2.7/idlelib/ColorDelegator.pyt_color_delegator�s

	t__main__(trun(R\treRRtidlelib.DelegatorRtidlelib.configHandlerRR2RERR tcompiletSR#R$R!R�R�tidlelib.idle_test.htestR�(((s./usr/lib64/python2.7/idlelib/ColorDelegator.pyt<module>s		�	

?>