ó
|Nc           @   so   d  d l  Td  d l m Z d  d l Z d  d l Z d  d l m Z d e f d     YZ d d	 d     YZ d S(
   iÿÿÿÿ(   t   *(   t   EditorWindowN(   t	   IOBindingt   OutputWindowc           B   s   e  Z d  Z d   Z d   Z d   Z d   Z d d d  Z d   Z d   Z	 d g Z
 d d d d d g Z d Z d d  Z d   Z RS(   s   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.
    c         G   s*   t  j |  |  |  j j d |  j  d  S(   Ns   <<goto-file-line>>(   R   t   __init__t   textt   bindt   goto_file_line(   t   selft   args(    (    s)   C:\RCS\Python\lib\idlelib\OutputWindow.pyR      s    c         C   s   d S(   Ni    (    (   R   t   filename(    (    s)   C:\RCS\Python\lib\idlelib\OutputWindow.pyt   ispythonsource   s    c         C   s   d S(   Nt   Output(    (   R   (    (    s)   C:\RCS\Python\lib\idlelib\OutputWindow.pyt   short_title   s    c         C   s   |  j    r d Sd Sd  S(   Nt   yest   no(   t	   get_saved(   R   (    (    s)   C:\RCS\Python\lib\idlelib\OutputWindow.pyt	   maybesave   s    t   insertc         C   ss   t  | t  r< y t | t j  } Wq< t k
 r8 q< Xn  |  j j | | |  |  j j |  |  j j	   d  S(   N(
   t
   isinstancet   strt   unicodeR   t   encodingt   UnicodeErrorR   R   t   seet   update(   R   t   st   tagst   mark(    (    s)   C:\RCS\Python\lib\idlelib\OutputWindow.pyt   write%   s    c         C   s"   x | D] } |  j  |  q Wd  S(   N(   R   (   R   t   linest   line(    (    s)   C:\RCS\Python\lib\idlelib\OutputWindow.pyt
   writelines2   s    c         C   s   d  S(   N(    (   R   (    (    s)   C:\RCS\Python\lib\idlelib\OutputWindow.pyt   flush6   s    s   Go to file/lines   <<goto-file-line>>s   file "([^"]*)", line (\d+)s   ([^\s]+)\((\d+)\)s   ^(\s*\S.*?):\s*(\d+):s   ([^\s]+):\s*(\d+):s   ^\s*(\S.*?):\s*(\d+):c   	      C   sô   |  j  d  k rQ g  } x- |  j D]" } | j t j | t j   q W| |  _  n  |  j j d d  } |  j	 |  } | sÅ |  j j d d  } |  j	 |  } | sÅ t
 j d d d |  j d  Sn  | \ } } |  j j |  } | j |  d  S(   Ns   insert linestarts   insert lineends   insert -1line linestarts   insert -1line lineends   No special linesT   The line you point at doesn't look like a valid file name followed by a line number.t   master(   t   file_line_progst   Nonet   file_line_patst   appendt   ret   compilet
   IGNORECASER   t   gett   _file_line_helpert   tkMessageBoxt	   showerrort   flistt   opent   gotoline(	   R   t   eventt   lt   patR   t   resultR
   t   linenot   edit(    (    s)   C:\RCS\Python\lib\idlelib\OutputWindow.pyR   J   s(     	
c         C   sª   xz |  j  D]k } | j |  } | r
 | j d d  \ } } y t | d  } | j   PWqu t k
 rq q
 qu Xq
 q
 Wd  Sy | t |  f SWn t k
 r¥ d  SXd  S(   Ni   i   t   r(	   R#   t   searcht   groupR/   t   closet   IOErrorR$   t   intt	   TypeError(   R   R   t   progt   matchR
   R5   t   f(    (    s)   C:\RCS\Python\lib\idlelib\OutputWindow.pyR+   e   s    
(    (   s   Go to file/lines   <<goto-file-line>>N(   t   __name__t
   __module__t   __doc__R   R   R   R   R   R    R!   t   rmenu_specsR%   R$   R#   R   R+   (    (    (    s)   C:\RCS\Python\lib\idlelib\OutputWindow.pyR      s"   									t   OnDemandOutputWindowc           B   sE   e  Z i i d  d 6d 6i d d 6d 6Z d   Z d   Z d   Z RS(   t   bluet
   foregroundt   stdouts   #007700t   stderrc         C   s   | |  _  d  |  _ d  S(   N(   R.   R$   t   owin(   R   R.   (    (    s)   C:\RCS\Python\lib\idlelib\OutputWindow.pyR      s    	c         C   s0   |  j  s |  j   n  |  j  j | | |  d  S(   N(   RJ   t   setupR   (   R   R   R   R   (    (    s)   C:\RCS\Python\lib\idlelib\OutputWindow.pyR      s    	c         C   sx   t  |  j  |  _ } | j } x6 |  j j   D]% \ } } | r/ | j | |  q/ q/ W| j d  |  j j |  _ d  S(   Nt   sel(	   R   R.   RJ   R   t   tagdefst   itemst   tag_configuret	   tag_raiseR   (   R   RJ   R   t   tagt   cnf(    (    s)   C:\RCS\Python\lib\idlelib\OutputWindow.pyRK      s    	(   RA   RB   RM   R   R   RK   (    (    (    s)   C:\RCS\Python\lib\idlelib\OutputWindow.pyRE   y   s   		(    (	   t   Tkintert   idlelib.EditorWindowR   R'   R,   t   idlelibR   R   RE   (    (    (    s)   C:\RCS\Python\lib\idlelib\OutputWindow.pyt   <module>   s   
r