Current File : //usr/local/apps/python3/lib/python3.11/idlelib/__pycache__/outwin.cpython-311.opt-1.pyc |
�
�KeM � � � d Z ddlZddlmZ ddlmZ g d�Zdad� Zd� Z G d� d e� � Z
G d
� d� � Zedk rdd
l
mZ eddd�� � dS dS )z0Editor window that can serve as an output file.
� N)�
messagebox)�EditorWindow)zfile "([^"]*)", line (\d+)z([^\s]+)\((\d+)\)z^(\s*\S.*?):\s*(\d+):z([^\s]+):\s*(\d+):z^\s*(\S.*?):\s*(\d+):c �( � d� t D � � adS )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 �8/usr/local/apps/python3/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 �X � t st � � t D ]i}|� | � � }|rP|� dd� � \ }} t |d� � }|� � � n# t $ r Y �ew xY w�jdS |t |� � fS # t $ r Y dS w xY 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.
� � �rN) 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�
���3�'�'����� � � �����
�
�
���
����
� �t����V���$�$��� � � ��t�t����s$ �$A6�6
B�B�
B �
B)�(B)c �X � e Zd ZdZg d�ZdZd� Zd� Zd� Zd� Z dd
�Z
d� Zd� Zd
� Z
dd�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.
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)zGo 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/ zOutputWindow.__init__N s; � ���d�*�T�*�*�*�*�� ���+�T�-@�A�A�A�A�Ar c � � dS )z6Python source is only part of output: do not colorize.Fr )r3 r! s r
�ispythonsourcezOutputWindow.ispythonsourceS s � ��ur c � � dS )zCustomize EditorWindow title.�Outputr �r3 s r
�short_titlezOutputWindow.short_titleW s � ��xr c �2 � | � � � rdndS )z;Customize EditorWindow to not display save file messagebox.�yes�no)� get_savedr9 s r
� maybesavezOutputWindow.maybesave[ s � ����(�(�2�u�u�d�2r r �insertc � � | 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.
)r0 r@ �see�update�len�r3 �s�tags�marks r
�writezOutputWindow.write` sQ � �"