Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/idlelib/ClassBrowser.pyo

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


��Qc@s�dZddlZddlZddlZddlmZddlmZddlm	Z	m
Z
mZddlm
Z
ddd��YZd	e
fd
��YZde
fd��YZd
e
fd��YZd�Zedkr��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*/sys/lib/python2.7/idlelib/ClassBrowser.pyt__init__s	#cCs|jj�|jj�dS(N(ttoptdestroytnode(R
tevent((s*/sys/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
dd�}|jjd
ddd�|j�}t|jd|�|_}|j�|j�dS(NtWM_DELETE_WINDOWs<Escape>tmaintThemeRtnormalt
backgroundtbgthighlightthicknessit	takefocusitexpandtfilltboth(Rtpyclbrt_modulestclearRtrootRtprotocolRtbindtsettitlet	focus_setRt	GetOptiontGetHighlightRtframetpacktrootnodeRtcanvastNoneRtupdateR(R
RRtthemeRtsctitemR((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyR#s	



cCs+|jjd|j�|jjd�dS(NsClass Browser - s
Class Browser(Rtwm_titleRtwm_iconname(R
((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyR&7scCs
t|j�S(N(tModuleBrowserTreeItemR(R
((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyR,;sN(t__name__t
__module__RR.RRR&R,(((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyRs
			R5cBsGeZd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs
||_dS(N(R(R
R((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyR@scCstjj|j�S(N(RR	tbasenameR(R
((s*/sys/lib/python2.7/idlelib/ClassBrowser.pytGetTextCscCsdS(Ntpython((R
((s*/sys/lib/python2.7/idlelib/ClassBrowser.pytGetIconNameFscCsFg}x9|j�D]+}t||j|j�}|j|�qW|S(N(tlistclassestClassBrowserTreeItemtclassesRtappend(R
tsublistRR2((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyt
GetSubListIs
cCsStjj|jd�dkr#dStjj|j�s<dStjj|j�dS(Ni�s.py(RR	tnormcaseRtexistsRRtopen(R
((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyt
OnDoubleClickPs
cCstjj|jd�dkS(Ni�s.py(RR	RBR(R
((s*/sys/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�|
ddj|�}
n|j|	j|
f�|	|j
|
<q�q�W|j�g}x!|D]\}}
|j|
�q�W|S(Ns.pytsuperts%s.%ss(%s)s, (RR	tsplitRtsplitextRBR t
readmodule_extsystImportErrorR>titemstmodulethasattrRGttypeRR?R
tlinenotsort(R
tdirRRtexttdicttmsgRNtkeytcltstsuperstsuptsnametlistR2((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyR<Zs< 			
(	R6R7RR9R;RARERFR<(((s*/sys/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>RRYt
IndexErrortKeyErrorR.t
isinstanceR tFunctiont
isfunction(R
RR>R((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyR}s			
cCs'|jrd|jdSd|jSdS(Nsdef s(...)sclass (RcR(R
((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyR9�s	cCs|jr
dSdSdS(NR:tfolder(Rc(R
((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyR;�s	cCs5|jr1y|jjSWq1tk
r-tSXndS(N(RYtmethodstAttributeErrortFalse(R
((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyRF�s
	
cCsS|js
gSg}x9|j�D]+}t||j|j�}|j|�q W|S(N(RYtlistmethodstMethodBrowserTreeItemRR?(R
R@RR2((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyRA�s	cCs`tjj|j�sdStjj|j�}t|jd�r\|jj	}|j
|�ndS(NRR(RR	RCRRRRDRPRYRRtgotoline(R
teditRR((s*/sys/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*/sys/lib/python2.7/idlelib/ClassBrowser.pyRh�s	
(	R6R7RR9R;RFRARERh(((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyR={s	
						RicBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCs||_||_||_dS(N(RRYR(R
RRYR((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyR�s		cCsd|jdS(Nsdef s(...)(R(R
((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyR9�scCsdS(NR:((R
((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyR;�scCsdS(Ni((R
((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyRF�scCsLtjj|j�sdStjj|j�}|j|jj	|j
�dS(N(RR	RCRRRRDRjRYReR(R
Rk((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyRE�s(R6R7RR9R;RFRE(((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyRi�s
				cCs�y
t}WnHtk
rTtjd}tjdrDtjd}qUtjd}nXtjj|�\}}tjj|�d}tt	j
||g�tjtjkr�t
�ndS(Nii(t__file__t	NameErrorRLtargvRR	RIRJRRRtstdint	__stdin__tmainloop(RRTR((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyR�s



t__main__((t__doc__RRLR tidlelibRtidlelib.WindowListRtidlelib.TreeWidgetRRRtidlelib.configHandlerRRR5R=RiRR6(((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyt<module>s(=<	

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].