Hacked By AnonymousFox

Current Path : /proc/thread-self/root/proc/self/root/opt/alt/python36/lib64/python3.6/idlelib/__pycache__/
Upload File :
Current File : //proc/thread-self/root/proc/self/root/opt/alt/python36/lib64/python3.6/idlelib/__pycache__/outwin.cpython-36.pyc

3

� f��@s�dZddlZddlmZddlmZddlmZdddd	d
gZda	dd�Z
d
d�ZGdd�de�ZGdd�d�Z
edkr�ddlmZedddd�dS)z0Editor window that can serve as an output file.
�N)�
messagebox)�EditorWindow)�iomenuzfile "([^"]*)", line (\d+)z([^\s]+)\((\d+)\)z^(\s*\S.*?):\s*(\d+):z([^\s]+):\s*(\d+):z^\s*(\S.*?):\s*(\d+):cCsdd�tD�adS)z?Compile the patterns for matching to file name and line number.cSsg|]}tj|tj��qS�)�re�compile�
IGNORECASE)�.0Zpatrr�3/opt/alt/python36/lib64/python3.6/idlelib/outwin.py�
<listcomp>sz!compile_progs.<locals>.<listcomp>N)�file_line_pats�file_line_progsrrrr
�
compile_progssrcCs�ts
t�x^tD]R}|j|�}|r|jdd�\}}yt|d�}|j�PWqtk
r`wYqXqWdSy|t|�fStk
r�dSXdS)a-Extract file name and line number from line of text.

    Check if line of text contains one of the file/line patterns.
    If it does and if the file and line are valid, return
    a tuple of the file name and line number.  If it doesn't match
    or if the file or line is invalid, return None.
    ���rN)	r
r�search�group�open�close�OSError�int�	TypeError)�line�prog�match�filename�lineno�frrr
�file_line_helpers"


rc@sneZdZdZd!d"d#d$d%gZdd�Zdd�Zdd�Zdd�Zfdfdd�Z	dd�Z
dd�Zdd�Zd&dd �Z
dS)'�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.

    Adds binding to open a file at a line to the text widget.
    �Cut�<<cut>>�rmenu_check_cut�Copy�<<copy>>�rmenu_check_copy�Paste�	<<paste>>�rmenu_check_pasteN�Go to file/line�<<goto-file-line>>cGs0tj|f|��|jjd|j�|jjd�dS)Nz<<goto-file-line>>z<<toggle-code-context>>)r�__init__�textZbind�goto_file_lineZunbind)�self�argsrrr
r,MszOutputWindow.__init__cCsdS)z6Python source is only part of output: do not colorize.Fr)r/rrrr
�ispythonsourceSszOutputWindow.ispythonsourcecCsdS)zCustomize EditorWindow title.ZOutputr)r/rrr
�short_titleWszOutputWindow.short_titlecCs|j�rdSdS)z;Customize EditorWindow to not display save file messagebox.�yes�no)Z	get_saved)r/rrr
�	maybesave[szOutputWindow.maybesave�insertcCsFt|t�r|jtjd�}|jj|||�|jj|�|jj�t	|�S)a�Write text to text widget.

        The text is inserted at the given index with the provided
        tags.  The text widget is then scrolled to make it visible
        and updated to display it, giving the effect of seeing each
        line as it is added.

        Args:
            s: Text to insert into text widget.
            tags: Tuple of tag strings to apply on the insert.
            mark: Index for the insert.

        Return:
            Length of text inserted.
        �replace)
�
isinstance�bytes�decoder�encodingr-r6Zsee�update�len)r/�s�tags�markrrr
�write`s

zOutputWindow.writecCsx|D]}|j|�qWdS)z"Write each item in lines iterable.N)rA)r/�linesrrrr
�
writelinesws
zOutputWindow.writelinescCsdS)z8No flushing needed as write() directly writes to widget.Nr)r/rrr
�flush|szOutputWindow.flushcOstj||�dS)N)r�	showerror)r/r0�kwargsrrr
rE�szOutputWindow.showerrorcCsd|jjdd�}t|�}|sJ|jjdd�}t|�}|sJ|jdd|jd�dS|\}}|jj||�dS)	aHandle request to open file/line.

        If the selected or previous line in the output window
        contains a file name and line number, then open that file
        name in a new window and position on the line number.

        Otherwise, display an error messagebox.
        zinsert 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.)�parentN)r-�getrrE�flistZgotofileline)r/Zeventr�resultrrrrr
r.�s	
zOutputWindow.goto_file_line)r!r"r#)r$r%r&)r'r(r))NNN)r*r+N)N)�__name__�
__module__�__qualname__�__doc__Zrmenu_specsr,r1r2r5rArCrDrEr.rrrr
r ;sr c@s6eZdZddiddid�Zdd�Zdd�Zd	d
�ZdS)�OnDemandOutputWindowZ
foregroundZbluez#007700)�stdout�stderrcCs||_d|_dS)N)rI�owin)r/rIrrr
r,�szOnDemandOutputWindow.__init__cCs"|js|j�|jj|||�dS)N)rR�setuprA)r/r>r?r@rrr
rA�szOnDemandOutputWindow.writecCsXt|j�|_}|j}x(|jj�D]\}}|r"|j|f|�q"W|jd�|jj|_dS)NZsel)	r rIrRr-�tagdefs�itemsZ
tag_configureZ	tag_raiserA)r/rRr-�tagZcnfrrr
rS�s
zOnDemandOutputWindow.setupN)rKrLrMrTr,rArSrrrr
rO�s
rO�__main__)�mainzidlelib.idle_test.test_outwinrF)�	verbosity�exit)rNrZtkinterrZidlelib.editorrZidlelibrrr
rrr rOrKZunittestrXrrrr
�<module>s"e

Hacked By AnonymousFox1.0, Coded By AnonymousFox