qfc@sdZddlZddlZddlZddlmZddlmZddlm Z m Z m Z ddl m Z dddYZd e fd YZd e fd YZd e fdYZdZedkrendS(sClass 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 iN(tPyShell(tListedToplevel(tTreeNodetTreeItemtScrolledCanvas(tidleConft ClassBrowsercBs8eZdZddZdZdZdZRS(cCs=||_tjj|d|jd|_|j|dS(Nis.py(tnametostpathtjointfiletinit(tselftflistRR ((s,/usr/lib64/python2.7/idlelib/ClassBrowser.pyt__init__s #cCs|jj|jjdS(N(ttoptdestroytnode(R tevent((s,/usr/lib64/python2.7/idlelib/ClassBrowser.pytcloses cCs||_tjjt|j|_}|jd|j|j d|j|j |j t j ddd}t j|dd}t|d|d d d d }|jjd d dd|j}t|jd||_}|j|jdS(NtWM_DELETE_WINDOWstmaintThemeRtnormalt backgroundtbgthighlightthicknessit takefocusitexpandtfilltboth(Rtpyclbrt_modulestclearRtrootRtprotocolRtbindtsettitlet focus_setRt GetOptiont GetHighlightRtframetpacktrootnodeRtcanvastNoneRtupdateR(R RRtthemeRtsctitemR((s,/usr/lib64/python2.7/idlelib/ClassBrowser.pyR #s      cCs+|jjd|j|jjddS(NsClass Browser - s Class Browser(Rtwm_titleRt wm_iconname(R ((s,/usr/lib64/python2.7/idlelib/ClassBrowser.pyR&7scCs t|jS(N(tModuleBrowserTreeItemR (R ((s,/usr/lib64/python2.7/idlelib/ClassBrowser.pyR,;sN(t__name__t __module__RR.RR R&R,(((s,/usr/lib64/python2.7/idlelib/ClassBrowser.pyRs     R5cBsGeZdZdZdZdZdZdZdZRS(cCs ||_dS(N(R (R R ((s,/usr/lib64/python2.7/idlelib/ClassBrowser.pyR@scCstjj|jS(N(RR tbasenameR (R ((s,/usr/lib64/python2.7/idlelib/ClassBrowser.pytGetTextCscCsdS(Ntpython((R ((s,/usr/lib64/python2.7/idlelib/ClassBrowser.pyt GetIconNameFscCsFg}x9|jD]+}t||j|j}|j|qW|S(N(t listclassestClassBrowserTreeItemtclassesR tappend(R tsublistRR2((s,/usr/lib64/python2.7/idlelib/ClassBrowser.pyt GetSubListIs cCsStjj|jddkr#dStjj|js<dStjj|jdS(Nis.py(RR tnormcaseR texistsRRtopen(R ((s,/usr/lib64/python2.7/idlelib/ClassBrowser.pyt OnDoubleClickPs cCstjj|jddkS(Nis.py(RR RBR (R ((s,/usr/lib64/python2.7/idlelib/ClassBrowser.pyt IsExpandableWscCstjj|j\}}tjj|\}}tjj|dkrOgSy tj||gtj}Wnt k r}gSXg}i|_ x|j D]\}} | j |kr|} t | drn| jrng} xp| jD]e} t| tdkr| } n1| j} | j | j krCd| j | f} n| j| qW| ddj| } n|j| j| f| |j | titemstmodulethasattrRGttypeRR?R tlinenotsort(R tdirR RtexttdicttmsgRNtkeytcltstsuperstsuptsnametlistR2((s,/usr/lib64/python2.7/idlelib/ClassBrowser.pyR<Zs<     ( R6R7RR9R;RARERFR<(((s,/usr/lib64/python2.7/idlelib/ClassBrowser.pyR5>s      R=cBsGeZdZdZdZdZdZdZdZRS(cCsq||_||_||_y|j|j|_Wn ttfk rTd|_nXt|jtj |_ dS(N( RR>R RYt IndexErrortKeyErrorR.t isinstanceR tFunctiont isfunction(R RR>R ((s,/usr/lib64/python2.7/idlelib/ClassBrowser.pyR}s    cCs'|jrd|jdSd|jSdS(Nsdef s(...)sclass (RcR(R ((s,/usr/lib64/python2.7/idlelib/ClassBrowser.pyR9s cCs|jr dSdSdS(NR:tfolder(Rc(R ((s,/usr/lib64/python2.7/idlelib/ClassBrowser.pyR;s cCs5|jr1y|jj SWq1tk r-tSXndS(N(RYtmethodstAttributeErrortFalse(R ((s,/usr/lib64/python2.7/idlelib/ClassBrowser.pyRFs   cCsS|js gSg}x9|jD]+}t||j|j}|j|q W|S(N(RYt listmethodstMethodBrowserTreeItemR R?(R R@RR2((s,/usr/lib64/python2.7/idlelib/ClassBrowser.pyRAs cCs`tjj|jsdStjj|j}t|jdr\|jj }|j |ndS(NRR( RR RCR RRRDRPRYRRtgotoline(R teditRR((s,/usr/lib64/python2.7/idlelib/ClassBrowser.pyREs  cCs|js gSg}x3|jjjD]\}}|j||fq&W|jg}x!|D]\}}|j|q`W|S(N(RYReRNR?RS(R RNRRRR^R2((s,/usr/lib64/python2.7/idlelib/ClassBrowser.pyRhs  ( R6R7RR9R;RFRARERh(((s,/usr/lib64/python2.7/idlelib/ClassBrowser.pyR={s    RicBs5eZdZdZdZdZdZRS(cCs||_||_||_dS(N(RRYR (R RRYR ((s,/usr/lib64/python2.7/idlelib/ClassBrowser.pyRs  cCsd|jdS(Nsdef s(...)(R(R ((s,/usr/lib64/python2.7/idlelib/ClassBrowser.pyR9scCsdS(NR:((R ((s,/usr/lib64/python2.7/idlelib/ClassBrowser.pyR;scCsdS(Ni((R ((s,/usr/lib64/python2.7/idlelib/ClassBrowser.pyRFscCsLtjj|jsdStjj|j}|j|jj |j dS(N( RR RCR RRRDRjRYReR(R Rk((s,/usr/lib64/python2.7/idlelib/ClassBrowser.pyREs(R6R7RR9R;RFRE(((s,/usr/lib64/python2.7/idlelib/ClassBrowser.pyRis     cCsy t}WnHtk rTtjd}tjdrDtjd}qUtjd}nXtjj|\}}tjj|d}tt j ||gtj tj krt ndS(Nii(t__file__t NameErrorRLtargvRR RIRJRRRtstdint __stdin__tmainloop(R RTR((s,/usr/lib64/python2.7/idlelib/ClassBrowser.pyRs    t__main__((t__doc__RRLR tidlelibRtidlelib.WindowListRtidlelib.TreeWidgetRRRtidlelib.configHandlerRRR5R=RiRR6(((s,/usr/lib64/python2.7/idlelib/ClassBrowser.pyt s   (=<