ok
Direktori : /proc/thread-self/root/opt/alt/python37/lib64/python3.7/idlelib/__pycache__/ |
Current File : //proc/thread-self/root/opt/alt/python37/lib64/python3.7/idlelib/__pycache__/browser.cpython-37.pyc |
B � fz � @ s� d Z ddlZddlZddlZddlmZ ddlmZ ddlm Z m Z mZ ddlm Z daddd�ZG d d � d �ZG dd� de �ZG d d� de �Zdd� Zedkr�eej�dkr�ddlmZ edddd� ddlmZ ee� dS )a8 Module browser. XXX TO DO: - reparse when source changed (maybe just a button would be OK?) (or recheck on window popup) - add popup menu with more options (e.g. doc strings, base classes, imports) - add base classes to class browser tree - finish removing limitation to x.py files (ModuleBrowserTreeItem) � N)�idleConf)�pyshell)�TreeNode�TreeItem�ScrolledCanvas)�ListedToplevelc C s� g }x�| � � D ]�\}}|dks(|j|krt|d�r�|jr�|j|kr�g }xP|jD ]F}t|�td�krh|}n"|j}|j|jkr�|j� d|� �}|�|� qNW | jd�d�|��7 _|�|� qW |S )a Transform a child dictionary to an ordered sequence of objects. The dictionary maps names to pyclbr information objects. Filter out imported objects. Augment class names with bases. The insertion order of the dictionary is assumed to have been in line number order, so sorting is not necessary. The current tree only calls this once per child_dict as it saves TreeItems once created. A future tree and tests might violate this, so a check prevents multiple in-place augmentations. N�super� �.z({})z, ) �items�module�hasattrr �name�type�append�format�join)Z child_dict�modnameZobs�key�objZsupersZsupZsname� r �4/opt/alt/python37/lib64/python3.7/idlelib/browser.py�transform_children s r c @ sB e Zd ZdZddd�dd�Zddd�Zd d � Zdd� Zd d� ZdS )� ModuleBrowserz1Browse module classes and functions in IDLE. F)�_htest�_utestc C s$ || _ || _|| _|| _| �� dS )az Create a window for browsing a module's structure. Args: master: parent for widgets. path: full path of file to browse. _htest - bool; change box location when running htest. -utest - bool; suppress contents when running unittest. Global variables: file_open: Function used for opening a file. Instance variables: name: Module name. file: Full path and module with .py extension. Used in creating ModuleBrowserTreeItem as the rootnode for the tree and subsequently in the children. N)�master�pathr r �init)�selfr r r r r r r �__init__A s zModuleBrowser.__init__Nc C s | j �� | j�� dS )z&Dismiss the window and the tree nodes.N)�topZdestroy�node)r Zeventr r r �closeY s zModuleBrowser.closec C s� | j }| js| jstjnt�|�}|jatj � � t|� | _}|� d| j� |�d| j� | jr�|�d|�� |�� d f � | �� |�� t�� }t�|d�d }t||ddd �}|jjdd d� | �� }t|jd|� | _}| js�|�� |� � dS ) z3Create browser tkinter widgets, including the tree.ZWM_DELETE_WINDOWz<Escape>z+%d+%d�� Znormal� backgroundr � )ZbgZhighlightthicknessZ takefocusZboth)�expandZfillN)!r r r r �flistZPyShellFileList�open� file_open�pyclbrZ_modules�clearr r! Zprotocolr# ZbindZgeometryZwinfo_rootxZwinfo_rooty�settitleZ focus_setr ZCurrentThemeZGetHighlightr �frameZpack�rootnoder Zcanvasr"