mò &U²Ic @sždZdkZdklZdklZdkZedddddd d d d d g ƒZdd>ZdZ dZ ei dƒd„Z dfd„ƒYZ dS(sFCodeContext - Display the block context of code at top of edit window Once code has scrolled off the top of the screen, it can be difficult to determine which block you are in. This extension implements a pane at the top of each IDLE edit window which provides block structure hints. These hints are the lines which contain the block opening keywords, e.g. 'if', for the enclosing block. The number of hint lines is determined by the numlines variable in the CodeContext section of config-extensions.def. Lines which do not open blocks are not shown in the context hints pane. N(sidleConf(sSettclasstdefteliftelsetexcepttfinallytfortifttrytwhileiiidiès ^(\s*)(\w*)cCs|i|ƒiƒS(N(tctmatchtstgroups(R R ((t0/data/zmath/lib/python2.4/idlelib/CodeContext.pytst CodeContextcBs¿tZddgfgZeidddddd d ƒZeiddd dd d d ƒZeiddddd d dƒZd„Zdd„Z d„Z d„Z d„Z d„Zd„ZRS(Ntoptionss!Code Conte_xts<>t extensionsRtnumlinesttypetinttdefaultitbgcolortstrt LightGraytfgcolortBlackcCsÈ||_|i|_|id|_d|_t|idƒƒ|_d|_ t i ddddddt ƒ}|o!|iƒ|iid tƒn|iit|iƒ|iit|iƒdS( NtfontiRRtvisibleRtboolRs<>(teditwintselfttextttextfonttNonetlabeltlisttinteresting_linestinfot lastfirstlinetidleConft GetOptiontFalseRttoggle_code_context_eventtsetvartTruetaftertUPDATEINTERVALt timer_eventtFONTUPDATEINTERVALtfont_timer_event(R RR((Rt__init__#s      cCsÞ|ip‹ti|iidd|idddddd|id |id |i d d d dƒ|_|ii ddddddd|ii ƒn|ii ƒd|_tidddt|idj ƒƒtiƒdS(NR!s itanchortwtjustifytleftRtbgtfgtrelieftsunkentwidthtsidettoptfilltxtexpandiR/RRR(R R$tTkintertLabelRR?RR"RRtpackt status_bartdestroyR#R)t SetOptionRtSaveUserCfgFiles(R tevent((RR,4s     cCs³|djoddtfSn|iid|d|ƒ}t|ƒ\}}|tjo|}t |ƒt |ƒjp|t |ƒdjo t }n t |ƒ}|||fS(s‹Get the line indent value, text, and any block start keyword If the line does not start a block, the keyword value is False. The indentation of empty lines (or comment lines) is INFINITY. There is a dummy block start, with indentation -1 and text "". Return the indent level, text (including leading whitespace), and the block opening keyword. iiÿÿÿÿts%d.0s%d.endt#N( tlinenumR.R R!tgettgetspacesfirstwordtspacest firstwordt BLOCKOPENERStopenertlentINFINITYtindent(R RMRVR!RPRSRQ((Rt get_line_infoGs  0  ccs“t}x†t|ddƒD]r}|i|ƒ\}}}||joG|}|djo|d7}n|o||jo||fVq‹qqWdS(s<Generator which yields context lines, starting at firstline.iÿÿÿÿRRiN(RR( RUt lastindenttxranget firstlinet line_indexR RWRVR!RS(R RZRXR[RSR!RV((RR&]s  cCsYt|iidƒidƒdƒ}|i|jodSn||_g}xw|i|ƒD]f\}}x'|i dd|jo|i d=qkW|i dd|joPn|i ||fƒq\Wx"|o|i i |i ƒƒqÉWdgt d|it|i ƒƒg}|i |i D]}||dq$~}di|ƒ|id>(t__name__t __module__tmenudefsR)R*RRRR4R#R,RWR&RfR1R3(((RRs         (t__doc__RCt configHandlerR)tsetstSettreRRRUR0R2tcompileROR( RnRCRRROR)RoRUR0R2R((Rt? s    *