%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/local/lib/python3.8/idlelib/__pycache__/
Upload File :
Create Path :
Current File : //usr/local/lib/python3.8/idlelib/__pycache__/browser.cpython-38.pyc

U

qaz @sdZddlZddlZddlZddlmZddlmZddlm	Z	m
Z
mZddlm
Z
dadddZGd	d
d
ZGddde
ZGd
dde
ZddZedkreejdkrddlmZeddddddlmZeedS)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)TreeNodeTreeItemScrolledCanvas)ListedToplevelcCsg}|D]\}}|dks&|j|krt|dr|jr|j|krg}|jD]F}t|tdkrd|}n"|j}|j|jkr|jd|}||qJ|jdd|7_||q|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.
    Nsuper.z({})z, )	itemsmodulehasattrrnametypeappendformatjoin)Z
child_dictmodnameZobskeyobjZsuperssupZsnamer+/usr/local/lib/python3.8/idlelib/browser.pytransform_childrens

rc@sBeZdZdZdddddZdddZd	d
ZddZd
dZdS)
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)masterpathrrinit)selfrrrrrrr__init__As
zModuleBrowser.__init__NcCs|j|jdS)z&Dismiss the window and the tree nodes.N)topZdestroynode)r eventrrrcloseYs
zModuleBrowser.closec	Cs|j}|js|jstjnt|}|jatj	
t||_}|
d|j|d|j|jr|d||df||t}t|dd}t||ddd	}|jjdd
d|}t|jd||_}|js|| dS)
z3Create browser tkinter widgets, including the tree.ZWM_DELETE_WINDOWz<Escape>z+%d+%dZnormal
backgroundr)bgZhighlightthicknessZ	takefocusZboth)expandfillN)!rrrrflistZPyShellFileListopen	file_openpyclbrZ_modulesclearrr"protocolr%bindZgeometryZwinfo_rootxZwinfo_rootysettitleZ	focus_setrZCurrentThemeZGetHighlightrframepackrootnoderZcanvasr#updater*)	r rootr,r"Zthemer'Zscitemr#rrrr^s4
zModuleBrowser.initcCs*|jdtj|j|jddS)zSet the window title.zModule Browser - zModule BrowserN)r"Zwm_titleosrbasenameZwm_iconnamer rrrr3}szModuleBrowser.settitlecCs
t|jS)z7Return a ModuleBrowserTreeItem as the root of the tree.)ModuleBrowserTreeItemrr<rrrr6szModuleBrowser.rootnode)N)	__name__
__module____qualname____doc__r!r%rr3r6rrrrr:s
rc@sHeZdZdZddZddZddZdd	Zd
dZdd
Z	ddZ
dS)r=z~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)r rBrrrr!szModuleBrowserTreeItem.__init__cCstj|jS)z5Return the module name as the text string to display.)r:rr;rBr<rrrGetTextszModuleBrowserTreeItem.GetTextcCsdS)'Return the name of the icon to display.pythonrr<rrrGetIconNamesz!ModuleBrowserTreeItem.GetIconNamecCsdd|DS)*Return ChildBrowserTreeItems for children.cSsg|]}t|qSrChildBrowserTreeItem.0rrrr
<listcomp>sz4ModuleBrowserTreeItem.GetSubList.<locals>.<listcomp>)listchildrenr<rrr
GetSubListsz ModuleBrowserTreeItem.GetSubListcCs>tj|jdddkrdStj|js0dSt|jdS)z6Open a module in an editor window when double clicked.N.py)r:rnormcaserBexistsr.r<rrr
OnDoubleClicks
z#ModuleBrowserTreeItem.OnDoubleClickcCstj|jdddkS)z!Return True if Python (.py) file.rONrP)r:rrQrBr<rrrIsExpandablesz"ModuleBrowserTreeItem.IsExpandablecCsrtj|j\}}tj|\}}tj|dkr6gSzt||gtj}Wnt	k
rfgYSXt
||S)z5Return sequenced classes and functions in the module.rP)r:rsplitrBsplitextrQr/Z
readmodule_exsysImportErrorr)r dirbaserextZtreerrrrMs
z"ModuleBrowserTreeItem.listchildrenN)r>r?r@rAr!rCrFrNrSrTrMrrrrr=sr=c@s@eZdZdZddZddZddZdd	Zd
dZdd
Z	dS)rIzsBrowser 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)r rrrrr!szChildBrowserTreeItem.__init__cCs$|j}|jrd|dSd|SdS)z1Return the name of the function/class to display.zdef z(...)zclass N)rr])r rrrrrCszChildBrowserTreeItem.GetTextcCs|jr
dSdSdS)rDrEZfolderN)r]r<rrrrFsz ChildBrowserTreeItem.GetIconNamecCs|jjikS)z+Return True if self.obj has nested objects.)rchildrenr<rrrrTsz!ChildBrowserTreeItem.IsExpandablecCsddt|jjDS)rGcSsg|]}t|qSrrHrJrrrrLsz3ChildBrowserTreeItem.GetSubList.<locals>.<listcomp>)rrr^r<rrrrNs
zChildBrowserTreeItem.GetSubListc	Cs<zt|jj}||jjWnttfk
r6YnXdS)z2Open module with file_open and position to lineno.N)r.rrBZgotolinelinenoOSErrorAttributeError)r ZeditrrrrSs
z"ChildBrowserTreeItem.OnDoubleClickN)
r>r?r@rAr!rCrFrTrNrSrrrrrIsrIcCsHttjdkrtjd}nt}Gdddt}dd}t||dddS)Nr(c@seZdZddZdS)z'_module_browser.<locals>.Nested_in_funccSsdS)Nrrrrrnested_in_classz7_module_browser.<locals>.Nested_in_func.nested_in_classN)r>r?r@rbrrrrNested_in_funcsrdcSsGddd}dS)Nc@seZdZdS)z;_module_browser.<locals>.closure.<locals>.Nested_in_closureN)r>r?r@rrrrNested_in_closuresrer)rerrrclosuresz _module_browser.<locals>.closureT)r)lenrWargv__file__rr)parentrBrdrfrrr_module_browsersrk__main__r()mainzidlelib.idle_test.test_browserF)	verbosityexit)run)N)rAr:r/rWZidlelib.configrZidlelibrZidlelib.treerrrZidlelib.windowrr.rrr=rIrkr>rgrhZunittestrmZidlelib.idle_test.htestrqrrrr<module>s&
 M4-

Zerion Mini Shell 1.0