Hacked By AnonymousFox

Current Path : /opt/alt/python37/lib64/python3.7/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/idlelib/__pycache__/browser.cpython-37.opt-1.pyc

B

� fz �@s�dZddlZddlZddlZddlmZddlmZddlm	Z	m
Z
mZddlm
Z
daddd�ZGd	d
�d
�ZGdd�de
�ZGd
d�de
�Zdd�Zedkr�eej�dkr�ddlmZedddd�ddlmZee�dS)a8Module 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)�ListedToplevelcCs�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)aTransform 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_childrens
rc@sBeZdZdZddd�dd�Zddd�Zd	d
�Zdd�Zd
d�ZdS)�
ModuleBrowserz1Browse module classes and functions in IDLE.
    F)�_htest�_utestcCs$||_||_||_||_|��dS)azCreate 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�pathrr�init)�selfrrrrrrr�__init__As
zModuleBrowser.__init__NcCs|j��|j��dS)z&Dismiss the window and the tree nodes.N)�topZdestroy�node)rZeventrrr�closeYs
zModuleBrowser.closec	Cs�|j}|js|jstjnt�|�}|jatj	�
�t|�|_}|�
d|j�|�d|j�|jr�|�d|��|��df�|��|��t��}t�|d�d}t||ddd	�}|jjdd
d�|��}t|jd|�|_}|js�|��|� �dS)
z3Create browser tkinter widgets, including the tree.ZWM_DELETE_WINDOWz<Escape>z+%d+%d��Znormal�
backgroundr�)ZbgZhighlightthicknessZ	takefocusZboth)�expandZfillN)!rrrr�flistZPyShellFileList�open�	file_open�pyclbrZ_modules�clearrr!Zprotocolr#ZbindZgeometryZwinfo_rootxZwinfo_rooty�settitleZ	focus_setrZCurrentThemeZGetHighlightr�frameZpack�rootnoderZcanvasr"�updater')	r�rootr(r!Zthemer%Zsc�itemr"rrrr^s.

zModuleBrowser.initcCs*|j�dtj�|j��|j�d�dS)zSet the window title.zModule Browser - zModule BrowserN)r!Zwm_title�osr�basenameZwm_iconname)rrrrr-}szModuleBrowser.settitlecCs
t|j�S)z7Return a ModuleBrowserTreeItem as the root of the tree.)�ModuleBrowserTreeItemr)rrrrr/�szModuleBrowser.rootnode)N)	�__name__�
__module__�__qualname__�__doc__r r#rr-r/rrrrr:s
rc@sHeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dS)r5z~Browser tree for Python module.

    Uses TreeItem as the basis for the structure of the tree.
    Used by both browsers.
    cCs
||_dS)zdCreate a TreeItem for the file.

        Args:
            file: Full path and module name.
        N)�file)rr:rrrr �szModuleBrowserTreeItem.__init__cCstj�|j�S)z5Return the module name as the text string to display.)r3rr4r:)rrrr�GetText�szModuleBrowserTreeItem.GetTextcCsdS)z'Return the name of the icon to display.�pythonr)rrrr�GetIconName�sz!ModuleBrowserTreeItem.GetIconNamecCsdd�|��D�S)z*Return ChildBrowserTreeItems for children.cSsg|]}t|��qSr)�ChildBrowserTreeItem)�.0rrrr�
<listcomp>�sz4ModuleBrowserTreeItem.GetSubList.<locals>.<listcomp>)�listchildren)rrrr�
GetSubList�sz ModuleBrowserTreeItem.GetSubListcCs>tj�|jdd��dkrdStj�|j�s0dSt|j�dS)z6Open a module in an editor window when double clicked.���Nz.py)r3r�normcaser:�existsr*)rrrr�
OnDoubleClick�s
z#ModuleBrowserTreeItem.OnDoubleClickcCstj�|jdd��dkS)z!Return True if Python (.py) file.rCNz.py)r3rrDr:)rrrr�IsExpandable�sz"ModuleBrowserTreeItem.IsExpandablecCsntj�|j�\}}tj�|�\}}tj�|�dkr6gSyt�||gtj�}Wnt	k
rbgSXt
||�S)z5Return sequenced classes and functions in the module.z.py)r3r�splitr:�splitextrDr+Z
readmodule_ex�sys�ImportErrorr)r�dir�baserZextZtreerrrrA�sz"ModuleBrowserTreeItem.listchildrenN)r6r7r8r9r r;r=rBrFrGrArrrrr5�sr5c@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)r>zsBrowser tree for child nodes within the module.

    Uses TreeItem as the basis for the structure of the tree.
    cCs ||_|j|_t|tj�|_dS)z5Create a TreeItem for a pyclbr class/function object.N)rr�
isinstancer+ZFunction�
isfunction)rrrrrr �szChildBrowserTreeItem.__init__cCs$|j}|jrd|dSd|SdS)z1Return the name of the function/class to display.zdef z(...)zclass N)rrO)rrrrrr;�szChildBrowserTreeItem.GetTextcCs|jr
dSdSdS)z'Return the name of the icon to display.r<ZfolderN)rO)rrrrr=�sz ChildBrowserTreeItem.GetIconNamecCs|jjikS)z+Return True if self.obj has nested objects.)r�children)rrrrrG�sz!ChildBrowserTreeItem.IsExpandablecCsdd�t|jj�D�S)z*Return ChildBrowserTreeItems for children.cSsg|]}t|��qSr)r>)r?rrrrr@�sz3ChildBrowserTreeItem.GetSubList.<locals>.<listcomp>)rrrP)rrrrrB�szChildBrowserTreeItem.GetSubListc	Cs<yt|jj�}|�|jj�Wnttfk
r6YnXdS)z2Open module with file_open and position to lineno.N)r*rr:Zgotoline�lineno�OSError�AttributeError)rZeditrrrrF�s
z"ChildBrowserTreeItem.OnDoubleClickN)
r6r7r8r9r r;r=rGrBrFrrrrr>�sr>cCsHttj�dkrtjd}nt}Gdd�dt�}dd�}t||dd�dS)Nr&c@seZdZdd�ZdS)z'_module_browser.<locals>.Nested_in_funccSsdS)Nrrrrr�nested_in_class��z7_module_browser.<locals>.Nested_in_func.nested_in_classN)r6r7r8rTrrrr�Nested_in_func�srVcSsGdd�d�}dS)Nc@seZdZdS)z;_module_browser.<locals>.closure.<locals>.Nested_in_closureN)r6r7r8rrrr�Nested_in_closure�srWr)rWrrr�closure�sz _module_browser.<locals>.closureT)r)�lenrJ�argv�__file__rr)�parentr:rVrXrrr�_module_browser�sr]�__main__r&)�mainzidlelib.idle_test.test_browser�F)�	verbosity�exit)�run)N)r9r3r+rJZidlelib.configrZidlelibrZidlelib.treerrrZidlelib.windowrr*rrr5r>r]r6rYrZZunittestr_Zidlelib.idle_test.htestrcrrrr�<module>
s&
 M4-

Hacked By AnonymousFox1.0, Coded By AnonymousFox