File "CodeContext.cpython-34.pyc"

Full Path: /home/attunedd/public_html/byp/izo/con7ext_sym404/rintoar.txt/opt/alt/python34/lib64/python3.4/idlelib/__pycache__/CodeContext.cpython-34.pyc
File size: 6.04 KB
MIME-type: text/x-bytecode.python
Charset: 8 bit


e f @sdZddlZddlmZmZmZmZmZddlZddl	m
Zddlm
Z
dddd	d
ddd
dddhZdZdZejdddZGdddZdS)aICodeContext - Extension to display the block context above the edit window

Once code has scrolled off the top of a window, 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)TOPLEFTXWSUNKEN)maxsize)idleConfclassdefelifelseexceptfinallyforiftrywhilewithdiz^(\s*)(\w*)cCs|j|jS)N)matchgroups)scr8/opt/alt/python34/lib64/python3.4/idlelib/CodeContext.py<lambda>src@seZdZdd gfgZejddddddd	Zejddd
ddddZejddd
ddddZddZ	dddZ
ddZddddZddZ
ddZddZdS)!CodeContextZoptions!Code Conte_xt<<toggle-code-context>>
extensionsZnumlinestypeintdefaultbgcolorstrZ	LightGrayfgcolorZBlackcCs||_|j|_|jd|_d|_dg|_d|_tjdddd	d
dd}|r|j|jj	dd
n|jj
t|j|jj
t
|jdS)NfontrFrrvisibler boolr"z<<toggle-code-context>>T)rr,r)F)editwintexttextfontlabelinfo
topvisibler	GetOptiontoggle_code_context_eventZsetvarafterUPDATEINTERVALtimer_eventFONTUPDATEINTERVALfont_timer_event)selfr-r*rrr__init__"s			
zCodeContext.__init__NcCs|jsC|jj|jjf}d}xM|D]E}|tt|jd7}|tt|jd7}q.Wd}x-|D]%}|tt|jd7}qWtj	|jj
dd|jddtdt
d	|jd
|jd|jddd|d|d
t
|_|jjdtdtddd|jjn|jjd|_tjdddt|jdk	tjdS)Nrpadxborderr.
r(ZanchorZjustifyr'ZbgZfgwidthZreliefZsideZfillexpandFZbeforerrr*)r0r-r.Z
text_framer!r%Z	pack_infoZcgettkinterZLabeltop
context_depthrrr/r$r&rZpackrrZdestroyrZ	SetOptionZSaveUserCfgFiles)r:ZeventZwidgetsr<Zwidgetr=rrrr47s0	
 #
#	
	z%CodeContext.toggle_code_context_eventcCs|jjd|d|}t|\}}|tko>|}t|t|kso|t|dkrxt}nt|}|||fS)zGet 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.

        z%d.0z%d.end#)r.getgetspacesfirstwordBLOCKOPENERSlenINFINITY)r:linenumr.ZspacesZ	firstwordopenerindentrrr
get_line_info[s.	zCodeContext.get_line_infor(rc
Cs|dkstg}t}xt||ddD]}|j|\}}}	||kr5|}|	dkr~|d7}n|	r||kr||kr|j||||	fn||krPqq5q5W|j||fS)zGet context lines, starting at new_topvisible and working backwards.

        Stop when stopline or stopindent is reached. Return a tuple of context
        data and the indent level at the top of the region inspected.

        rr(rrr,)zelsezelif)AssertionErrorrIrangerMappendreverse)
r:new_topvisibleZstopline
stopindentlines
lastindentrJrLr.rKrrrget_contextks

zCodeContext.get_contextcCst|jjdjdd}|j|kr8dS|j|kr|j||j\}}x|jdd|kr|jd=qeWn|j|kr|jd
dd}x6|jdd|kr|jdd}|jd=qW|j||jddd|\}}n|jj|||_dgtd|j	t
|j}|dd|j|j	dD7}d	j||jd
<dS)zKUpdate context information and lines visible in the context pane.

        z@0,0.rNr(r)cSsg|]}|dqS)r).0xrrr
<listcomp>s	z3CodeContext.update_code_context.<locals>.<listcomp>r>r.r,r,r,r,r,r,r,)
r!r.indexsplitr2rVr1extendmaxrCrHjoinr0)r:rRrTrUrSZcontext_stringsrrrupdate_code_contexts*%			&(zCodeContext.update_code_contextcCs0|jr|jn|jjt|jdS)N)r0rar.r5r6r7)r:rrrr7s	
zCodeContext.timer_eventcCs[|jd}|jrA||jkrA||_|j|jd<n|jjt|jdS)Nr')r.r0r/r5r8r9)r:Znewtextfontrrrr9s

	zCodeContext.font_timer_event)rr)__name__
__module____qualname__Zmenudefsrr3rCr$r&r;r4rMrVrar7r9rrrrrs$ r)__doc__rAZtkinter.constantsrrrrrresysrrIZidlelib.configHandlerrrGr6r8compilerFrrrrr<module>s(