관리-도구
편집 파일: codecontext.cpython-36.pyc
3 � f�( � @ s� d Z ddlZddlmZ ddlZddlmZmZm Z ddl mZ dddd d ddd ddddhZdZ dZejd�fdd�Zdd� ZG dd� d�Zej� edkr�ddlmZ edddd � dS )!a< codecontext - 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 maxlines variable in the codecontext section of config-extensions.def. Lines which do not open blocks are not shown in the context hints pane. � N)�maxsize)�TOP�X�SUNKEN)�idleConf�class�def�elif�else�except�finally�for�if�try�while�with�async�d i� z^(\s*)(\w*)c C s |j | �j� S )z>Extract the beginning whitespace and first word from codeline.)�match�groups)�codeline�c� r �8/opt/alt/python36/lib64/python3.6/idlelib/codecontext.py�get_spaces_firstword s r c C sF t | �\}}t|�}t| �|ks,| | dkr0t}|tko:|}|| |fS )z�Return tuple of (line indent value, codeline, block start keyword). The indentation of empty lines (or comment lines) is INFINITY. If the line does not start a block, the keyword value is False. �#)r �len�INFINITY�BLOCKOPENERS)r ZspacesZ firstword�indent�openerr r r � get_line_info s r! c @ sb e Zd ZdZdd� Zedd� �Zdd� Zdd d �Zdd d�Z dd� Z ddd�Zdd� Zdd� Z dS )�CodeContextz,Display block context above the edit window.c C s^ || _ |j| _| jd | _tj| _d| _d| _dg| _| jj t | j�| _| jj t | j�| _dS ) a> Initialize settings for context block. editwin is the Editor window for the context block. self.text is the editor window text widget. self.textfont is the editor window font. self.context displays the code context text above the editor text. Initially None, it is toggled via <<toggle-code-context>>. self.topvisible is the number of the top text line displayed. self.info is a list of (line number, indent level, line text, block keyword) tuples for the block structure above topvisible. self.info[0] is initialized with a 'dummy' line which starts the toplevel 'block' of the module. self.t1 and self.t2 are two timer events on the editor text widget to monitor for changes to the context text or editor font. �fontN� r � F���)r r&