
    ;eR                         	 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 )    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 )Nc                 L    g | ]!}t          j        |t           j                  "S  )recompile
IGNORECASE).0pats     %/usr/lib/python3.11/idlelib/outwin.py
<listcomp>z!compile_progs.<locals>.<listcomp>   s6     2 2 2 z#r}55 2 2 2    )file_line_patsfile_line_progsr   r   r   compile_progsr      s'    E2 2"02 2 2OOOr   c                 X   	 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)N      )	r   r   searchgroupopencloseOSErrorint	TypeError)lineprogmatchfilenamelinenofs         r   file_line_helperr#      s        D!! 	${{1a00HfNN			   	 tV$$   tts$   #A66
BB
B 
B)(B)c                   V    e 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 )OutputWindow))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 )NFr   )r2   r    s     r   ispythonsourcezOutputWindow.ispythonsourceS   s
    @ur   c                     	 dS )NOutputr   r2   s    r   short_titlezOutputWindow.short_titleW   s
    'xr   c                 4    	 |                                  rdndS )Nyesno)	get_savedr8   s    r   	maybesavezOutputWindow.maybesave[   s    E((2uud2r   r   insertc                     	 | j                             |||           | j                             |           | j                                          t	          |          S N)r/   r?   seeupdate_idletaskslenr2   stagsmarks       r   writezOutputWindow.write`   sV    	  		q$'''	d	""$$$1vvr   c                 <    	 |D ]}|                      |           d S rA   )rI   )r2   linesr   s      r   
writelineszOutputWindow.writelinesv   s3    , 	 	DJJt	 	r   c                     	 d S rA   r   r8   s    r   flushzOutputWindow.flush{   s
    Br   c                 (    t          j        |i | d S rA   )r   	showerror)r2   r3   kwargss      r   rP   zOutputWindow.showerror   s    d-f-----r   Nc                 6   	 | j                             dd          }t          |          }|sK| j                             dd          }t          |          }|s|                     dd| j                    d S |\  }}| j                            ||           d S )Nz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.)parent)r/   getr#   rP   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?   rA   )__name__
__module____qualname__rmenu_specsallow_code_contextr.   r5   r9   r>   rI   rL   rN   rP   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 rA   )rU   owin)r2   rU   s     r   r.   zOnDemandOutputWindow.__init__   s    
			r   c                 t    | j         s|                                  | j                             |||           d S rA   )re   setuprI   rE   s       r   rI   zOnDemandOutputWindow.write   s7    y 	JJLLL	4&&&&&r   c                     t          | j                  x| _        }|j        }| j                                        D ]\  }}|r |j        |fi | |                    d           | j        j        | _        d S )Nsel)	r%   rU   re   r/   tagdefsitemstag_configure	tag_raiserI   )r2   re   r/   tagcnfs        r   rg   zOnDemandOutputWindow.setup   s    '
333	Dy**,, 	/ 	/HC /""3..#...uY_


r   N)rY   rZ   r[   rj   r.   rI   rg   r   r   r   r_   r_      s_         !&) ), G  ' ' '
% % % % %r   r_   __main__)mainzidlelib.idle_test.test_outwinr   F)	verbosityexit)r   tkinterr   idlelib.editorr   r   r   r   r#   r%   r_   rY   unittestrq   r   r   r   <module>rw      s   
			       ' ' ' ' ' '   2 2 2  8a2 a2 a2 a2 a2< a2 a2 a2J% % % % % % % %4 zD	(AEBBBBBB r   