ó {fc@sáddlZddlZddlZddlZddlmZddlmZeZ d„Z d„Z ej e ƒej ƒZej dej ƒZdefd„ƒYZd „Zed krÝdd lmZeeƒ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 sc Csý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( tkwRt builtinlisttbuiltintcommentt 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 Z e Z d d„Zd Zd d„Zd„Zd „Zd „Zd „ZRS( cCs-tj|ƒt|_t|_|jƒdS(N(Rt__init__tprogtidprogt LoadTagDefs(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<>s1.0tend( tdelegatetNonetunbindRt setdelegatet 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 6idd 6dd 6d 6idd 6dd 6d6tj|dƒd6tj|dƒd6|_trÙdG|jGHndS(NRR RRRR RR 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( Ns no 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| ||ƒq W|| }|j j |ƒ} xî| r4xÆ| j ƒjƒD]²\} } | r`| j| ƒ\}}|j| |d ||d |ƒ| dkr|jj||ƒ}|r|jdƒ\}}|jd |d ||d |ƒqqq`q`W|j j || jƒƒ} qGWd|j|d ƒkr]|}d}nt}|s||jd|ƒn|jƒ|jrtrdGHndSqWq 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 d d 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„ttitletgeometryt winfo_rootxt winfo_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.pyts      É