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

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


�`^c@sdZddlZddlZddlZddlmZddlmZddlm	Z	m
Z
mZddlm
Z
ddd��YZd	e
fd
��YZde
fd��YZd
e
fd��YZd�Zedkr�dlmZee�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ClassBrowsercBs;eZed�Zdd�Zd�Zd�Zd�ZRS(cCsF||_tjj|d|jd�|_||_|j|�dS(sH
        _htest - bool, change box when location running htest.
        is.pyN(tnametostpathtjointfilet_htesttinit(tselftflistRR	R((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyt__init__s	#	cCs|jj�|jj�dS(N(ttoptdestroytnode(Rtevent((s*/sys/lib/python2.7/idlelib/ClassBrowser.pytclose#s
cCsA||_tjj�t|j�|_}|jd|j�|j	d|j�|j
r�|jd|jj�|jj
�df�n|j�|j�tjddd�}tj|d�d	}t|d
|ddd
d�}|jjdddd�|j�}t|jd|�|_}|j�|j�dS(NtWM_DELETE_WINDOWs<Escape>s+%d+%di�tmaintThemeRtnormalt
backgroundtbgthighlightthicknessit	takefocusitexpandtfilltboth(Rtpyclbrt_modulestclearRtrootRtprotocolRtbindRtgeometrytwinfo_rootxtwinfo_rootytsettitlet	focus_setRt	GetOptiontGetHighlightRtframetpacktrootnodeRtcanvastNoneRtupdateR(RRRtthemeRtsctitemR((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*>scCs
t|j�S(N(tModuleBrowserTreeItemR(R((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyR0BsN(	t__name__t
__module__tFalseRR2RR
R*R0(((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyRs
		R9cBsGeZd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs
||_dS(N(R(RR((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyRGscCstjj|j�S(N(RR	tbasenameR(R((s*/sys/lib/python2.7/idlelib/ClassBrowser.pytGetTextJscCsdS(Ntpython((R((s*/sys/lib/python2.7/idlelib/ClassBrowser.pytGetIconNameMscCsFg}x9|j�D]+}t||j|j�}|j|�qW|S(N(tlistclassestClassBrowserTreeItemtclassesRtappend(RtsublistRR6((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyt
GetSubListPs
cCsStjj|jd�dkr#dStjj|j�s<dStjj|j�dS(Ni�s.py(RR	tnormcaseRtexistsRRtopen(R((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyt
OnDoubleClickWs
cCstjj|jd�dkS(Ni�s.py(RR	RGR(R((s*/sys/lib/python2.7/idlelib/ClassBrowser.pytIsExpandable^scCs�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	tsplitRtsplitextRGR!t
readmodule_extsystImportErrorRCtitemstmodulethasattrRLttypeRRDR
tlinenotsort(RtdirRRtexttdicttmsgRStkeytcltstsuperstsuptsnametlistR6((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyRAas< 			
(	R:R;RR>R@RFRJRKRA(((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyR9Es						RBcBsGeZd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cCsq||_||_||_y|j|j|_Wn ttfk
rTd|_nXt|jtj	�|_
dS(N(RRCRR^t
IndexErrortKeyErrorR2t
isinstanceR!tFunctiont
isfunction(RRRCR((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyR�s			
cCs'|jrd|jdSd|jSdS(Nsdef s(...)sclass (RhR(R((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyR>�s	cCs|jr
dSdSdS(NR?tfolder(Rh(R((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyR@�s	cCs5|jr1y|jjSWq1tk
r-tSXndS(N(R^tmethodstAttributeErrorR<(R((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyRK�s
	
cCsS|js
gSg}x9|j�D]+}t||j|j�}|j|�q W|S(N(R^tlistmethodstMethodBrowserTreeItemRRD(RRERR6((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyRF�s	cCs`tjj|j�sdStjj|j�}t|jd�r\|jj	}|j
|�ndS(NRW(RR	RHRRRRIRUR^RWtgotoline(RteditRW((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyRJ�scCs�|js
gSg}x3|jjj�D]\}}|j||f�q&W|j�g}x!|D]\}}|j|�q`W|S(N(R^RjRSRDRX(RRSRRWRcR6((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyRl�s	
(	R:R;RR>R@RKRFRJRl(((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyRB�s	
						RmcBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCs||_||_||_dS(N(RR^R(RRR^R((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyR�s		cCsd|jdS(Nsdef s(...)(R(R((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyR>�scCsdS(NR?((R((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyR@�scCsdS(Ni((R((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyRK�scCsLtjj|j�sdStjj|j�}|j|jj	|j
�dS(N(RR	RHRRRRIRnR^RjR(RRo((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyRJ�s(R:R;RR>R@RKRJ(((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyRm�s
				cCs�y
t}WnHtk
rTtjd}tjdrDtjd}qUtjd}nXtjj|�\}}tjj|�d}tj	|�}t
|||gdt�|j�dS(NiiR(
t__file__t	NameErrorRQtargvRR	RNRORtPyShellFileListRtTruetmainloop(tparentRRYRR((s*/sys/lib/python2.7/idlelib/ClassBrowser.pyt_class_browser�s



t__main__(trun((t__doc__RRQR!tidlelibRtidlelib.WindowListRtidlelib.TreeWidgetRRRtidlelib.configHandlerRRR9RBRmRwR:tidlelib.idle_test.htestRy(((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].