ó ú^‚Rc@sîdZddlZddlZddlZddlmZddlmZddlm Z m Z m Z ddl m Z ddd„ƒYZd e fd „ƒYZd e fd „ƒYZd e fd„ƒYZd„ZedkrêeƒndS(s„Class 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 iÿÿÿÿN(tPyShell(tListedToplevel(tTreeNodetTreeItemtScrolledCanvas(tidleConft ClassBrowsercBs8eZd„Zdd„Zd„Zd„Zd„ZRS(cCs=||_tjj|d|jdƒ|_|j|ƒdS(Nis.py(tnametostpathtjointfiletinit(tselftflistRR ((s*/usr/lib/python2.7/idlelib/ClassBrowser.pyt__init__s #cCs|jjƒ|jjƒdS(N(ttoptdestroytnode(R tevent((s*/usr/lib/python2.7/idlelib/ClassBrowser.pytcloses cCs||_tjjƒt|jƒ|_}|jd|jƒ|j d|jƒ|j ƒ|j ƒt j dddƒ}t j|dƒd}t|d|d d d d ƒ}|jjd d ddƒ|jƒ}t|jd|ƒ|_}|jƒ|jƒdS(NtWM_DELETE_WINDOWstmaintThemeRtnormalt backgroundtbgthighlightthicknessit takefocusitexpandtfilltboth(Rtpyclbrt_modulestclearRtrootRtprotocolRtbindtsettitlet focus_setRt GetOptiont GetHighlightRtframetpacktrootnodeRtcanvastNoneRtupdateR(R RRtthemeRtsctitemR((s*/usr/lib/python2.7/idlelib/ClassBrowser.pyR #s      cCs+|jjd|jƒ|jjdƒdS(NsClass Browser - s Class Browser(Rtwm_titleRt wm_iconname(R ((s*/usr/lib/python2.7/idlelib/ClassBrowser.pyR&7scCs t|jƒS(N(tModuleBrowserTreeItemR (R ((s*/usr/lib/python2.7/idlelib/ClassBrowser.pyR,;sN(t__name__t __module__RR.RR R&R,(((s*/usr/lib/python2.7/idlelib/ClassBrowser.pyRs     R5cBsGeZd„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(cCs ||_dS(N(R (R R ((s*/usr/lib/python2.7/idlelib/ClassBrowser.pyR@scCstjj|jƒS(N(RR tbasenameR (R ((s*/usr/lib/python2.7/idlelib/ClassBrowser.pytGetTextCscCsdS(Ntpython((R ((s*/usr/lib/python2.7/idlelib/ClassBrowser.pyt GetIconNameFscCsFg}x9|jƒD]+}t||j|jƒ}|j|ƒqW|S(N(t listclassestClassBrowserTreeItemtclassesR tappend(R tsublistRR2((s*/usr/lib/python2.7/idlelib/ClassBrowser.pyt GetSubListIs cCsStjj|jdƒdkr#dStjj|jƒs<dStjj|jƒdS(Niýÿÿÿs.py(RR tnormcaseR texistsRRtopen(R ((s*/usr/lib/python2.7/idlelib/ClassBrowser.pyt OnDoubleClickPs cCstjj|jdƒdkS(Niýÿÿÿs.py(RR RBR (R ((s*/usr/lib/python2.7/idlelib/ClassBrowser.pyt IsExpandableWscCsÐtjj|jƒ\}}tjj|ƒ\}}tjj|ƒdkrOgSy tj||gtjƒ}Wnt k r…}gSXg}i|_ x|j ƒD]ò\}} | j |kr¢|} t | dƒrn| jrng} xp| jD]e} t| ƒtdƒkr| } n1| j} | j | j krCd| j | f} n| j| ƒqëW| ddj| ƒ} n|j| j| fƒ| |j | titemstmodulethasattrRGttypeRR?R tlinenotsort(R tdirR RtexttdicttmsgRNtkeytcltstsuperstsuptsnametlistR2((s*/usr/lib/python2.7/idlelib/ClassBrowser.pyR<Zs<     ( R6R7RR9R;RARERFR<(((s*/usr/lib/python2.7/idlelib/ClassBrowser.pyR5>s      R=cBsGeZd„Zd„Zd„Zd„Zd„Zd„Zd„ZRS(cCsq||_||_||_y|j|j|_Wn ttfk rTd|_nXt|jtj ƒ|_ dS(N( RR>R RYt IndexErrortKeyErrorR.t isinstanceR tFunctiont isfunction(R RR>R ((s*/usr/lib/python2.7/idlelib/ClassBrowser.pyR}s    cCs'|jrd|jdSd|jSdS(Nsdef s(...)sclass (RcR(R ((s*/usr/lib/python2.7/idlelib/ClassBrowser.pyR9‡s cCs|jr dSdSdS(NR:tfolder(Rc(R ((s*/usr/lib/python2.7/idlelib/ClassBrowser.pyR;s cCs5|jr1y|jj SWq1tk r-tSXndS(N(RYtmethodstAttributeErrortFalse(R ((s*/usr/lib/python2.7/idlelib/ClassBrowser.pyRF“s   cCsS|js gSg}x9|jƒD]+}t||j|jƒ}|j|ƒq W|S(N(RYt listmethodstMethodBrowserTreeItemR R?(R R@RR2((s*/usr/lib/python2.7/idlelib/ClassBrowser.pyRAšs cCs`tjj|jƒsdStjj|jƒ}t|jdƒr\|jj }|j |ƒndS(NRR( RR RCR RRRDRPRYRRtgotoline(R teditRR((s*/usr/lib/python2.7/idlelib/ClassBrowser.pyRE£s  cCs|js gSg}x3|jjjƒD]\}}|j||fƒq&W|jƒg}x!|D]\}}|j|ƒq`W|S(N(RYReRNR?RS(R RNRRRR^R2((s*/usr/lib/python2.7/idlelib/ClassBrowser.pyRh«s  ( R6R7RR9R;RFRARERh(((s*/usr/lib/python2.7/idlelib/ClassBrowser.pyR={s    RicBs5eZd„Zd„Zd„Zd„Zd„ZRS(cCs||_||_||_dS(N(RRYR (R RRYR ((s*/usr/lib/python2.7/idlelib/ClassBrowser.pyR¹s  cCsd|jdS(Nsdef s(...)(R(R ((s*/usr/lib/python2.7/idlelib/ClassBrowser.pyR9¾scCsdS(NR:((R ((s*/usr/lib/python2.7/idlelib/ClassBrowser.pyR;ÁscCsdS(Ni((R ((s*/usr/lib/python2.7/idlelib/ClassBrowser.pyRFÄscCsLtjj|jƒsdStjj|jƒ}|j|jj |j ƒdS(N( RR RCR RRRDRjRYReR(R Rk((s*/usr/lib/python2.7/idlelib/ClassBrowser.pyREÇs(R6R7RR9R;RFRE(((s*/usr/lib/python2.7/idlelib/ClassBrowser.pyRi·s     cCs¹y t}WnHtk rTtjd}tjdrDtjd}qUtjd}nXtjj|ƒ\}}tjj|ƒd}tt j ||gƒtj tj krµt ƒndS(Nii(t__file__t NameErrorRLtargvRR RIRJRRRtstdint __stdin__tmainloop(R RTR((s*/usr/lib/python2.7/idlelib/ClassBrowser.pyRÍs    t__main__((t__doc__RRLR tidlelibRtidlelib.WindowListRtidlelib.TreeWidgetRRRtidlelib.configHandlerRRR5R=RiRR6(((s*/usr/lib/python2.7/idlelib/ClassBrowser.pyt s   (=<