Your IP : 13.58.129.138
�
f f*�@srddlTddlmZddlZddljZddlmZGdd�de�Z Gdd�d�Z
dS) �)�*)�EditorWindowN)� IOBindingc@s�eZdZdZdd�Zdd�Zdd�Zdd �Zfd
dd�Zd
d�Z dd�Z
d&d'd(d)d*gZdddd d!gZdZ
dd"d#�Zd$d%�ZdS)+�OutputWindowz�An editor window that can serve as an output file.
Also the future base class for the Python shell window.
This class has no input facilities.
cGs*tj||�|jjd|j�dS)Nz<<goto-file-line>>)r�__init__�textZbind�goto_file_line)�self�args�r�9/opt/alt/python34/lib64/python3.4/idlelib/OutputWindow.pyrszOutputWindow.__init__cCsdS)Nrr)r �filenamerrr�ispythonsourceszOutputWindow.ispythonsourcecCsdS)NZOutputr)r rrr�short_titleszOutputWindow.short_titlecCs|j�rdSdSdS)N�yes�no)Z get_saved)r rrr� maybesaveszOutputWindow.maybesave�insertcCsjt|ttf�r-|jtjd�}n|jj|||�|jj|�|jj�t |�S)N�replace)
�
isinstance�bytes�decoder�encodingrrZsee�update�len)r �s�tags�markrrr�write%s
zOutputWindow.writecCs"x|D]}|j|�qWdS)N)r)r �lines�linerrr�
writelines-s
zOutputWindow.writelinescCsdS)Nr)r rrr�flush1szOutputWindow.flush�Cut�<<cut>>�rmenu_check_cut�Copy�<<copy>>�rmenu_check_copy�Paste� <<paste>>�rmenu_check_pasteN�Go to file/line�<<goto-file-line>>zfile "([^"]*)", line (\d+)z([^\s]+)\((\d+)\)z^(\s*\S.*?):\s*(\d+):z([^\s]+):\s*(\d+):z^\s*(\S.*?):\s*(\d+):c Cs�|jdkrQg}x-|jD]"}|jtj|tj��qW||_n|jjdd�}|j|�}|s�|jjdd�}|j|�}|s�t j
ddd|j�dSn|\}}|jj|�}|j
|�dS)Nzinsert linestartzinsert lineendzinsert -1line linestartzinsert -1line lineendzNo special linezTThe line you point at doesn't look like a valid file name followed by a line number.�parent)�file_line_progs�file_line_pats�append�re�compile�
IGNORECASEr�get�_file_line_helper�tkMessageBoxZ showerror�flist�openZgotoline) r Zevent�lZpatr �resultr
�linenoZeditrrrrIs(
zOutputWindow.goto_file_linecCs�x{|jD]l}|j|�}|r
|jdd�\}}yt|d�}|j�PWqvtk
rrw
YqvXq
q
WdSy|t|�fSWntk
r�dSYnXdS)N���r)r/�search�groupr9�close�OSError�int� TypeError)r r �prog�matchr
r<�frrrr6ds
zOutputWindow._file_line_helper)r#r$r%)r&r'r()r)r*r+)NNN)r,r-N)�__name__�
__module__�__qualname__�__doc__rrrrrr!r"Zrmenu_specsr0r/rr6rrrrrs* rc@sVeZdZiidd6d6idd6d6Zdd�Zdd �Zd
d�ZdS)
�OnDemandOutputWindowZblueZ
foreground�stdoutz#007700�stderrcCs||_d|_dS)N)r8�owin)r r8rrrr�s zOnDemandOutputWindow.__init__cCs0|js|j�n|jj|||�dS)N)rP�setupr)r rrrrrrr�s
zOnDemandOutputWindow.writecCsxt|j�|_}|j}x6|jj�D]%\}}|r/|j||�q/q/W|jd�|jj|_dS)NZsel) rr8rPr�tagdefs�itemsZ
tag_configureZ tag_raiser)r rPr�tagZcnfrrrrQ�s
zOnDemandOutputWindow.setupN)rIrJrKrRrrrQrrrrrMxsrM)ZtkinterZidlelib.EditorWindowrr2Ztkinter.messageboxZ
messageboxr7ZidlelibrrrMrrrr�<module>s
q
?>