§
    ”Õ*jS  ã                   ó°   — d Z ddlZddlmZ ddlmZ g d¢Zdad„ Zd„ Z	 G d„ d	e¦  «        Z
 G d
„ d¦  «        Zedk    rddlmZ  eddd¬¦  «         dS dS )z0Editor window that can serve as an output file.
é    N)Ú
messagebox)ÚEditorWindow)zfile "([^"]*)", line (\d+)z([^\s]+)\((\d+)\)z^(\s*\S.*?):\s*(\d+):z([^\s]+):\s*(\d+):z^\s*(\S.*?):\s*(\d+):c                  ó(   — d„ t           D ¦   «         adS )z?Compile the patterns for matching to file name and line number.c                 óL   — g | ]!}t          j        |t           j        ¦  «        ‘Œ"S © )ÚreÚcompileÚ
IGNORECASE)Ú.0Úpats     ú lib/python3.11/idlelib/outwin.pyú
<listcomp>z!compile_progs.<locals>.<listcomp>   s6   € ð 2ð 2ð 2Øõ ”z #¥r¤}Ñ5Ô5ð 2ð 2ð 2ó    N)Úfile_line_patsÚfile_line_progsr   r   r   Úcompile_progsr      s$   € ð2ð 2Ý"0ð2ñ 2ô 2€O€O€Or   c                 óV  — t           st          ¦   «          t           D ]h}|                     | ¦  «        }|rO|                     dd¦  «        \  }}	 t	          |¦  «        }|                     ¦   «           n# t          $ r Y Œdw xY wŒidS 	 |t          |¦  «        fS # t          $ r Y dS w xY w)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.
    é   é   N)	r   r   ÚsearchÚgroupÚopenÚcloseÚOSErrorÚintÚ	TypeError)ÚlineÚprogÚmatchÚfilenameÚlinenoÚfs         r   Úfile_line_helperr#      sÛ   € õ ð Ý‰ŒˆÝð ð ˆØ—’˜DÑ!Ô!ˆØð 	Ø$Ÿ{š{¨1¨aÑ0Ô0ÑˆH�fðÝ˜‘N”N�Ø—’‘	”	�	Ø�øÝð ð ð Ø�ðøøøð	ð ˆtðØ�˜V™œÐ$Ð$øÝð ð ð Øˆtˆtðøøøs$   Á#A5Á5
BÂBÂ	B Â
B(Â'B(c                   óX   — e Zd ZdZg d¢ZdZd„ Zd„ Zd„ Zd„ Z	dd
„Z
d„ Zd„ Zd„ Zdd„ZdS )Ú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.
    ))ÚCutz<<cut>>Úrmenu_check_cut)ÚCopyz<<copy>>Úrmenu_check_copy)ÚPastez	<<paste>>Úrmenu_check_paste)NNN)zGo to file/lineú<<goto-file-line>>NFc                 ój   — t          j        | g|¢R Ž  | j                             d| j        ¦  «         d S )Nr,   )r   Ú__init__ÚtextÚbindÚgoto_file_line)ÚselfÚargss     r   r.   zOutputWindow.__init__N   s;   € ÝÔ˜dÐ* TÐ*Ð*Ð*Ð*ØŒ	�ŠÐ+¨TÔ-@ÑAÔAÐAÐAÐAr   c                 ó   — dS )z6Python source is only part of output: do not colorize.Fr   )r2   r    s     r   ÚispythonsourcezOutputWindow.ispythonsourceS   s   € àˆur   c                 ó   — dS )zCustomize EditorWindow title.ÚOutputr   ©r2   s    r   Úshort_titlezOutputWindow.short_titleW   s   € àˆxr   c                 ó2   — |                       ¦   «         rdndS )z;Customize EditorWindow to not display save file messagebox.ÚyesÚno)Ú	get_savedr8   s    r   Ú	maybesavezOutputWindow.maybesave[   s   € àŸšÑ(Ô(Ð2ˆuˆu¨dÐ2r   r   Úinsertc                 óì   — t          |t          ¦  «        sJ ‚| j                             |||¦  «         | j                             |¦  «         | j                             ¦   «          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.
        )Ú
isinstanceÚstrr/   r?   ÚseeÚupdate_idletasksÚlen©r2   ÚsÚtagsÚmarks       r   ÚwritezOutputWindow.write`   sg   € õ  ˜!�SÑ!Ô!Ð!Ð!Ð!ØŒ	×Ò˜˜q $Ñ'Ô'Ð'ØŒ	�Š�dÑÔÐØŒ	×"Ò"Ñ$Ô$Ð$Ý�1‰vŒvˆr   c                 ó:   — |D ]}|                       |¦  «         ŒdS )z"Write each item in lines iterable.N)rJ   )r2   Úlinesr   s      r   Ú
writelineszOutputWindow.writelinesv   s0   € àð 	ð 	ˆDØ�JŠJ�tÑÔÐÐð	ð 	r   c                 ó   — dS )z8No flushing needed as write() directly writes to widget.Nr   r8   s    r   ÚflushzOutputWindow.flush{   s   € àˆr   c                 ó(   — t          j        |i |¤Ž d S ©N)r   Ú	showerror)r2   r3   Úkwargss      r   rR   zOutputWindow.showerror   s   € ÝÔ˜dÐ- fÐ-Ð-Ð-Ð-Ð-r   Nc                 ó4  — | j                              dd¦  «        }t          |¦  «        }|sK| j                              dd¦  «        }t          |¦  «        }|s|                      dd| j         ¬¦  «         dS |\  }}| j                             ||¦  «         dS )	a  Handle 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.
        zinsert linestartzinsert lineendzinsert -1line linestartzinsert -1line lineendzNo special linezTThe line you point at doesn't look like a valid file name followed by a line number.)ÚparentN)r/   Úgetr#   rR   ÚflistÚgotofileline)r2   Úeventr   Úresultr    r!   s         r   r1   zOutputWindow.goto_file_line‚   sº   € ð Œy�}Š}Ð/Ð1AÑBÔBˆÝ! $Ñ'Ô'ˆØð 	ð ”9—=’=Ð!:Ø!8ñ:ô :ˆDå% dÑ+Ô+ˆFØð Ø—’Ø%ðCàœ9ð	 ñ &ô &ð &ð
 �Ø!Ñˆ�&ØŒ
×Ò ¨&Ñ1Ô1Ð1Ð1Ð1r   )r   r?   rQ   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úrmenu_specsÚallow_code_contextr.   r5   r9   r>   rJ   rM   rO   rR   r1   r   r   r   r%   r%   :   sË   € € € € € ðð ðð ð €Kð ÐðBð Bð Bð
ð ð ðð ð ð3ð 3ð 3ð
ð ð ð ð,ð ð ð
ð ð ð.ð .ð .ð2ð 2ð 2ð 2ð 2ð 2r   r%   c                   ó2   — e Zd ZddiddidœZd„ Zd„ Zd„ ZdS )	ÚOnDemandOutputWindowÚ
foregroundÚbluez#007700)ÚstdoutÚstderrc                 ó"   — || _         d | _        d S rQ   )rW   Úowin)r2   rW   s     r   r.   zOnDemandOutputWindow.__init__§   s   € ØˆŒ
ØˆŒ	ˆ	ˆ	r   c                 ót   — | j         s|                      ¦   «          | j                              |||¦  «         d S rQ   )rh   ÚsetuprJ   rF   s       r   rJ   zOnDemandOutputWindow.write«   s7   € ØŒyð 	Ø�JŠJ‰LŒLˆLØŒ	�Š˜˜4 Ñ&Ô&Ð&Ð&Ð&r   c                 óô   — t          | j        ¦  «        x| _        }|j        }| j                             ¦   «         D ]\  }}|r |j        |fi |¤Ž Œ|                     d¦  «         | j        j        | _        d S )NÚsel)	r%   rW   rh   r/   ÚtagdefsÚitemsÚtag_configureÚ	tag_raiserJ   )r2   rh   r/   ÚtagÚcnfs        r   rj   zOnDemandOutputWindow.setup°   s…   € Ý'¨¬
Ñ3Ô3Ð3ˆŒ	�DØŒyˆØœ×*Ò*Ñ,Ô,ð 	/ð 	/‰HˆC�Øð /Ø"�Ô" 3Ð.Ð.¨#Ð.Ð.Ð.øØ�Š�uÑÔÐØ”Y”_ˆŒ
ˆ
ˆ
r   N)r[   r\   r]   rm   r.   rJ   rj   r   r   r   rb   rb   Ÿ   s_   € € € € € ð ! &Ð)Ø  )Ð,ðð €Gðð ð ð'ð 'ð 'ð
%ð %ð %ð %ð %r   rb   Ú__main__)Úmainzidlelib.idle_test.test_outwinr   F)Ú	verbosityÚexit)r^   r   Útkinterr   Úidlelib.editorr   r   r   r   r#   r%   rb   r[   Úunittestrt   r   r   r   ú<module>rz      s  ððð ð 
€	€	€	à Ð Ð Ð Ð Ð à 'Ð 'Ð 'Ð 'Ð 'Ð 'ðð ð €ð €ð2ð 2ð 2ðð ð ð8a2ð a2ð a2ð a2ð a2�<ñ a2ô a2ð a2ðJ%ð %ð %ð %ð %ñ %ô %ð %ð6 ˆzÒÐØÐÐÐÐÐØ€DÐ	(°A¸EÐBÑBÔBÐBÐBÐBð Ðr   