ó
Š]c           @   sŸ   d  Z  d d l Td d l Z d e f d „  ƒ  YZ e d „ Z d e d „ Z e	 d k r› d d l
 Z
 e
 j d	 d
 d d e ƒd d l m Z e e ƒ n  d S(   s   Simple text browser for IDLE

iÿÿÿÿ(   t   *Nt
   TextViewerc           B   s2   e  Z d  Z e e d „ Z d „  Z d d „ Z RS(   s*   A simple text viewer dialog for IDLE

    c         C   s5  t  j |  | ƒ |  j d d ƒ |  j d d d | j ƒ  d | j ƒ  | sQ d n d f ƒ d |  _ d	 |  _ |  j ƒ  |  j	 | ƒ |  j
 d
 |  j ƒ | |  _ |  j j ƒ  |  j d |  j ƒ |  j d |  j ƒ |  j j d | ƒ |  j j d t ƒ | |  _ |  j r1|  j | ƒ |  j ƒ  |  j ƒ  n  d S(   sH  Show the given text in a scrollable window with a 'close' button

        If modal option set to False, user can interact with other windows,
        otherwise they will be unable to interact with other windows until
        the textview window is closed.

        _htest - bool; change box location when running htest.
        t   borderwidthi   s   =%dx%d+%d+%diî  iô  i
   id   s   #ffffffs   #000000t   WM_DELETE_WINDOWs   <Return>s   <Escape>g        t   stateN(   t   Toplevelt   __init__t	   configuret   geometryt   winfo_rootxt   winfo_rootyt   bgt   fgt   CreateWidgetst   titlet   protocolt   Okt   parentt   textViewt	   focus_sett   bindt   insertt   configt   DISABLEDt   is_modalt	   transientt   grab_sett   wait_window(   t   selfR   R   t   textt   modalt   _htest(    (    s!   lib/python2.7/idlelib/textView.pyR      s*    	!		
			
c      
   C   sC  t  |  d t d d ƒ} t  |  ƒ } t | d d d |  j d t ƒ|  _ t | d t d t d	 d
 ƒ|  _ t	 | d t
 d	 d
 d |  j d |  j ƒ|  _ |  j j d |  j j ƒ |  j j d |  j j ƒ |  j j ƒ  |  j j d t d t ƒ |  j j d t d t d t ƒ | j d t d t ƒ | j d t d t d t ƒ d  S(   Nt   relieft   heighti¼  R   t   Closet   commandt	   takefocust   orientt   highlightthicknessi    t   wrapR   R   t   yscrollcommandt   sidet   fillt   expand(   t   Framet   SUNKENt   ButtonR   t   FALSEt   buttonOkt	   Scrollbart   VERTICALt   scrollbarViewt   Textt   WORDR   R   R   R   t   yviewt   sett   packt   RIGHTt   Yt   LEFTt   TRUEt   BOTHt   BOTTOMt   Xt   TOP(   R   t	   frameTextt   frameButtons(    (    s!   lib/python2.7/idlelib/textView.pyR   0   s    c         C   s$   |  j  r |  j ƒ  n  |  j ƒ  d  S(   N(   R   t   grab_releaset   destroy(   R   t   event(    (    s!   lib/python2.7/idlelib/textView.pyR   A   s    	N(	   t   __name__t
   __module__t   __doc__t   Truet   FalseR   R   t   NoneR   (    (    (    s!   lib/python2.7/idlelib/textView.pyR      s   $	c         C   s   t  |  | | | ƒ S(   N(   R   (   R   R   R   R   (    (    s!   lib/python2.7/idlelib/textView.pyt	   view_textG   s    c         C   s¼   y: | r* d d  l  } | j | d ƒ } n t | d ƒ } Wnb t k
 rm t j d d d d | d |  ƒ nK t k
 rž } t d d d t | ƒ d |  ƒ n Xt |  | | j ƒ  | ƒ Sd  S(	   Niÿÿÿÿt   rR   s   File Load Errort   messages   Unable to load file %r .R   s   Unicode Decode Error(	   t   codecst   opent   IOErrort   tkMessageBoxt	   showerrort   UnicodeDecodeErrort   strRL   t   read(   R   R   t   filenamet   encodingR   RO   t   textFilet   err(    (    s!   lib/python2.7/idlelib/textView.pyt	   view_fileJ   s    

t   __main__s   idlelib.idle_test.test_textviewt	   verbosityi   t   exit(   t   run(   RH   t   TkinterRR   R   R   RI   RL   RK   R[   RF   t   unittestt   mainRJ   t   idlelib.idle_test.htestR_   (    (    (    s!   lib/python2.7/idlelib/textView.pyt   <module>   s   
?