[' @sddlZddlZddlZddlmZddlmZmZddl m Z GdddeZ GdddeZ Gd d d eZ d d Zed krddlmZedddddddlmZeendS)N)TreeItem) ClassBrowserModuleBrowserTreeItem)PyShellFileListc@s7eZdZdddZddZddZdS) PathBrowserFcCs||_|j|dS)zG _htest - bool, change box location when running htest N)_htestinit)selfflistrr )/usr/lib/python3.4/idlelib/PathBrowser.py__init__ s zPathBrowser.__init__cCs$|jjd|jjddS)Nz Path Browser)topZwm_titleZ wm_iconname)r r r r settitleszPathBrowser.settitlecCstS)N)PathBrowserTreeItem)r r r r rootnodeszPathBrowser.rootnodeN)__name__ __module__ __qualname__r rrr r r r r s  rc@s(eZdZddZddZdS)rcCsdS)Nzsys.pathr )r r r r GetTextszPathBrowserTreeItem.GetTextcCs7g}x*tjD]}t|}|j|qW|S)N)syspathDirBrowserTreeItemappend)r sublistdiritemr r r GetSubLists  zPathBrowserTreeItem.GetSubListN)rrrrrr r r r rs  rc@sOeZdZgddZddZddZddZd d Zd S) rcCs||_||_dS)N)rpackages)r rrr r r r (s zDirBrowserTreeItem.__init__cCs#|js|jS|jddSdS)Nz : package)rr)r r r r r,s zDirBrowserTreeItem.GetTextc Cs@ytj|jptj}Wntk r7gSYnXg}x`|D]X}tjj|j|}|j|rEtjj|}|j |||fqEqEW|j g}x=|D]5\}}}t ||j |g}|j |qWxH|j |D]7\}}ttjj|j|}|j |qW|S)N)oslistdirrcurdirOSErrorrjoin ispackagedirnormcasersortrr listmodulesr)r namesrnamefileZnnrrr r r r2s&    zDirBrowserTreeItem.GetSubListcCs;tjj|sdStjj|d}tjj|S)Nrz __init__.py)r!risdirr%exists)r r,rr r r r&GszDirBrowserTreeItem.ispackagedirc Csi}tjjdd}|tjjdd7}|tjjdd7}g}x|D]}t| }x|ddD]z}tjj|}||d|kr|d|} | |krd|| <|j ||f|j |qqqWq]W|j |S)N) importlib machineryEXTENSION_SUFFIXESSOURCE_SUFFIXESBYTECODE_SUFFIXESlenr!rr'rremover() r ZallnamesmodulessuffixessortedZsuffir+Z normed_nameZmod_namer r r r)Ms"     zDirBrowserTreeItem.listmodulesN)rrrr rrr&r)r r r r r&s    rcCs*t|}t|dd|jdS)NrT)rrZmainloop)parentr r r r _path_browser`s r;__main__)mainz"idlelib.idle_test.test_pathbrowser verbosityexitF)run)r!rimportlib.machineryr/Zidlelib.TreeWidgetrZidlelib.ClassBrowserrrZidlelib.PyShellrrrrr;rZunittestr=Zidlelib.idle_test.htestrAr r r r s    :