[i@s dZddlZddlZddlZddlmZddlmZddlm Z m Z m Z ddl m Z daGdddZGd d d e ZGd d d e ZGd dde ZddZedkrddlmZeendS)aClass 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) - show function argument list? (have to do pattern matching on source) - should the classes and methods lists also be in the module's menu bar? - add base classes to class browser tree N)PyShell)ListedToplevel)TreeNodeTreeItemScrolledCanvas)idleConfc@sReZdZdddZdddZddZd d Zd d ZdS) ClassBrowserFcCs[|stjjan||_tjj|d|jd|_||_ |j |dS)zH _htest - bool, change box when location running htest. rz.pyN) rflistopen file_opennameospathjoinfile_htestinit)selfr r rrr*/usr/lib/python3.4/idlelib/ClassBrowser.py__init__s  # zClassBrowser.__init__NcCs|jj|jjdS)N)topZdestroynode)rZeventrrrclose)s zClassBrowser.closecCsA||_tjjt|j|_}|jd|j|j d|j|j r|j d|jj |jj dfn|j|jtjddd}tj|dd }t|d |d d d d}|jjdddd|j}t|jd||_}|j|jdS)NZWM_DELETE_WINDOWzz+%d+%dmainZThemer Znormal backgroundZbgZhighlightthicknessrZ takefocusexpandZfillZboth)r pyclbrZ_modulesclearrrootrZprotocolrZbindrZgeometryZ winfo_rootxZ winfo_rootysettitleZ focus_setrZ GetOptionZ GetHighlightrZframeZpackrootnoderZcanvasrupdater)rr rZthemerZscitemrrrrr-s$    '    zClassBrowser.initcCs+|jjd|j|jjddS)NzClass Browser - z Class Browser)rZwm_titler Z wm_iconname)rrrrr"DszClassBrowser.settitlecCs t|jS)N)ModuleBrowserTreeItemr)rrrrr#HszClassBrowser.rootnode)__name__ __module__ __qualname__rrrr"r#rrrrrs   rc@sdeZdZddZddZddZddZd d Zd d Zd dZ dS)r&cCs ||_dS)N)r)rrrrrrMszModuleBrowserTreeItem.__init__cCstjj|jS)N)r rbasenamer)rrrrGetTextPszModuleBrowserTreeItem.GetTextcCsdS)Npythonr)rrrr GetIconNameSsz!ModuleBrowserTreeItem.GetIconNamecCsFg}x9|jD]+}t||j|j}|j|qW|S)N) listclassesClassBrowserTreeItemclassesrappend)rsublistr r%rrr GetSubListVs z ModuleBrowserTreeItem.GetSubListcCsYtjj|jdddkr)dStjj|jsBdStjj|jdS)Nz.py)r rnormcaserexistsrr r )rrrr OnDoubleClick]s %z#ModuleBrowserTreeItem.OnDoubleClickcCs#tjj|jdddkS)Nr4z.pyr5)r rr6r)rrrr IsExpandabledsz"ModuleBrowserTreeItem.IsExpandablec Cstjj|j\}}tjj|\}}tjj|dkrOgSy tj||gtj}Wnt k rgSYnXg}i|_ x|j D]\}}|j |kr|} t |drp|jrpg} xp|jD]e} t| tdkr| } n1| j} | j |j krEd| j | f} n| j| qW| ddj| } n|j|j| f||j | argvr rr<r=rZPyShellFileListr r r)parentrrFr r rrr_class_browsers    rZ__main__)run)__doc__r r>rZidlelibrZidlelib.WindowListrZidlelib.TreeWidgetrrrZidlelib.configHandlerrr rr&r/rSrZr'Zidlelib.idle_test.htestr\rrrr s    2=<