
|Nc           @   s  d  d l  Z  d  d l Z d  d l Z d  d l Z d  d l Td  d l Z d  d l Z d  d l Z d  d l m	 Z	 d  d l
 m Z d  d l
 m Z d  d l
 m Z d  d l
 m Z d  d l
 m Z d  d	 l
 m Z d  d
 l m Z d  d l
 m Z m Z m Z d  d l
 m Z d Z d   Z e d  Z d e f d     YZ d   Z d   Z d  d l Z e Z  [ d e f d     YZ! d   Z" i d d 6d d 6d d 6Z# d   Z$ d   Z% d   Z& e' d  k re&   n  d S(!   iN(   t   *(   t   MultiCallCreator(   t   idlever(   t
   WindowList(   t   SearchDialog(   t
   GrepDialog(   t   ReplaceDialog(   t   PyParse(   t   idleConf(   t   aboutDialogt   textViewt   configDialog(   t   macosxSupporti   c          C   s   t  j \ }  } } } } d |  | f } | rB | d | f 7} n  | d k rb | d | f 7} n' | d k r | d | d | f 7} n  | S(   sY   Format sys.version_info to produce the Sphinx version string used to install the chm docss   %s%ss   %st	   candidates   rc%st   finali    (   t   syst   version_info(   t   majort   minort   microt   levelt   serialt   release(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyt   _sphinx_version   s    c   
      C   sS  d } x |  j d  D] } | d k	 r5 | j   n  t j | |  \ } } } | d t j k rg Pn  t j | | | |  } y | j } Wq t k
 r t	 d | j
  q Xq W| d t j k rFt |   } y | j } Wn t k
 r qFXd } t j j |  \ } }	 |	 d k r'd }	 n  | |	 } | d t j f } n  | | | f S(   sC   Version of imp.find_module() that handles hierarchical module namest   .i   s   No source for module s   .pycs   .pyN(   t   Nonet   splitt   closet   impt   find_modulet	   PY_SOURCEt   load_modulet   __path__t   AttributeErrort   ImportErrort   __name__t
   __import__t   __file__t   ost   patht   splitext(
   t   fullnameR'   t   filet   tgtt   filenamet   descrt   modulet   mt   baset   ext(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyt   _find_module$   s2    	
t   EditorWindowc           B   sp  e  Z d  d l m Z d  d l m Z d  d l m Z d  d l m	 Z	 m
 Z
 m Z d  d l m Z d  d l m Z d  d l m Z d{ Z d{ d{ d{ d{ d  Z d	   Z d
   Z d   Z d   Z d{ d  Z d| d} d~ d d d d g Z e j   re d =d e d <n  d   Z d    Z d{ Z d!   Z  d g Z! d$   Z" d{ d%  Z# d{ d&  Z$ d{ d'  Z% d{ d(  Z& d)   Z' d*   Z( d+   Z) d{ d,  Z* d{ d-  Z+ d.   Z, d/   Z- d0   Z. d1   Z/ d2   Z0 d3   Z1 d4   Z2 d5   Z3 d6   Z4 d{ d7  Z5 d{ d8  Z6 d{ d9  Z7 d:   Z8 d;   Z9 d<   Z: d=   Z; d>   Z< d?   Z= d@   Z> dA   Z? dB   Z@ dC   ZA dD   ZB dE   ZC dF   ZD dG   ZE d{ dH  ZF dI   ZG dJ   ZH dK   ZI dL   ZJ dM   ZK dN   ZL dO   ZM dP   ZN dQ dR  ZO dS   ZP dQ dT  ZQ dU   ZR dV   ZS dW   ZT dX   ZU dY   ZV dZ   ZW d[   ZX d\   ZY d]   ZZ d^   Z[ d{ d_  Z\ d{ d{ d`  Z] da   Z^ d{ db  Z_ d{ dc  Z` dd   Za de   Zb df   Zc dg   Zd ee dh  Zf di   Zg dj   Zh dk   Zi dl   Zj dm   Zk dn   Zl do   Zm dp   Zn dq   Zo dr   Zp ds   Zq dt   Zr du   Zs dv   Zt dw   Zu dx   Zv dy   Zw dz   Zx RS(   i(   t
   Percolator(   t   ColorDelegator(   t   UndoDelegator(   t	   IOBindingt   filesystemencodingt   encoding(   t   Bindings(   t   Toplevel(   t   MultiStatusBarc      	   C   s	  t  j d  k rst j j t j d d  } t j j	 d  r d d t j
 d  } t j j d  rl d } q
d	 } t j j | | d d  } nz t j d  d
 k r t j j t j d d t    } t j j |  r
| } q
n' t j   r
t j j t j d  } n  t j j |  } t j j |  r\| t  _ t j d k rpd t  j t  _ qpqsd t j
 d  t  _ n  t j   }	 | |  _ | p| j } | |  _ y t j Wn t k
 rd t _ n Xt |  |  _ t j | d |  j |  _ }
 | r| j |  _ | j |  j _ n i  |  _ i  |  j _ t j j t j    d  |  _! t" |
  |  _# } t$ | d d |  _% } t j& d d d  |  _' i d d 6d d 6d d 6|  j' d 6t j& d d d  d 6} t( d k rd  | d! <n  t) t*  | |  |  _+ } |  j+ |  j _, |  j-   |  j.   |  j j/ d" |  j0  |  j j1 d# |  j2  t j   r| j1 d# |  j2  | j1 d$ |  j3  n | j1 d% |  j3  | j1 d& |  j4  | j1 d' |  j5  | j1 d( |  j6  | j1 d) |  j7  | j1 d* |  j8  | j1 d+ |  j9  | j1 d, |  j:  | j1 d- |  j;  | j1 d. |  j<  | j1 d/ d0    | j1 d1 |  j=  | j1 d2 |  j>  | j1 d3 |  j?  | j1 d4 |  j@  | j1 d5 |  jA  | j1 d6 |  jB  | j1 d7 |  jC  | j1 d8 |  jD  | j1 d9 |  jE  | j1 d: |  jF  | j1 d; |  jG  | j1 d< |  jH  | j1 d= |  jI  | j1 d> |  jJ  | j1 d? |  jK  | j1 d@ |  jL  | j1 dA |  jM  | j1 dB |  jN  | j1 dC |  jO  | j1 dD |  jP dE   | j1 dF |  jP dG   | j1 dH |  jQ  | j1 dI |  jR  | j1 dJ |  jS  | r| | j |  <| rS|  | jT | <n  | j1 dK |  jU  | j1 dL |  j jV  | j1 dM |  jW  | j1 dN |  jX  n  |  jY   | jZ | dO <| j[ dP t\ dQ t]  | j^ | dR <dS } t j& d d dT dU dV r	dW } n  | j_ dX t j& d d dX  t j& d d dY  | f  | j[ dP t` dQ ta dZ dG  | j[ dP tb dQ ta dZ dG  | jc   t j& d d[ d\ dU dV } | |  _d d] |  _e |  je |  _f |  jg   th |  _i dh |  _j |  jk |  |  _l } |  jm   |  _n } | jo |  | jp | _p | jq | _q | jr |  js  |  jt |   |  _u } | jv |  jw  t |  j  |  _x |  jy da jz d db dc dd dE d |  jx |  j{   d  |  _| | rt j j} |  rt j j |  r| j~ |  q| j |  n  |  j   |  js   |  j |  j |   |  j   |  jy j de  } | r	| j df  } | d  k re	dg } n  | dE k r	| j   | dG } n  | |  _ t j |  j  n  t j |  _ t j |  _ t j |  _ d  S(i   Nt   Docs
   index.htmlt   linuxs   python-docs-s   %s.%s.%si   s   /var/www/html/python/s   /var/www/html/python/index.htmls   /usr/share/doc/t   wins   Python%s.chms0   Resources/English.lproj/Documentation/index.htmlt   darwins   file://s   http://docs.python.org/%d.%di   s   >>> t   menus   recent-files.lstt   namet   vbart   mainR3   t   widtht   texti   t   padxt   nonet   wrapt   heightg      !@t   wordprocessort   tabstylet   WM_DELETE_WINDOWs   <<close-window>>s   <Control-Button-1>s   <3>s   <<cut>>s   <<copy>>s	   <<paste>>s   <<center-insert>>s   <<help>>s   <<python-docs>>s   <<about-idle>>s   <<open-config-dialog>>s   <<open-module>>s   <<do-nothing>>c         S   s   d S(   Nt   break(    (   t   event(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyt   <lambda>   s    s   <<select-all>>s   <<remove-selection>>s   <<find>>s   <<find-again>>s   <<find-in-files>>s   <<find-selection>>s   <<replace>>s   <<goto-line>>s   <<smart-backspace>>s   <<newline-and-indent>>s   <<smart-indent>>s   <<indent-region>>s   <<dedent-region>>s   <<comment-region>>s   <<uncomment-region>>s   <<tabify-region>>s   <<untabify-region>>s   <<toggle-tabs>>s   <<change-indentwidth>>s   <Left>i    s   <Right>i   s   <<del-word-left>>s   <<del-word-right>>s   <<beginning-of-line>>s   <<open-new-window>>s   <<close-all-windows>>s   <<open-class-browser>>s   <<open-path-browser>>t   commandt   sidet   fillt   yscrollcommandt   normals	   font-boldt   typet   boolt   boldt   fonts	   font-sizet   expandt   Indents
   use-spacesi   i2   i  i@KL R*   t   labels   Recent Filest	   underlinet   windowst   endi(   i2   i  i@KL (   R3   t   help_urlR   R&   R'   t   joinR   t   prefixt   platformt   countR   t   isdirR   t   isfileR   t   runningAsOSXAppt   normpathR   t   CurrentThemet   flistt   roott   ps1R!   t   Menut   menubarR   t   ListedToplevelt   topt   varst   tkinter_varst   inversedictt   instance_dictt   GetUserCfgDirt   recent_files_patht   Framet
   text_framet	   ScrollbarRC   t	   GetOptionRE   t	   TkVersionR   t   TextRF   t   focused_widgett   createmenubart   apply_bindingst   protocolR   t   bindt   close_eventt   right_menu_eventt   cutt   copyt   pastet   center_insert_eventt   help_dialogt   python_docst   about_dialogt   config_dialogt   open_modulet
   select_allt   remove_selectiont
   find_eventt   find_again_eventt   find_in_files_eventt   find_selection_eventt   replace_eventt   goto_line_eventt   smart_backspace_eventt   newline_and_indent_eventt   smart_indent_eventt   indent_region_eventt   dedent_region_eventt   comment_region_eventt   uncomment_region_eventt   tabify_region_eventt   untabify_region_eventt   toggle_tabs_eventt   change_indentwidth_eventt   move_at_edge_if_selectiont   del_word_leftt   del_word_rightt   home_callbackt   dictt   new_callbackt   close_all_callbackt   open_class_browsert   open_path_browsert   set_status_bart   yviewt   packt   RIGHTt   Yt   sett   configt   LEFTt   BOTHt   TOPt	   focus_sett   usetabst   tabwidtht   indentwidtht   set_notabs_indentwidtht   Falset   context_use_ps1t   num_context_linesR4   t   perR6   t   undot   insertfiltert   undo_block_startt   undo_block_stopt   set_saved_change_hookt   saved_change_hookR7   t   iot   set_filename_change_hookt   filename_change_hookt   recent_files_menut   menudictt   insert_cascadet   update_recent_files_listt   colort   existst   loadfilet   set_filenamet   ResetColorizert   set_indentation_paramst   ispythonsourcet   load_extensionst   gett   indext   add_separatort	   wmenu_endt   register_callbackt   postwindowsmenut   tkMessageBoxt   askyesnot   tkSimpleDialogt
   askintegert	   showerror(   t   selfRj   R,   t   keyRk   t   dochomet   pyvert   basepatht   chmfilet   currentThemeRp   Rx   RC   t   text_optionsRF   t
   fontWeightt	   usespacesR   R   R   RA   R_   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyt   __init__O   s<   					



	


	
		

	%


	
	c         C   sx   t  | t  s | r | Sy | j |  j  SWnC t k
 rs y | j |  j  SWqt t k
 ro | j d  SXn Xd S(   s8   convert filename to unicode in order to display it in Tks	   iso8859-1N(   t
   isinstancet   unicodet   decodeR8   t   UnicodeDecodeErrorR9   (   R   R,   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyt   _filename_to_unicode0  s    c         C   s)   |  j  j   \ } } |  j j |  d S(   NRN   (   R   t   defaultfilenameRj   t   new(   R   RO   t   dirnamet   basename(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR   ?  s    c         C   s|  | j  d @d k r& | j d k r& d  S|  j j d  r |  j j d d d  r |  j j d d d  r t |  j j d  j d  d	  } nR |  j j d d  } x: t t	 |   D] } | | d k r Pq q Wt	 |  } t |  j j d  j d  d	  } | | k rd } n  d t
 |  d } | j  d	 @d k r\|  j j d d d  n |  j j d  s|  j j d d  nY |  j j |  j j d  d |  j j d   r|  j j d d  n |  j j d d  |  j j |  } |  j j d  } |  j j | d |  r)| | } } n  |  j j d d d  |  j j d | |  |  j j d |  |  j j d  d S(   Ni   i    t   Homet   iomarks   <=s   insert lineends   insert linestartR   i   t    s   	t   inserts   insert linestart+t   ct   sels   1.0R_   s	   sel.firstt	   my_anchort   <s   sel.lastt   >RN   (   R   s   	(   t   statet   keysymRF   R   t   comparet   intR   R   t   xranget   lent   strt
   tag_removet   mark_sett   tag_addt   see(   R   RO   t   insertptt   linet   lineatt   destt   firstt   last(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR   D  s>    "(%	0c         C   s   |  j  |  j  |  _ t j   r= |  j j d d d t n  |  j j d d d t |  j j d d d t |  j j d t d t	  |  j
 j d	 |  j  |  j
 j d	 d
 d  |  j
 j |  j  d  S(   Nt	   _padding1s       RR   t   columns   Col: ?R  s   Ln: ?RS   s   <<set-line-and-column>>s   <KeyRelease>s   <ButtonRelease>(   R<   Rp   t
   status_barR   Rg   t	   set_labelR   R   t   BOTTOMt   XRF   R   t   set_line_and_columnt	   event_addt
   after_idle(   R   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR   m  s    
c         C   sS   |  j  j t  j d  \ } } |  j j d d |  |  j j d d |  d  S(   NR   R  s   Col: %sR  s   Ln: %s(   RF   R   t   INSERTR   R  R  (   R   RO   R  R  (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR  {  s    !R*   t   _Filet   editt   _Editt   formatt   F_ormatt   runt   _Runt   optionst   _OptionsR^   t   _Windowst   helpt   _Helpit   _Windowic         C   s   |  j  } i  |  _ } x_ |  j D]T \ } } t |  \ } } t | d | | | <} | j d | d | d |  q  Wt j |  j  r t | d d | d <} | j d d d |  n  |  j	   |  j d j
 t  |  _ |  j   d  S(	   NRB   R\   RA   R]   t   applet   applicationt   IDLER  (   Rn   R   t
   menu_specst   prepstrRm   t   add_cascadeR   t   isCarbonAquaTkRk   t
   fill_menusR   t   ENDt   base_helpmenu_lengtht   reset_help_menu_entries(   R   t   mbarR   RB   R\   R]   RA   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR~     s    	 
c         C   sk   |  j  d } | j d  } | d  k r1 d } n  | |  j k rZ | j |  j d |  n  t j |  d  S(   NR^   R_   ii   (   R   R   R   R   t   deleteR   t   add_windows_to_menu(   R   RA   R_   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR     s    	c         C   s   |  j  j d d d  |  j  j d d | j | j f  |  j sO |  j   n  |  j } | |  _ t j	 d  d k } | r |  j  j
 d d	  n  | j | j | j  | r |  j  j
 d d
  n  d  S(   NR   s   1.0R_   R   s   @%d,%di   R?   t   cursort   arrowt   ibeam(   RF   R   R  t   xt   yt   rmenut
   make_rmenuRO   R   Rc   R   t   tk_popupt   x_roott   y_root(   R   RO   R4  t   iswin(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR     s    #			t   Closes   <<close-window>>c         C   sd   t  |  j d d } x? |  j D]4 \ } } |  j | d  } | j d | d |  q W| |  _ d  S(   Nt   tearoffi    c         S   s   |  j  |  d  S(   N(   t   event_generate(   RF   t	   eventname(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyRQ     s    R\   RQ   (   Rm   RF   t   rmenu_specst   add_commandR4  (   R   R4  R\   R=  RQ   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR5    s
    c         C   s   t  j |  j d  d  S(   Ns
   About IDLE(   R	   t   AboutDialogRp   (   R   RO   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR     s    c         C   s   t  j |  j d  d  S(   Nt   Settings(   R   t   ConfigDialogRp   (   R   RO   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR     s    c         C   sG   t  j j t  j j t  j j t   d  } t j |  j d |  d  S(   Ns   help.txtt   Help(	   R&   R'   Ra   t   abspathR   R%   R
   t	   view_fileRp   (   R   RO   t   fn(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR     s    -c         C   sy   t  j d  d k re y t j |  j  Wqu t k
 ra } t j d d d t |  d |  j	  qu Xn t
 j |  j  d S(   Ni   R?   t   titles   Document Start Failuret   messaget   parentRN   (   R   Rc   R&   t	   startfileR`   t   WindowsErrorR   R   R   RF   t
   webbrowsert   open(   R   RO   t   why(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR     s    c         C   s   |  j  j d  d S(   Ns   <<Cut>>RN   (   RF   R<  (   R   RO   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR     s    c         C   s*   |  j  j d  s d  S|  j  j d  d S(   NR   s   <<Copy>>RN   (   RF   t
   tag_rangesR<  (   R   RO   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR     s    c         C   s$   |  j  j d  |  j  j d  d S(   Ns	   <<Paste>>R   RN   (   RF   R<  R  (   R   RO   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR     s    c         C   s=   |  j  j d d d  |  j  j d d  |  j  j d  d S(   NR   s   1.0s   end-1cR   RN   (   RF   R  R  R  (   R   RO   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR     s    c         C   s*   |  j  j d d d  |  j  j d  d  S(   NR   s   1.0R_   R   (   RF   R   R  (   R   RO   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR     s    c            s:   |  j  j   |  j  j  d       f d   } | S(   s   Cursor move begins at start or end of selection

        When a left/right cursor key is pressed create and return to Tkinter a
        function which causes a cursor move from the associated edge of the
        selection.

        s   sel.first+1cs   sel.last-1cc            sM   |  j  d @d k rI y   d   d    WqI t k
 rE qI Xn  d  S(   Ni   i    s	   sel.firstR   (   R   t   TclError(   RO   (   t   self_text_indext   edges_tablet   self_text_mark_sett
   edge_index(    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyt   move_at_edge  s    
(   s   sel.first+1cs   sel.last-1c(   RF   R   R  (   R   RT  RU  (    (   RQ  RR  RS  RT  s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR     s
    c         C   s   |  j  j d  d S(   Ns   <Meta-Delete>RN   (   RF   R<  (   R   RO   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR   
  s    c         C   s   |  j  j d  d S(   Ns   <Meta-d>RN   (   RF   R<  (   R   RO   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR     s    c         C   s   t  j |  j  d S(   NRN   (   R   t   findRF   (   R   RO   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR     s    c         C   s   t  j |  j  d S(   NRN   (   R   t
   find_againRF   (   R   RO   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR     s    c         C   s   t  j |  j  d S(   NRN   (   R   t   find_selectionRF   (   R   RO   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR     s    c         C   s    t  j |  j |  j |  j  d S(   NRN   (   R   t   grepRF   R   Rj   (   R   RO   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR     s    c         C   s   t  j |  j  d S(   NRN   (   R   t   replaceRF   (   R   RO   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR   "  s    c         C   sp   |  j  } t j d d d | } | d  k r1 d S| d k rK | j   d S| j d d |  | j d  d  S(   Nt   Gotos   Go to line number:RI  RN   i    R   s   %d.0(   RF   R   R   R   t   bellR  R  (   R   RO   RF   t   lineno(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR   &  s    		
c   	      C   sP  y |  j  j d d  } Wn t k
 r2 d } n X| j   } t j d d d |  j  d | } | ru | j   } n  | s d  Sy" t |  \ } } \ } } } Wn9 t t f k
 r } t	 j
 d t |  d |  j  d  SX| t j k rt	 j
 d	 d
 | d |  j  d  S| r | j   n  |  j r<|  j j |  n |  j j |  d  S(   Ns	   sel.firsts   sel.lastt    t   ModulesA   Enter the name of a Python module
to search on sys.path and open:RI  t   initialvalues   Import errors   Unsupported types   %s is not a source module(   RF   R   RP  t   stripR   t	   askstringR2   t	   NameErrorR"   R   R   R   R   R   R   Rj   RM  R   R   (	   R   RO   RB   t   fR*   t   suffixt   modeRV   t   msg(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR   2  s4    
	"		c         C   s   |  j  j } | s< t j d d d |  j |  j j   d  St j j	 |  \ } } t j j
 |  \ } } d d l m } | j |  j | | g  d  S(   Ns   No filenames&   This buffer has no associated filenamet   masteri(   t   ClassBrowser(   R   R,   R   R   RF   R   R   R&   R'   R   R(   t   idlelibRi  Rj   (   R   RO   R,   t   headt   tailR0   R1   Ri  (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR   S  s    
c         C   s$   d d l  m } | j |  j  d  S(   Ni(   t   PathBrowser(   Rj  Rm  Rj   (   R   RO   Rm  (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR   a  s    c         C   sl   | d  k	 rh | d k rh |  j j d d |  |  j j d d d  |  j j d d d  |  j   n  d  S(   Ni    R   s   %d.0R   s   1.0R_   s
   insert +1l(   R   RF   R  R   R  t   center(   R   R]  (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyt   gotolinee  s
    c         C   s   | s t  j j |  r t St  j j t  j j |   \ } } t  j j |  d k r] t Sy& t |  } | j   } | j	   Wn t
 k
 r t SX| j d  o | j d  d k S(   Ns   .pys   .pyws   #!t   pythoni    (   s   .pys   .pyw(   R&   R'   Re   t   TrueR(   R   t   normcaseRM  t   readlineR   t   IOErrorR   t
   startswithRV  (   R   R,   R0   R1   Rd  R  (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR   l  s    $c         C   s)   |  j  r% |  j  j |   d  |  _  n  d  S(   N(   Rj   t   unregister_maybe_terminateR   (   R   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyt
   close_hookz  s    	c         C   s   | |  _  d  S(   N(   Rw  (   R   Rw  (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyt   set_close_hook  s    c         C   sD   |  j  r |  j  j |   n  |  j   |  j j |   |  j   d  S(   N(   Rj   t   filename_changed_editR   Rp   t   update_windowlist_registryR   (   R   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR     s
    	
c         C   s}   |  j  r d  S|  j |  j j  r4 |  j   |  _  n  |  j  ry |  j j |  j  |  j j |  j   |  j j |  j  n  d  S(   N(	   R   R   R   R,   R5   R   t   removefilterR   R   (   R   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyt   _addcolorizer  s    		c         C   s:   |  j  s d  S|  j  j   |  j j |  j   d  |  _  d  S(   N(   R   t   removecolorsR   R{  R   (   R   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyt   _rmcolorizer  s
    	c         C   s   |  j    |  j   t j d d d  } t j | d  } t j | d d d } t j | d  } |  j j d	 | d	 d
 | d
 d | d | d	 d | d
  d S(   s   Update the colour themeRD   t   ThemeRB   RU   R/  t   fgBgt   fgt   hilitet
   foregroundt
   backgroundt   insertbackgroundt   selectforegroundt   selectbackgroundN(   R~  R|  R   Rz   t   GetHighlightRF   R   (   R   t   themet   normal_colorst   cursor_colort   select_colors(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR     s    




c         C   sh   d } t  j d d d d d r* d } n  |  j j d t  j d d d  t  j d d d	  | f  d
 S(   s.   Update the text widgets' font if it is changedRU   RD   R3   s	   font-boldRV   RW   RX   RY   s	   font-sizeN(   R   Rz   RF   R   (   R   R   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyt	   ResetFont  s    	c         C   s   t  j   |  j _ } x- | j   D] \ } } |  j j | |  q# Wx\ |  j   D]N } t  j |  } | rS x0 | j   D] \ } } |  j j | |  q{ WqS qS Wd S(   s/   Remove the keybindings before they are changed.N(	   R   t   GetCurrentKeySetR:   t   default_keydefst   itemsRF   t   event_deletet   get_standard_extension_namest   GetExtensionBindings(   R   t   keydefsRO   t   keylistt   extensionNamet   xkeydefs(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyt   RemoveKeybindings  s    c         C   s  t  j   |  j _ } |  j   x9 |  j   D]+ } t  j |  } | r- |  j |  q- q- Wi  } xd |  j j D]V } i  | | d <x? | d D]3 } | r | d | | d t | d  d <q q Wqo Wx |  j	 j
   D] } |  j	 | } | j t  d } x t d |  D] }	 | j |	  d k r| j |	 d  }
 |
 r| j |	 d  } d } | | k r| | | k r| | | } qn  | rt | |  }
 | j |	 d |
 qqqqWq Wd S(   s-   Update the keybindings after they are changedi    i   RQ   t   acceleratorR\   R^  N(   R   R  R:   R  R   R  R  t   menudefsR%  R   t   keysR   R)  t   rangeRV   t	   entrycgett   get_acceleratort   entryconfig(   R   R  R  R  t   menuEventDictRA   t   itemt   menubarItemR_   R   t   accelt   itemNameRO   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyt   ApplyKeybindings  s6    
/c         C   s.   |  j  s* t j d d d d d |  _ n  d S(   sC   Update the indentwidth if changed and not using tabs in this windowRD   R[   s
   num-spacesRV   R   N(   R   R   Rz   R   (   R   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR     s    	c         C   s   t  j   } |  j d } | j t  } | |  j k rQ | j |  j d |  n  | r | j   x> | D]3 } |  j | d  } | j	 d | d d |  qh Wn  | |  j d <d S(   s3   Update the additional help entries on the Help menuR  i   R\   i    RQ   N(
   R   t   GetAllExtraHelpSourcesListR   R   R)  R*  R-  R   t"   _EditorWindow__extra_help_callbackR?  (   R   t	   help_listt   helpmenut   helpmenu_lengtht   entryt   cmd(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR+    s    
!c            s   |   f d  } | S(   sC   Create a callback with the helpfile value frozen at definition timec            s   |  j  d	  s$ t j j |   }  n  t j d  d k r y t j |   Wq t k
 r } t j	 d d d t
 |  d   j  q Xn t j |   d  S(
   Nt   wwwt   httpi   R?   RG  s   Document Start FailureRH  RI  (   R  R  (   Ru  R&   R'   Rh   R   Rc   RJ  RK  R   R   R   RF   RL  RM  (   t   helpfileRN  (   R   (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyt   display_extra_help  s    (    (   R   R  R  (    (   R   s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyt   __extra_help_callback  s    c      	   C   s  g  } t  j j |  j  rN t |  j d  } z | j   } Wd | j   Xn  | r t  j j |  d } | | k r | j |  n  | j	 d |  n  g  } xD | D]< } d | k s t  j j | d d ! r | j
 |  q q Wg  | D] } | | k r | ^ q } d } | d t |  !} t |  j d  } z | j |  Wd | j   Xx |  j j j   D] } | j }	 |	 j d	 t  xl t |  D]^ \ }
 } | j   } |  j |  } | j |  } |	 j d
 | |
 d | d | d d  qWqhWd S(   s/   Load and update the recent files list and menust   rNs   
i    t    it   1234567890ABCDEFGHIJKt   wi   R\   R   RQ   R]   (   R&   R'   R   Rv   RM  t	   readlinesR   RD  t   removeR   t   appendR   t
   writelinesRp   Rt   R  R   R-  R)  t	   enumeratet   rstripR   t#   _EditorWindow__recent_file_callbackR?  (   R   t   new_filet   rf_listt   rf_list_filet	   bad_pathsR'   t   ulcharst   rf_filet   instanceRA   t   it	   file_namet
   ufile_namet   callback(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR   	  s@    &%	c            s   |   f d  } | S(   Nc            s     j  j d |   d  S(   Nt   editFile(   R   RM  (   t
   fn_closure(   R   (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyt   open_recent_file2  s    (    (   R   R  R  (    (   R   s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyt   __recent_file_callback1  s    c         C   s   |  j    } |  j   } | r5 | r5 | d | } n$ | rD | } n | rS | } n d } | ph | ph | } |  j   s d | } d | } n  |  j j |  |  j j |  d  S(   Ns    - t   Untitleds   *%s*s   *%s(   t   short_titlet
   long_titlet	   get_savedRp   t   wm_titlet   wm_iconname(   R   t   shortt   longRG  t   icon(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR   6  s    		
c         C   s   |  j  j   S(   N(   R   R  (   R   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR  H  s    c         C   s   |  j  j |  d  S(   N(   R   t	   set_saved(   R   t   flag(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR  K  s    c         C   s   |  j  j   d  S(   N(   R   t
   reset_undo(   R   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR  N  s    c         C   s4   |  j  j } | r' t j j |  } n  |  j |  S(   N(   R   R,   R&   R'   R   R   (   R   R,   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR  Q  s    c         C   s   |  j  |  j j p d  S(   NR^  (   R   R   R,   (   R   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR  X  s    c         C   s   |  j    d  S(   N(   Rn  (   R   RO   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR   \  s    R   c         C   sb   |  j  } |  j   \ } } |  j |  } | | } t d | | d  } | j t |   d  S(   Ni   i   (   RF   t   getwindowlinest	   getlinenot   maxR   t   float(   R   t   markRF   Rp   t   botR]  RJ   t   newtop(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyRn  _  s    	
c         C   sp   |  j  } |  j d  } |  j d  } | | k rf | j   d k rf t | d  } | | d } n  | | f S(   Ns   @0,0s   @0,65535i   RJ   (   RF   R  t   winfo_heightR   (   R   RF   Rp   R  RJ   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR  g  s    	c         C   s"   |  j  } t t | j |    S(   N(   RF   R   R  R   (   R   R  RF   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR  q  s    	c         C   s:   |  j  j   } t j d |  } t t | j    } | S(   s   Return (width, height, x, y)s   (\d+)x(\d+)\+(-?\d+)\+(-?\d+)(   Rp   t   wm_geometryt   ret   matcht   mapR   t   groups(   R   t   geomR/   t   tuple(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyt   get_geometryu  s    c         C   s   |  j    d  S(   N(   R   (   R   RO   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR   |  s    c         C   sh   |  j  rd |  j   sW |  j j   d k r: |  j j   n  |  j j   |  j j   n  |  j  j   Sd  S(   NRU   (   R   R  Rp   R   t	   deiconifyt   lowert   liftt	   maybesave(   R   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR    s    	c         C   s/   |  j    } t |  d k r+ |  j   n  | S(   Nt   cancel(   R  R   t   _close(   R   t   reply(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR     s    c         C   s   |  j  j r% |  j d |  j  j  n  t j |  j  |  j   |  j  j   d  |  _  d  |  _	 |  j
 r |  j
 j t  d  |  _
 n  d  |  _ d  |  _ |  j j   d  |  _ |  j j   |  j r |  j   n  d  S(   NR  (   R   R,   R   R   t   unregister_callbackR   t   unload_extensionsR   R   R   R   R   RF   Rr   R   Rp   t   destroyRw  (   R   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR    s"    
							c         C   s   i  |  _  |  j   d  S(   N(   t
   extensionst   load_standard_extensions(   R   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR     s    	c         C   sC   x3 |  j  j   D]" } t | d  r | j   q q Wi  |  _  d  S(   NR   (   R  t   valuest   hasattrR   (   R   t   ins(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR    s    c         C   s[   xT |  j    D]F } y |  j |  Wq d Gt |  GHd d  l } | j   q Xq Wd  S(   Ns   Failed to load extensioni(   R  t   load_extensiont   reprt	   tracebackt	   print_exc(   R   RB   R  (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR    s    c         C   s   t  j d t  S(   Nt   editor_only(   R   t   GetExtensionsRq  (   R   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR    s    c         C   sV  y t  | t   t   g   } Wn t k
 r< d G| GHd  SXt | |  } t j |  } t | d  r |  j | j	 |  n  | |   } | |  j
 | <| rR|  j |  x | j   D] } | j d d  } x | d  d k r | d } q Wx | d d k r| d  } q W| d	 } t | |  r |  j j | t | |   q q Wn  d  S(
   Ns   
Failed to import extension: R  t   -t   _i   R   iR   t   _event(   R$   t   globalst   localsR"   t   getattrR   R  R  R(  R  R  R   R  RZ  RF   R   (   R   RB   t   modt   clsR  R  t   veventt
   methodname(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR    s,    	
c         C   sg   | d  k r |  j j } n  |  j } | | _ x3 | j   D]% \ } } | r: | j | |  q: q: Wd  S(   N(   R   R:   R  RF   R  R  R  (   R   R  RF   RO   R  (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR     s    		c         C   sf  | d	 k r |  j j } n  | d	 k r6 |  j j } n  |  j } |  j } x| D]\ } } | j |  } | sv qO n  x | D] } | s | j   q} | \ }	 }
 |	 d  d k } | r |	 d }	 n  t |	  \ } }	 t	 | |
  } | |
 d  } | r8|  j
 |
 t  } | j d |	 d | d | d | d |  q} | j d |	 d | d | d |  q} WqO Wd	 S(
   s   Add appropriate entries to the menus and submenus

        Menus that are absent or None in self.menudict are ignored.
        i   t   !c         S   s   |  j  |  d  S(   N(   R<  (   RF   R=  (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyRQ     s    R\   R]   RQ   R  t   variableN(   R   R:   R  R  R   RF   R   R   R%  R  t   get_var_objt
   BooleanVart   add_checkbuttonR?  (   R   R  R  R   RF   t   mnamet	   entrylistRA   R  R\   R=  t   checkbuttonR]   R  RQ   t   var(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR(    s8    		
c         C   s2   |  j  |  } | r% | j   } | St |  d  S(   N(   R	  R   Rc  (   R   RB   R  t   value(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyt   getvar  s
    c         C   s5   |  j  | |  } | r( | j |  n	 t |  d  S(   N(   R	  R   Rc  (   R   RB   R  t   vartypeR  (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyt   setvar  s    c         C   s@   |  j  j |  } | r< | r< | |  j  |  j  | <} n  | S(   N(   Rr   R   RF   (   R   RB   R  R  (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR	    s    c         C   s<   |  j  r4 |  j j d |  p3 d |  j j |  k Sd Sd  S(   Nt   TODOt   STRINGi   (   R   RF   t   tag_prevranget	   tag_names(   R   t
   text_index(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyt   is_char_in_string  s    	c         C   sK   y2 |  j  j d  } |  j  j d  } | | f SWn t k
 rF d SXd  S(   Ns	   sel.firsts   sel.last(   NN(   RF   R   RP  R   (   R   R  R	  (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyt   get_selection_indices)  s    c         C   s   |  j  d p t } t |  S(   Nt   tabs(   RF   t   TK_TABWIDTH_DEFAULTR   (   R   t   current(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyt   get_tabwidth4  s    c         C   s^   |  j  } |  j   | k rZ | j j d d | d d | j d |  } | j d |  n  d  S(   NRY   t   measures
   -displayoft   nR  (   RF   R  t   tkt   callRh  t	   configure(   R   t   newtabwidthRF   t   pixels(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyt   set_tabwidth:  s    		c         C   su   | ra | ra |  j    } d | k o/ d k n r@ | |  _ n  |  j |  j k ra t |  _ qa n  |  j |  j  d  S(   Ni   i   (   t   guess_indentR   R   R   R   R&  (   R   R   t   guessR  (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR   H  s    c         C   s  |  j  } |  j   \ } } | rK | rK | j | |  | j d |  d S| j d d  } | d k r | j d d d  r | j d  n
 | j   d S| d d	 k r | j d  d S|  j } t | j	 |   } | d
 k s t
  | d |  j |  j } t j j d  d }	 d
 }
 x\ | |	 k r4Pn  | d  } |
 d }
 t | j	 |   } | | k sy| d d	 k r$Pq$q$| j   | j d |
 d  | | k  r| j d d | |  n  | j   d S(   NR   RN   s   insert linestartR^  R   s   1.0s	   insert-1cis    	i    i   s   
s
   insert-%dcR   (   RF   R  R-  R  R   R   R\  R   R   t
   expandtabst   AssertionErrorR   R   Rl   R   R   R   R   (   R   RO   RF   R  R	  t   charsR   t   havet   wantt   last_line_of_promptt   ncharsdeleted(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR   Q  sF    	
	



c   
      C   sH  |  j  } |  j   \ } } | j   z| r| | r| t |  t |  k rY |  j |  S| j | |  | j d |  n  | j d d  } t | |  j	  \ } } | t
 |  k r |  j | |  j  nU |  j r d } n3 t
 | j |  j	   } |  j }	 d |	 | |	 } | j d |  | j d  d SWd  | j   Xd  S(   NR   s   insert linestarts   	R   RN   (   RF   R  R   t
   index2lineR   R-  R  R   t
   classifywsR   R   t   reindent_toR   R   R)  R   R  R   (
   R   RO   RF   R  R	  Rb   t   rawt	   effectivet   padR   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR   ~  s,    	
			c      	   C   s  |  j  } |  j   \ } } | j   z| rW | rW | j | |  | j d |  n  | j d d  } d t |  } } x* | | k  r | | d k r | d } q W| | k r | j d d  d S| |  } d } t j	 j
 d  d }	 x: | r+| d d k r+| |	 k r+| d  } | d } q W| rI| j d	 | d  n  x& | j d  d k rq| j d  qLW| j d d  t | j d   }
 t j |  j |  j  } |  j s^x |  j D] } t |
 | d  } t |  d
 } | j | d  } | j |  | j |  j |  j |   } | d  k	 s@| d k rPqqW| j | pWd  nW | j d d  } | r| d } n d } | j | d  } | j |  | j d  | j   } | t j k r| t j k rn | t j k r| j d |  n | t j k r)|  j  | j!    n` | t j" k rs| j#   d k r]| j d |  q|  j  | j$    n d st% d | f  d S| j&   } | j d |  | j'   r|  j( |  n" | r| j)   r|  j* |  n  d SWd  | j+ d  | j,   Xd  S(   NR   s   insert linestarti    s    	i   s   
RN   is   insert - %d charss   .0t   consoles   1.0s   bogus continuation type %r(-   RF   R  R   R-  R  R   R   R   R   Rl   R   R0  R   R   t   ParserR   R   R   R   R  R  t   set_strt   find_good_parse_startt   _build_char_in_string_funcR   t   set_loR  t   get_continuation_typet   C_NONEt   C_STRING_FIRST_LINEt   C_STRING_NEXT_LINESt	   C_BRACKETR2  t   compute_bracket_indentt   C_BACKSLASHt   get_num_lines_in_stmtt   compute_backslash_indentR*  t   get_base_indent_stringt   is_block_openerR   t   is_block_closerR   R  R   (   R   RO   RF   R  R	  R  R  R   t   indentR.  t   lnoR3  t   contextt   startatt   startatindext   rawtextt   bodR  R   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR     s    	

%
	c         C   s   | |  j  d  } | S(   Nc         S   s   | | d |   S(   Ns   +%dc(    (   t   offsett   _startindext   _icis(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyt   inner  s    (   R  (   R   t
   startindexRR  (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR:    s    c   
      C   s   |  j    \ } } } } xm t t |   D]Y } | | } | r+ t | |  j  \ } }	 |	 |  j }	 |  j |	  | | | | <q+ q+ W|  j | | | |  d S(   NRN   (   t
   get_regionR  R   R1  R   R   t   _make_blankst
   set_region(
   R   RO   Rk  Rl  R+  t   linest   posR  R3  R4  (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR     s    
"c   
      C   s   |  j    \ } } } } xv t t |   D]b } | | } | r+ t | |  j  \ } }	 t |	 |  j d  }	 |  j |	  | | | | <q+ q+ W|  j | | | |  d S(   Ni    RN   (	   RT  R  R   R1  R   R  R   RU  RV  (
   R   RO   Rk  Rl  R+  RW  RX  R  R3  R4  (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR     s    
"c         C   sk   |  j    \ } } } } x6 t t |  d  D] } | | } d | | | <q/ W|  j | | | |  d  S(   Ni   s   ##(   RT  R  R   RV  (   R   RO   Rk  Rl  R+  RW  RX  R  (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR   (  s
    
c         C   s   |  j    \ } } } } xt t t |   D]` } | | } | sG q+ n  | d  d k rd | d } n | d  d k r | d } n  | | | <q+ W|  j | | | |  d  S(   Ni   s   ##i   t   #(   RT  R  R   RV  (   R   RO   Rk  Rl  R+  RW  RX  R  (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR   /  s    
c         C   s   |  j    \ } } } } |  j   } xu t t |   D]a } | | } | r7 t | |  \ }	 }
 t |
 |  \ } } d | d | | |	 | | <q7 q7 W|  j | | | |  d  S(   Ns   	R   (   RT  t   _asktabwidthR  R   R1  t   divmodRV  (   R   RO   Rk  Rl  R+  RW  R   RX  R  R3  R4  t   ntabst   nspaces(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR   <  s    
%c         C   sr   |  j    \ } } } } |  j   } x1 t t |   D] } | | j |  | | <q7 W|  j | | | |  d  S(   N(   RT  RZ  R  R   R)  RV  (   R   RO   Rk  Rl  R+  RW  R   RX  (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR   G  s
    c         C   sZ   |  j  d d d |  j d d |  j d d	 d
 |  j rV |  j |  _ d |  _ n  d S(   Ns   Toggle tabss
   Turn tabs t   ont   offs   ?
Indent width s   will bes
   remains ats    8.s!   
 Note: a tab is always 8 columnsRI  i   RN   (   R^  R_  (   s   will bes
   remains at(   R   R   RF   R   (   R   RO   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR   N  s    !c         C   s_   |  j  d d d |  j d |  j d d d d } | r[ | |  j k r[ |  j r[ | |  _ n  d	 S(
   Ns   Indent widths6   New indent width (2-16)
(Always use 8 when using tabs)RI  R`  t   minvaluei   t   maxvaluei   RN   (   R   RF   R   R   (   R   RO   R   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR   d  s    			c         C   s   |  j  } |  j   \ } } | rP | rP | j | d  } | j | d  } n | j d  } | j d  } | j | |  } | j d  } | | | | f S(   Ns
    linestarts   -1c lineend +1cs   insert linestarts   insert lineend +1cs   
(   RF   R  R   R   R   (   R   RF   R  R	  Rk  Rl  R+  RW  (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyRT  p  s    	c         C   s   |  j  } d j |  } | | k r2 | j   d  S| j d d d  | j d |  | j   | j | |  | j | |  | j   | j	 d | d  d  S(   Ns   
R   s   1.0R_   R   (
   RF   Ra   R\  R   R  R   R-  R   R   R  (   R   Rk  Rl  R+  RW  RF   t   newchars(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyRV  }  s    	


c         C   s=   |  j  r1 t | |  j  \ } } d | d | Sd | Sd  S(   Ns   	R   (   R   R[  R   (   R   R   R\  R]  (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyRU    s    	c         C   sk   |  j  } | j   | j d d d  r; | j d d  n  | r] | j d |  j |   n  | j   d  S(   Ns   insert linestarts   !=R   (   RF   R   R   R-  R   RU  R   (   R   R  RF   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR2    s    	
c         C   s7   |  j  d d d |  j d |  j d d d d p6 |  j S(	   Ns	   Tab widths   Columns per tab? (2-16)RI  R`  R`  i   Ra  i   (   R   RF   R   R   (   R   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyRZ    s    		c         C   sr   t  |  j |  j  j   \ } } | r` | r` t | |  j  \ } } t | |  j  \ } } n
 d } } | | S(   Ni    (   t   IndentSearcherRF   R   R  R1  (   R   t   openert   indentedR3  t   indentsmallt   indentlarge(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR'    s    !
N(   s   files   _File(   s   edits   _Edit(   s   formatR  (   s   runR  (   s   optionss   _Options(   s   windowss   _Windows(   s   helps   _Help(   s   windowss   _Window(   R:  s   <<close-window>>(y   R#   t
   __module__t   idlelib.PercolatorR4   t   idlelib.ColorDelegatorR5   t   idlelib.UndoDelegatorR6   t   idlelib.IOBindingR7   R8   R9   Rj  R:   t   TkinterR;   t   idlelib.MultiStatusBarR<   R   R`   R   R   R   R   R   R  R$  R   Rg   R~   R   R4  R   R>  R5  R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   Ro  R   Rw  Rx  R   R|  R~  R   R  R  R  R   R+  R  R   R  R   R  R  R  R  R  R   Rn  R  R  R  R   R  R   R  R   R  R  R  R  R   R(  R  R  R	  R  R  R  R&  Rq  R   R   R   R   R:  R   R   R   R   R   R   R   R   RT  RV  RU  R2  RZ  R'  (    (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR3   D   s   			)				
															!									
		 			(									
													%							-	#	k												
			c         C   s   t  t |    S(   N(   R   R  (   R   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR0    s    c         C   st   d } } x] |  D]U } | d k r: | d } | d } q | d k re | d } | | d | } q Pq W| | f S(   Ni    R   i   s   	(    (   t   sR   R3  R4  t   ch(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR1    s    


Rc  c           B   s;   e  Z d    Z d   Z e j e j d
 d  Z d	   Z RS(   c         C   s6   | |  _  | |  _ d |  _ |  _ d  |  _ |  _ d  S(   Ni    (   RF   R   R  t   finishedR   t   blkopenlinet   indentedline(   R   RF   R   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR     s    		c         C   sd   |  j  r d S|  j d } |  _ t |  d } |  j j | d d  rM d S|  j j | | d  S(   NR^  i   s   .0s   >=R_   s    lineend+1c(   Rq  R  R  RF   R   R   (   R   R  R  (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyRs    s    	t   classt   deft   fort   ift   tryt   whilec	   	      C   s^   |  j  r nN | | k r0 | | k r0 | |  _ n* | | k rZ |  j rZ | |  _ d |  _  n  d  S(   Ni   (   Rq  Rr  Rs  (	   R   RV   t   tokent   startR_   R  t   INDENTt   NAMEt   OPENERS(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyt
   tokeneater  s    		c         C   sg   t  j } |  j t  _ z5 y t  j |  j |  j  Wn t  j k
 rH n XWd  | t  _ X|  j |  j f S(   N(	   t	   _tokenizet   tabsizeR   t   tokenizeRs  R  t
   TokenErrorRr  Rs  (   R   t   save_tabsize(    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR    s    	
(   s   classs   defs   fors   ifs   trys   while(	   R#   Rh  R   Rs  R  R|  R}  R  R  (    (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyRc    s   		
	c         C   s>   |  j  d  } | d k r4 |  |  |  | d }  n  | |  f S(   NR  i    i   (   RV  (   Ro  R  (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR%    s    t   [t   bracketleftt   ]t   bracketrightt   /t   slashc         C   s  |  j  |  } | s7 t j   r; | d d d h k r; d S| d } t j d d   |  } t j d d	   |  } t j d
 d |  } t j d d |  } t j d d |  } t j d d |  } t j d d |  } t j d d |  } t j d d |  } | S(   Ns   <<open-module>>s   <<goto-line>>s   <<change-indentwidth>>R^  i    s   -[a-z]\bc         S   s   |  j    j   S(   N(   t   groupt   upper(   R/   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyRP     s    s   \b\w+\bc         S   s   t  j |  j   |  j    S(   N(   t   keynamesR   R  (   R/   (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyRP     s    s   Key-t   Cancels
   Ctrl-Breaks   Control-s   Ctrl-R  t   +s   ><R   R   R   (   R   R   Rg   R  t   sub(   R  R=  R  Ro  (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyR    s"    
c         C   sF   |  j  } | j d d d  | j d d d  | j d d d  d  S(	   Nt   tcl_wordBreakAfters   a bi    R   t   tcl_wordcharss   [a-zA-Z0-9_]t   tcl_nonwordcharss   [^a-zA-Z0-9_](   R!  R"  (   Rk   R!  (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyt   fixwordbreaks(  s    	c          C   s   t    }  t |   |  j   t j d r: t j d } n d  } t d |  d |  } | j |  j  | j	 j
 d | j  |  j   |  j   d  S(   Ni   Rk   R,   s   <<close-all-windows>>(   t   TkR  t   withdrawR   t   argvR   R3   Rx  t   quitRF   R   R   t   mainloopR  (   Rk   R,   R  (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyt   test1  s    	


t   __main__((   R   R&   R  R   Rm  R   R   RL  t   idlelib.MultiCallR   Rj  R   R   R   R   R   R   t   idlelib.configHandlerR   R	   R
   R   R   R  R   R   R2   t   objectR3   R0  R1  R  R  Rc  R%  R  R  R  R  R#   (    (    (    s)   C:\RCS\Python\lib\idlelib\EditorWindow.pyt   <module>   sT   
	      y		2		
				