ó
|Nc           @   sX   d  d l  Z  d  d l Td  d l Z d d d „  ƒ  YZ d „  Z e d k rT e ƒ  n  d S(   iÿÿÿÿN(   t   *t   FileListc           B   si   e  Z d  d l m Z d „  Z d
 d „ Z d
 d „ Z d
 d „ Z d „  Z	 d „  Z
 d „  Z d	 „  Z RS(   iÿÿÿÿ(   t   EditorWindowc         C   s(   | |  _  i  |  _ i  |  _ i  |  _ d  S(   N(   t   roott   dictt   inversedictt   vars(   t   selfR   (    (    s%   C:\RCS\Python\lib\idlelib\FileList.pyt   __init__   s    			c         C   s·   | s t  ‚ |  j | ƒ } t j j | ƒ rQ t j d d | f d |  j ƒd  St j j	 | ƒ } | |  j
 k r |  j
 | } | j j ƒ  | S| r  | | ƒ S|  j |  | | ƒ Sd  S(   Ns
   File Errors   %r is a directory.t   master(   t   AssertionErrort   canonizet   ost   patht   isdirt   tkMessageBoxt	   showerrorR   t   Nonet   normcaseR   t   topt   wakeupR   (   R   t   filenamet   actiont   keyt   edit(    (    s%   C:\RCS\Python\lib\idlelib\FileList.pyt   open   s     

c         C   s;   |  j  | ƒ } | d  k	 r7 | d  k	 r7 | j | ƒ n  d  S(   N(   R   R   t   gotoline(   R   R   t   linenoR   (    (    s%   C:\RCS\Python\lib\idlelib\FileList.pyt   gotofileline&   s    c         C   s   |  j  |  | ƒ S(   N(   R   (   R   R   (    (    s%   C:\RCS\Python\lib\idlelib\FileList.pyt   new+   s    c         O   s:   x3 |  j  j ƒ  D]" } | j ƒ  } | d k r Pq q Wd S(   Nt   cancelt   break(   R   t   keyst   close(   R   t   argst   kwdsR   t   reply(    (    s%   C:\RCS\Python\lib\idlelib\FileList.pyt   close_all_callback.   s
    c         C   se   y |  j  | } Wn t k
 r* d GHd  SX| r> |  j | =n  |  j  | =|  j  sa |  j j ƒ  n  d  S(   Ns-   Don't know this EditorWindow object.  (close)(   R   t   KeyErrorR   R   t   quit(   R   R   R   (    (    s%   C:\RCS\Python\lib\idlelib\FileList.pyt   unregister_maybe_terminate5   s    
	c         C   s1  | j  ƒ  y |  j | } Wn t k
 r4 d GHd  SX| j j } | sk | rZ |  j | =n  d  |  j | <d  S|  j | ƒ } t j	 j
 | ƒ } | | k rœ d  S| |  j k rè |  j | } d  |  j | <t j d d | f d |  j ƒn  | |  j | <| |  j | <| r-y |  j | =Wq-t k
 r)q-Xn  d  S(   Ns.   Don't know this EditorWindow object.  (rename)s   Name Conflicts.   You now have multiple edit windows open for %rR	   (   t   saved_change_hookR   R&   t   ioR   R   R   R   R   R   R   R   R   R   (   R   R   R   R   t   newkeyt   conflict(    (    s%   C:\RCS\Python\lib\idlelib\FileList.pyt   filename_changed_editA   s<    
c         C   sa   t  j j | ƒ sQ y t  j ƒ  } Wn t  j k
 r8 qQ Xt  j j | | ƒ } n  t  j j | ƒ S(   N(   R   R   t   isabst   getcwdt   errort   joint   normpath(   R   R   t   pwd(    (    s%   C:\RCS\Python\lib\idlelib\FileList.pyR   a   s    N(   t   __name__t
   __module__t   idlelib.EditorWindowR   R   R   R   R   R   R%   R(   R-   R   (    (    (    s%   C:\RCS\Python\lib\idlelib\FileList.pyR      s   				 c          C   sž   d d l  m }  d d  l } t ƒ  } |  | ƒ | j ƒ  t | ƒ } | j d rz x/ | j d D] } | j | ƒ q` Wn
 | j ƒ  | j	 rš | j
 ƒ  n  d  S(   Niÿÿÿÿ(   t   fixwordbreaksi   (   R6   R7   t   syst   Tkt   withdrawR   t   argvR   R   R   t   mainloop(   R7   R8   R   t   flistR   (    (    s%   C:\RCS\Python\lib\idlelib\FileList.pyt   _testl   s    	


	t   __main__(    (   R   t   TkinterR   R   R>   R4   (    (    (    s%   C:\RCS\Python\lib\idlelib\FileList.pyt   <module>   s   
f	