Your IP : 52.14.140.108


Current Path : /opt/alt/python35/lib64/python3.5/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/idlelib/__pycache__/StackViewer.cpython-35.opt-1.pyc



��YfJ�@sddlZddlZddlZddlZddlZddlmZmZm	Z	ddl
mZmZddl
mZddddd�ZGdd�de�ZGd	d
�d
e�ZGdd�de�Zd
d�ZedkrddlmZee�dS)�N)�TreeNode�TreeItem�ScrolledCanvas)�ObjectTreeItem�make_objecttreeitem)�PyShellFileListcCs~|dkrtj|�}t|dddd�}|jjdddd�t||�}t|jd|�}|j�dS)	NZbgZwhiteZhighlightthicknessr�expand�ZfillZboth)	�tkZToplevelr�frameZpack�
StackTreeItemrZcanvasr)�root�flist�tb�topZsc�itemZnode�r�8/opt/alt/python35/lib64/python3.5/idlelib/StackViewer.py�StackBrowsersrc@sReZdZdddd�Zdd�Zdd�Zdd	�Zd
d�ZdS)rNcCs.||_|j|�|_|j�|_dS)N)r�	get_stack�stack�
get_exception�text)�selfrrrrr�__init__s	zStackTreeItem.__init__cCsr|dkrtj}g}|r9|jdkr9|j}x2|dk	rm|j|j|jf�|j}q<W|S)N)�sys�last_traceback�tb_frame�tb_next�append�	tb_lineno)rrrrrrrs		
zStackTreeItem.get_stackcCsZtj}tj}t|d�r*|j}t|�}|dk	rV|dt|�}|S)N�__name__z: )r�	last_type�
last_value�hasattrr!�str)r�type�value�srrrr&s			zStackTreeItem.get_exceptioncCs|jS)N)r)rrrr�GetText0szStackTreeItem.GetTextcCs=g}x0|jD]%}t||j�}|j|�qW|S)N)r�
FrameTreeItemrr)r�sublist�inforrrr�
GetSubList3s
zStackTreeItem.GetSubList)r!�
__module__�__qualname__rrrr)r-rrrrrs

rc@s@eZdZdd�Zdd�Zdd�Zdd�Zd	S)
r*cCs||_||_dS)N)r,r)rr,rrrrr<s	zFrameTreeItem.__init__c	Cs�|j\}}y|jd}Wnd}YnX|j}|j}|j}tj||�}|j�}|dkr�d|||f}nd||||f}|S)Nr!�?�z%s, line %d: %sz%s.%s(...), line %d: %s)r0r1N)r,�	f_globals�f_code�co_filename�co_name�	linecache�getline�strip)	rr�lineno�modname�code�filename�funcnameZ
sourcelinerrrrr)@s				
zFrameTreeItem.GetTextcCsu|j\}}g}|j|jk	rLtd|j|j�}|j|�td|j|j�}|j|�|S)Nz<locals>z	<globals>)r,r2�f_locals�VariablesTreeItemrr)rrr9r+rrrrr-Rs

zFrameTreeItem.GetSubListcCsM|jrI|j\}}|jj}tjj|�rI|jj||�dS)N)rr,r3r4�os�path�isfileZgotofileline)rrr9r<rrr�
OnDoubleClick\s
	zFrameTreeItem.OnDoubleClickN)r!r.r/rr)r-rCrrrrr*:s
r*c@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)r?cCs|jS)N)Z	labeltext)rrrrr)eszVariablesTreeItem.GetTextcCsdS)Nr)rrrr�GetLabelTexthszVariablesTreeItem.GetLabelTextcCst|j�dkS)Nr)�len�object)rrrr�IsExpandablekszVariablesTreeItem.IsExpandablec
Cs�g}xx|jj�D]g}y|j|}Wntk
rDwYnX||jdd�}t|d||�}|j|�qW|S)NcSs|||<dS)Nr)r'�keyrFrrr�setfunctionusz1VariablesTreeItem.GetSubList.<locals>.setfunctionz =)rF�keys�KeyErrorrr)rr+rHr'rIrrrrr-ns
zVariablesTreeItem.GetSubListcCst|jj��S)N)�listrFrJ)rrrrrJ{szVariablesTreeItem.keysN)r!r.r/r)rDrGr-rJrrrrr?cs

r?c
Cs�tj�}|jd�ttttjd|j����\}}}}|jd||df�t	|�}yt
Wn'tk
r�tj
�\}}}	YnX|t_|t_|	t_t|d|d|d|	�t`t`t`dS)NzTest StackViewerz[x+]z+%d+%d�rrr)r
ZTk�titlerL�map�int�re�splitZgeometryrZintentional_name_error�	NameErrorr�exc_infor"r#rr)
�parentr
�widthZheight�x�yr�exc_type�	exc_valueZexc_tbrrr�
_stack_viewer~s 
3
			r[�__main__)�run)r@rr6rQZtkinterr
Zidlelib.TreeWidgetrrrZidlelib.ObjectBrowserrrZidlelib.PyShellrrrr*r?r[r!Zidlelib.idle_test.htestr]rrrr�<module>s	&)

?>