//usr/lib64/lib64//lib64/lib64//ó
ŰSec @ sË d Z d d l Z d d l m Z m Z m Z m Z m Z d d l Z d d l m
Z d d l m
Z
e d d d d d
d d d
d d d g Z d Z d Z e j d d Z d d d YZ d S( sI CodeContext - 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.
i˙˙˙˙N( t TOPt LEFTt Xt Wt SUNKEN( t maxint( t idleConft classt deft elift elset exceptt finallyt fort ift tryt whilet withid ič s ^(\s*)(\w*)c C s | j | j S( N( t matcht groups( t st c( ( s+ /usr/lib64/python2.7/idlelib/CodeContext.pyt s t CodeContextc B sĹ e Z d d g f g Z e j d d d d d d d Z e j d d d
d d d d Z e j d d d
d d d d Z d Z d d Z
d Z d d d Z d Z
d Z d Z RS( t optionss !Code Conte_xts <>t
extensionsR t numlinest typet intt defaulti t bgcolort strt LightGrayt fgcolort Blackc C sĆ | | _ | j | _ | j d | _ d | _ d d d t f g | _ d | _ t j d d d d d
d t } | r | j
| j j d t n | j j
t | j | j j
t | j d S(
Nt fonti i˙˙˙˙t i R R t visibleR t boolR s <>( t editwint textt textfontt Nonet labelt Falset infot
topvisibleR t GetOptiont toggle_code_context_eventt setvart Truet aftert UPDATEINTERVALt timer_eventt FONTUPDATEINTERVALt font_timer_event( t selfR' R% ( ( s+ /usr/lib64/python2.7/idlelib/CodeContext.pyt __init__" s
c C s | j sC| j j | j j f } d } xM | D]E } | t t | j d 7} | t t | j d 7} q. Wd } x- | D]% } | t t | j d 7} q Wt j | j j
d d | j d d t d t
d | j d
| j d | j d d d | d | d
t
| _ | j j d t d t d t d | j j n | j j d | _ t j d d d t | j d k t j d S( Ni t padxt borderR( s
i t anchort justifyR# t bgt fgt widtht relieft sidet fillt expandt beforeR R R% ( R+ R' R( t
text_frameR R t pack_infot cgett Tkintert Labelt topt
context_depthR R R) R R! R t packR R R, t destroyR* R t SetOptiont SaveUserCfgFiles( R8 t eventt widgetsR: t widgetR; ( ( s+ /usr/lib64/python2.7/idlelib/CodeContext.pyR0 7 s0
#
#
c C s | j j d | d | } t | \ } } | t k o> | } t | t | k so | t | d k rx t } n t | } | | | f S( 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.
s %d.0s %d.endt #( R( t gett getspacesfirstwordt BLOCKOPENERSt lent INFINITY( R8 t linenumR( t spacest firstwordt openert indent( ( s+ /usr/lib64/python2.7/idlelib/CodeContext.pyt
get_line_info[ s . i i c
C sŃ g } t } xŽ t | | d d D] } | j | \ } } } | | k r# | } | d k rl | d 7} n | rŚ | | k rŚ | | k rŚ | j | | | | f n | | k rš Pqš q# q# W| j | | f S( sä Get 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.
i i˙˙˙˙R
R ( R
R ( RY t xrangeR_ t appendt reverse(
R8 t new_topvisiblet stoplinet
stopindentt linest
lastindentRZ R^ R( R] ( ( s+ /usr/lib64/python2.7/idlelib/CodeContext.pyt get_contextk s
c C s t | j j d j d d } | j | k r8 d S| j | k r | j | | j \ } } x˛ | j d d | k r | j d =qe Wn | j | k r| j d d d } x6 | j d d | k ré | j d d } | j d =q´ W| j | | j d d d | \ } } n | j j | | | _ d g t d | j t
| j } | g | j | j D] } | d ^ qk7} d j | | j d