ó t®¸Qc@sçddlZddlZddlZddlZddlTddlmZddlmZe Z d„Z d„Z ej e ƒejƒZej dejƒZej dƒZd efd „ƒYZd „Zed krãeƒndS( iÿÿÿÿN(t*(t Delegator(tidleConfcCsd|dj|ƒdS(s9Return a named group pattern matching list of alternates.s(?P<%s>t|t)(tjoin(tnamet alternates((s,/sys/lib/python2.7/idlelib/ColorDelegator.pytany sc Csðdtdtjƒd}gttƒD]!}|jdƒs't|ƒ^q'}dtd|ƒd}tddgƒ}d}|d }|d }|d }|d } td || ||gƒ} |d|d|d| dtddgƒS(Ns\btKEYWORDt_s([^.'\"\\#]\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 startswithtstr( tkwRt builtinlisttbuiltintcommentt stringprefixtsqstringtdqstringt sq3stringt dq3stringtstring((s,/sys/lib/python2.7/idlelib/ColorDelegator.pytmake_pats!    s\s+(\w+)s .*?\b(as)\btColorDelegatorcBs˜eZd„Zd„Zd„Zd„Zd d„Zd d„Zd Z e Z e Z d d„Zd Zd d„Zd„Zd „Zd „Zd „ZRS( cCs6tj|ƒt|_t|_t|_|jƒdS(N(Rt__init__tprogtidprogtasprogt LoadTagDefs(tself((s,/sys/lib/python2.7/idlelib/ColorDelegator.pyR!&s     cCs|jdk r|jdƒntj||ƒ|dk rk|jƒ|jd|jƒ|jddƒnt |_ t |_ dS(Ns<>s1.0tend( tdelegatetNonetunbindRt setdelegatet config_colorstbindttoggle_colorize_eventt notify_rangetTruetstop_colorizingtFalsetallow_colorizing(R&R(((s,/sys/lib/python2.7/idlelib/ColorDelegator.pyR+-s   cCsJx6|jjƒD]%\}}|r|j||qqW|jdƒdS(Ntsel(ttagdefstitemst tag_configuret tag_raise(R&ttagtcnf((s,/sys/lib/python2.7/idlelib/ColorDelegator.pyR,:scCsùtjdddƒ}i tj|dƒd6tj|dƒd6tj|dƒd 6tj|d ƒd 6tj|d ƒd 6idd6dd6d6idd6dd6d6tj|dƒd6tj|dƒd6tj|dƒd6|_trõdG|jGHndS(NtmaintThemeRRR RR RR RR t definitiont DEFINITIONt backgroundt foregroundRtTODOtbreaktBREAKterrortERRORthitR5(Rt GetOptiont GetHighlightR)R5tDEBUG(R&ttheme((s,/sys/lib/python2.7/idlelib/ColorDelegator.pyR%@scCsG|j|ƒ}|jj|||ƒ|j||dt|ƒƒdS(Ns+%dc(tindexR(tinsertR/tlen(R&RKtcharsttags((s,/sys/lib/python2.7/idlelib/ColorDelegator.pyRLRscCs3|j|ƒ}|jj||ƒ|j|ƒdS(N(RKR(tdeleteR/(R&tindex1tindex2((s,/sys/lib/python2.7/idlelib/ColorDelegator.pyRPWscCs‡|jd||ƒ|jr.tr*dGHndS|jrQt|_trQdGHqQn|jrƒtrhdGHn|jd|jƒ|_ndS(NRAscolorizing already scheduledsstop colorizingsschedule colorizingi( ttag_addtafter_idRIt colorizingR0R1R3taftert recolorize(R&RQRR((s,/sys/lib/python2.7/idlelib/ColorDelegator.pyR/`s     cCsw|jr9|j}d|_tr)dGHn|j|ƒnt|_t|_|rs|jsg|j ƒqs||_ ndS(Nscancel scheduled recolorizer( RTR)RIt after_cancelR2R3R0R1RUtdestroytclose_when_done(R&RZRT((s,/sys/lib/python2.7/idlelib/ColorDelegator.pytclosens       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 turnedtontoffRB( RTR)RIRXR3RUR0R1RVRW(R&teventRT((s,/sys/lib/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( Ns no delegatesauto colorizing is offsalready colorizings colorizing...s %.3f secondsRAs1.0sreschedule colorizingi(R)RTR(RIR3RUR2R1R0ttimetclocktrecolorize_maint tag_nextrangeRVRWRZRY(R&tt0tt1ttop((s,/sys/lib/python2.7/idlelib/ColorDelegator.pyRWs@             cCsMd}x@trH|jd|ƒ}|s+Pn|\}}|jd||ƒ|jd|ƒ}|ro|d}nd}d}|}d}t}xµ|sD|}|j|d|ƒ}t|ddƒ}d|j|d ƒk}|j||ƒ} | sûdSx*|j j ƒD]} |j| ||ƒq W|| }|j j |ƒ} xŽ| rÔxf| j ƒjƒD]R\} } | r`| j| ƒ\}}|j| |d ||d |ƒ| dkr|jj||ƒ}|r¯|jdƒ\}}|jd |d ||d |ƒq¯q²| dkr²d|kr9|jdƒ}n t|ƒ}xgtr«|jj|||ƒ}|spPn|jdƒ\}}|jd|d ||d |ƒqHWq²q`q`W|j j || jƒƒ} qGWd|j|d ƒkrý|}d}nt}|s|jd|ƒn|jƒ|jrtr=dGHndSqWq WdS(Ns1.0RARits+%d lines linestartiids-1cs+%dctdeftclassR>timportt#R scolorizing stopped(RgRh(R0Rbt tag_removet tag_prevrangeR2RKtmint tag_namestgetR5tkeysR"tsearcht groupdictR6tspanRSR#tmatchRMR$R'tupdateR1RI(R&tnexttitemtheadttailRNt lines_to_gettoktmarktlineR9tmtkeytvaluetatbtm1tendpos((s,/sys/lib/python2.7/idlelib/ColorDelegator.pyRaªs„                      cCs1x*|jjƒD]}|j|ddƒqWdS(Ns1.0R'(R5RpRk(R&R9((s,/sys/lib/python2.7/idlelib/ColorDelegator.pyt removecolorsûsN(t__name__t __module__R!R+R,R%R)RLRPRTR0R3R2RUR/RZR[R.RWRaR…(((s,/sys/lib/python2.7/idlelib/ColorDelegator.pyR $s           QcCs‹ddlm}tƒ}|jd|jƒtddƒ}|jdddd ƒ|jƒ||ƒ}tƒ}|j |ƒ|j ƒdS( Niÿÿÿÿ(t PercolatortWM_DELETE_WINDOWR?twhitetexpanditfilltboth( tidlelib.PercolatorRˆtTkt wm_protocoltquittTexttpackt focus_setR t insertfiltertmainloop(Rˆtrootttexttptd((s,/sys/lib/python2.7/idlelib/ColorDelegator.pyR;ÿs     t__main__(R_treRRtTkintertidlelib.DelegatorRtidlelib.configHandlerRR2RIRRtcompiletSR"R#R$R R;R†(((s,/sys/lib/python2.7/idlelib/ColorDelegator.pyts       Û