Your IP : 18.219.239.111


Current Path : /opt/alt/python34/lib64/python3.4/idlelib/__pycache__/
Upload File :
Current File : //opt/alt/python34/lib64/python3.4/idlelib/__pycache__/Debugger.cpython-34.pyc

�
e fGI�@s�ddlZddlZddlTddlmZddlmZddlmZGdd�dej	�Z
Gdd	�d	�ZGd
d�de�ZGdd
�d
�Z
dS)�N)�*)�ListedToplevel)�ScrolledList)�
macosxSupportc@sLeZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�IdbcCs||_tjj|�dS)N)�gui�bdb�Bdb�__init__)�selfr�r�5/opt/alt/python34/lib64/python3.4/idlelib/Debugger.pyr
s	zIdb.__init__cCs\|j|�r|j�dS|j|�}y|jj||�Wntk
rWYnXdS)N)�in_rpc_code�set_step�_Idb__frame2messager�interactionZTclError)r�frame�messagerrr
�	user_lines

z
Idb.user_linecCsF|j|�r|j�dS|j|�}|jj|||�dS)N)rrrrr)rr�inforrrr
�user_exceptions

zIdb.user_exceptioncCsL|jjjd�rdS|j}|jjjd�r;dS|j|�SdS)Nzrpc.pyTzDebugger.pyF)�f_code�co_filename�count�f_backr)rrZ
prev_framerrr
r s	zIdb.in_rpc_codecCsf|j}|j}|j}tjj|�}d||f}|jdkrbd||jf}n|S)Nz%s:%s�?z%s: %s())rr�f_lineno�os�path�basename�co_name)rr�code�filename�linenorrrrr
Z__frame2message*s			zIdb.__frame2messageN)�__name__�
__module__�__qualname__r
rrrrrrrr
r	s


rc@sTeZdZdZZZZddd�Zdd�Zddd�Z	dd	�Z
dd
d�Zdd
�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zdd�ZdZdd�Zdd�Zd d!�ZdZdZd"d#�Zd$d%�Zd&d'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Z dS)1�DebuggerNcCsV|dkrt|�}n||_||_d|_|j�d|_d|_dS)Nr)r�pyshell�idbr�make_gui�interacting�
nesting_level)rr(r)rrr
r
9s			
	zDebugger.__init__csm�jdkr?�j��jjd��fdd��dSzd�_�jj��SWdd�_XdS)Nr�dcs
�j��S)N)�runr)�argsrrr
�<lambda>cszDebugger.run.<locals>.<lambda>�)r,�
abort_loop�root�afterr+r)r.)rr/r)r/rr
r.Cs
"	zDebugger.runcCs}y|j�Wntk
r"YnX|jr=|jj�dS|jr_|jj�d|_n|jj�|jj	�dS)N)
�quit�	Exceptionr+�topZbell�stackviewer�closer(Zclose_debugger�destroy)r�eventrrr
r9ks
	
	

zDebugger.closecCs�|j}|j|_|j|_}t|�|_}|jjd�|jjd�|jd|j�|jj	d|j�t
|�|_}|jjdd�g|_
}t|ddd	|j�|_}|j|�t|dd
d	|j�|_}|j|�t|ddd	|j�|_}|j|�t|ddd	|j�|_}|j|�t|dd
d	|j�|_}|j|�x.|D]&}|jdd�|jdd�q�Wt
|�|_}|jjdd�|js$t|�|j_|jjd�nt|ddd	|j d|j�|_!|j!j"dddd�|j#s�t|�|j_#nt|ddd	|j$d|j#�|_%|j%j"dddd�|j&s�t|�|j_&|j&jd�nt|ddd	|j'd|j&�|_(|j(j"dddd�|j)sNt|�|j_)nt|ddd	|j*d|j)�|_+|j+j"dddd�t,|dd�|_-|j-jdd�t,|dd�|_.|j.jdddd�|j.j/d�|_0t
|dd�|_1|j1jdddd �t
|�|_2|j2jdddd �t
|dd�|_3|j3jdddd �|jj4�r�|j �n|j&j4�r�|j'�n|j)j4�r�|j*�ndS)!Nz
Debug ControlZDebugZWM_DELETE_WINDOWz<Escape>�anchor�w�textZGo�commandZStepZOverZOutZQuit�state�disabled�side�leftr1ZStackZvariable�rowr�columnZSource�Locals�Globals�fill�x�
background�height�expand�both)5r(�flistr3rr7Zwm_titleZwm_iconnameZwm_protocolr9Zbind�Frame�bframe�pack�buttonsZButton�contZbcont�append�stepZbstep�nextZbnext�retZbretr5�	configure�cframe�vstackZ
BooleanVar�	__class__�setZCheckbutton�
show_stackZbstack�grid�vsource�show_sourceZbsource�vlocals�show_localsZblocals�vglobals�show_globalsZbglobals�Label�status�errorZcget�errorbg�fstack�flocals�fglobals�get)rr(r3r7rPZbl�brYrrr
r*|s�	
"
"
"
"
"

								

zDebugger.make_guic
Cs�||_|jjd|�|r�|\}}}y
|j}Wn"tk
rbdt|�}YnX|dk	r�yd|t|�f}Wq�Yq�Xnd}nd}d}|j}|jjd|d|�|j}	|	r|j	j
|j|�\}
}|	j|
|�n|jd�|j
j�r7|j�nx!|jD]}|jdd	�qAW|jj�|jd7_|jjjd
d�|jd8_x!|jD]}|jdd�q�W|jjdd�|jjddd|j�d|_dS)
Nr>z%sz%s: %sZyellow�rJr1r@ZnormalZvwaitz::idledebugwaitrA)rrfrXr$�AttributeError�strrhrgr8r)�	get_stack�
load_stack�show_variablesr_rl�sync_source_linerRr7�wakeupr,r3�tk�call)
rrrr�type�value�tbZm1Zbg�sv�stack�irmrrr
r�sH	

			


zDebugger.interactioncCsx|j}|sdS|j|�\}}|dd�|dd�dkrttjj|�rt|jj||�ndS)Nr1z<>���)r�_Debugger__frame2filelinerr�existsrNZgotofileline)rrr"r#rrr
rt�s	6zDebugger.sync_source_linecCs%|j}|j}|j}||fS)N)rrr)rrr!r"r#rrr
Z__frame2filelines			zDebugger.__frame2filelinecCs|jj�|j�dS)N)r)Zset_continuer2)rrrr
rSs
z
Debugger.contcCs|jj�|j�dS)N)r)rr2)rrrr
rU
s
z
Debugger.stepcCs!|jj|j�|j�dS)N)r)Zset_nextrr2)rrrr
rVsz
Debugger.nextcCs!|jj|j�|j�dS)N)r)Z
set_returnrr2)rrrr
rWszDebugger.retcCs|jj�|j�dS)N)r)Zset_quitr2)rrrr
r5s
z
Debugger.quitcCs|jjjddd�dS)Nr\z::idledebugwait�1)r3rvrw)rrrr
r2szDebugger.abort_loopcCs�|jru|jj�rut|j|j|�|_}|jr�|jj|jd�\}}|j	||�q�nB|j}|r�|jj�r�d|_|j
�nd|jd<dS)Nr1rK)r8rZrl�StackViewerrirNrr)rqrrr9)rr{r|r}rrr
r]s			
zDebugger.show_stackcCs |jj�r|j�ndS)N)r_rlrt)rrrr
r`,szDebugger.show_sourcecCs|d|_|j�dS)Nr)rrs)rZ	stackitemrrr
�
show_frame0s
zDebugger.show_framecCsp|j}|jj�r9|sbt|jd�|_qbn)|rbd|_|j�d|jd<n|j�dS)NrFr1rK)�localsviewerrarl�NamespaceViewerrjr9rs)r�lvrrr
rb7s		
zDebugger.show_localscCsp|j}|jj�r9|sbt|jd�|_qbn)|rbd|_|j�d|jd<n|j�dS)NrGr1rK)�
globalsviewerrcrlr�rkr9rs)r�gvrrr
rdCs		
zDebugger.show_globalsrcCs�|j}|j}|j}|s.d}}n3|j}|j}|ra|ra||krad}n|r�|j|||jjj�n|r�|j|||jjj�ndS)N)	r�r�r�f_locals�	f_globals�	load_dictr(ZinterpZrpcclt)r�forcer�r�rZldictZgdictrrr
rsOs			
			zDebugger.show_variablescCs|jj||�dS)N)r)Z	set_break)rr"r#rrr
�set_breakpoint_here_szDebugger.set_breakpoint_herecCs|jj||�dS)N)r)Zclear_break)rr"r#rrr
�clear_breakpoint_herebszDebugger.clear_breakpoint_herecCs|jj|�dS)N)r)Zclear_all_file_breaks)rr"rrr
�clear_file_breakseszDebugger.clear_file_breakscCsjxc|jjjD]R}|jj}y(x!|jD]}|j||�q/WWqtk
rawYqXqWdS)z=Load PyShellEditorWindow breakpoints into subprocess debuggerN)r(rNZinversedict�ior"Zbreakpointsr�ro)rZeditwinr"r#rrr
�load_breakpointshs
zDebugger.load_breakpoints)!r$r%r&rZr_rarcr
r.r9r*rrtrrSrUrVrWr5r2r8r]r`r�r�r�rbrdrsr�r�r�r�rrrr
r'5s6
(K1
r'c@seZdZdd�Zddd�Zdd�Zdd	�Zd
d�Zdd
�Zdd�Z	dd�Z
dd�ZdS)r�cCsTtj�rtj||�ntj||dd�||_||_g|_dS)N�width�P)rZisAquaTkrr
rNrr|)r�masterrNrrrr
r
ts		zStackViewer.__init__Nc
Cs%||_|j�x�tt|��D]�}||\}}y|jd}Wnd}YnX|j}|j}|j}	ddl}
|
j	||�}|j
�}|	dkr�d|||f}nd||	||f}||kr�d|}n|j|�q&W|dk	r!|j|�ndS)	Nr$rrrnz%s, line %d: %sz%s.%s(), line %d: %sz> )rrnN)
r|�clear�range�lenr�rrr �	linecache�getline�striprTZselect)
rr|�indexr}rr#�modnamer!r"Zfuncnamer�Z
sourceline�itemrrr
rr�s.	
				

zStackViewer.load_stackcCs|jrtj||�SdS)zoverride base methodN)r|r�popup_event)rr;rrr
r��s	zStackViewer.popup_eventcCs?|j}|jddd|j�|jddd|j�dS)zoverride base method�labelzGo to source liner?zShow stack frameN)�menuZadd_command�goto_source_line�show_stack_frame)rr�rrr
�	fill_menu�s
	
zStackViewer.fill_menucCsCd|ko t|j�knr?|jj|j|�ndS)zoverride base methodrN)r�r|rr�)rr�rrr
�	on_select�s%zStackViewer.on_selectcCs|j|�dS)zoverride base methodN)r`)rr�rrr
�	on_double�szStackViewer.on_doublecCs#|jjd�}|j|�dS)N�active)�listboxr�r`)rr�rrr
r��szStackViewer.goto_source_linecCsU|jjd�}d|ko2t|j�knrQ|jj|j|�ndS)Nr�r)r�r�r�r|rr�)rr�rrr
r��s%zStackViewer.show_stack_framecCs�d|ko t|j�kns)dS|j|\}}|j}|j}tjj|�r�|jj|�}|r�|j	|�q�ndS)Nr)
r�r|rrrr�isfilerN�openZgotoline)rr�rr#r!r"Zeditrrr
r`�s%		zStackViewer.show_source)r$r%r&r
rrr�r�r�r�r�r�r`rrrr
r�rsr�c@sCeZdZddd�Zd
Zdddd�Zdd	�ZdS)r�Nc	Cs�d}d}|r%dt|�}n||_||_ddl}|j�|_d|j_d|j_t|�|_	}|j	j
dddd�t|d	|d
ddd
�|_|jj
dd�t
|dd�|_}|j
dddd�t|dtdtd|��ddd||f�|_}	|	j
dddddd�|	j|d<|j|	d<t|	�|_}
|	jddd|
dd�|_|j|�dS)Nr�(��<rLr1rHrMr>�borderwidth�ZreliefZgrooverI�name�vbarrB�right�yrKi,�scrollregionrCr?ZyscrollcommandZwindowr<�nw)r�r��title�reprlib�Repr�repr�	maxstring�maxotherrOrrQrer�Z	Scrollbarr�ZCanvas�min�max�canvasZyviewr\�subframeZ
create_windowZsfidr�)rr�r��dictr�rKr�rr�r�r�rrr
r
�s2		!	

!zNamespaceViewer.__init__r1rcCs||jkr|rdS|j}|j}x't|jj��D]}|j�qBWd|_|s�t|dd�}|jdddd�n�|j	�}t
|�}	d}
x�|	D]�}||}|jj|�}
|r�|
dd�}
nt|d|�}|jd|
dddd�t|d	dd
d�}|j
d|
�|jd|
dddd�|
d}
q�W||_|j�|j�}|j�}|j}dd||f|jd<|dkr�d|d
<|jdd�n||d
<|jdd�dS)Nr>�NonerDrrEr1Zstickyr�r�r�r�i,rKrLr~)r�r�r�listZchildren�valuesr:rer^�keys�sortedr�ZEntry�insertZupdate_idletasksZwinfo_reqwidthZwinfo_reqheightr�rQ)rr�r�Z
rpc_clientr�r�c�lZ	keys_list�namesrDr�ryZsvaluer�rKr�rrr
r��sF			


	
	

zNamespaceViewer.load_dictcCs|jj�dS)N)rr:)rrrr
r9szNamespaceViewer.closer~)r$r%r&r
r�r�r9rrrr
r��s6r�)rrZtkinterZidlelib.WindowListrZidlelib.ScrolledListrZidlelibrr	rr'r�r�rrrr
�<module>s
,�>S

?>