
]c           @   s  d  d l  Z  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 m Z m Z d  d l m Z d  d l m Z d Z d e j   Z d   Z e d  Z d e f d     YZ e   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d  d$ l- m. Z. e. e+  n  d S(%   iN(   t   *(   t   MultiCallCreator(   t
   WindowList(   t   SearchDialog(   t
   GrepDialog(   t   ReplaceDialog(   t   PyParse(   t   idleConf(   t   aboutDialogt   textViewt   configDialog(   t   macosxSupport(   t   helpi   s    (%s)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%   lib/python2.7/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%   lib/python2.7/idlelib/EditorWindow.pyt   _find_module'   s2    	
t
   HelpDialogc           B   s;   e  Z d    Z d d  Z d   Z d   Z d d  Z RS(   c         C   s   d  |  _ d  |  _ d  S(   N(   R   t   parentt   dlg(   t   self(    (    s%   lib/python2.7/idlelib/EditorWindow.pyt   __init__J   s    	c         C   s[   d d l  } | j d t d d |  j d k rA |  j |  n  | rW |  j |  n  d S(   s    Display the help dialog.

            parent - parent widget for the help window

            near - a Toplevel widget (e.g. EditorWindow or PyShell)
                   to use as a reference for placing the help window
        iNs   EditorWindow.HelpDialog is no longer used by Idle.
It will be removed in 3.6 or later.
It has been replaced by private help.HelpWindow
t
   stackleveli   (   t   warningst   warnt   DeprecationWarningR5   R   t   show_dialogt
   nearwindow(   R6   R4   t   neart   w(    (    s%   lib/python2.7/idlelib/EditorWindow.pyt   displayN   s    	c         C   sr   | |  _  t j j t j j t j j t   d  } t j | d | d t	 |  _
 } | j d |  j d  d  S(   Ns   help.txtt   Helpt   modals	   <Destroy>t   +(   R4   R&   R'   t   joint   abspatht   dirnameR%   R	   t	   view_filet   FalseR5   t   bindt   destroy(   R6   R4   t   fnR5   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR<   `   s    	-"c         C   s\   |  j  } | j   d | j   d f } | j   | j d |  | j   | j   d  S(   Ni
   s   =+%d+%d(   R5   t   winfo_rootxt   winfo_rootyt   withdrawt   geometryt	   deiconifyt   lift(   R6   R>   R5   t   geom(    (    s%   lib/python2.7/idlelib/EditorWindow.pyR=   f   s    	 

c         C   s   d  |  _ d  |  _ d  S(   N(   R   R5   R4   (   R6   t   ev(    (    s%   lib/python2.7/idlelib/EditorWindow.pyRJ   q   s    	N(   R#   t
   __module__R7   R   R@   R<   R=   RJ   (    (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR3   H   s
   			t   EditorWindowc           B   sk  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 d   Z d   Z d{ Z d   Z d g Z d!   Z  d"   Z! d#   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   Z0 d2   Z1 d3   Z2 d4   Z3 d5   Z4 d6   Z5 d{ d7  Z6 d{ d8  Z7 d{ d9  Z8 d:   Z9 d;   Z: d<   Z; d=   Z< d>   Z= d?   Z> d@   Z? dA   Z@ dB   ZA dC   ZB dD   ZC dE   ZD dF   ZE dG   ZF d{ dH  ZG dI   ZH dJ   ZI dK   ZJ dL   ZK dM   ZL dN   ZM dO   ZN dP   ZO dQ dR  ZP dS   ZQ dQ dT  ZR dU   ZS dV   ZT dW   ZU dX   ZV dY   ZW dZ   ZX d[   ZY d\   ZZ d]   Z[ d^   Z\ d{ d_  Z] d{ d{ d`  Z^ da   Z_ d{ db  Z` d{ dc  Za dd   Zb de   Zc df   Zd dg   Ze ef dh  Zg di   Zh dj   Zi dk   Zj dl   Zk dm   Zl dn   Zm do   Zn dp   Zo dq   Zp dr   Zq ds   Zr dt   Zs du   Zt dv   Zu dw   Zv dx   Zw dy   Zx dz   Zy RS(   i(   t
   Percolator(   t   ColorDelegator(   t   UndoDelegator(   t	   IOBindingt   filesystemencodingt   encoding(   t   Bindings(   t   Toplevel(   t   MultiStatusBarc         C   s	  t  j d  k rv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  } n} t j d  d
 k r t j j t j d d t    } t j j |  r| } qn* t j d k rt j j t j d  } n  t j j |  } t j j |  r_| t  _ t j d k rsd t  j t  _ qsqvd t j
 d  t  _ n  | |  _ | 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 d d |  _$ i d d 6d d 6d d 6d  d! 6|  j$ d 6t j# d d d" d d d" 6} t% d# k rd$ | d% <n  t& t'  |
 |  |  _( } |  j( |  j _) |  j*   |  j+   |  j j, d& |  j-  |  j j. d' |  j/  t0 j1   r| j. d' |  j/  | j. d( |  j2  | j. d) |  j2  n | j. d* |  j2  | j. d+ |  j3  | j. d, |  j4  | j. d- |  j5  | j. d. |  j6  | j. d/ |  j7  | j. d0 |  j8  | j. d1 |  j9  | j. d2 |  j:  | j. d3 |  j;  | j. d4 d5    | j. d6 |  j<  | j. d7 |  j=  | j. d8 |  j>  | j. d9 |  j?  | j. d: |  j@  | j. d; |  jA  | j. d< |  jB  | j. d= |  jC  | j. d> |  jD  | j. d? |  jE  | j. d@ |  jF  | j. dA |  jG  | j. dB |  jH  | j. dC |  jI  | j. dD |  jJ  | j. dE |  jK  | j. dF |  jL  | j. dG |  jM  | j. dH |  jN  | j. dI |  jO d    | j. dJ |  jO dK   | j. dL |  jP  | j. dM |  jQ  | j. dN |  jR  | r| | j |  <| rp|  | jS | <n  | j. dO |  jT  | j. dP |  j jU  | j. dQ |  jV  | j. dR |  jW  n  |  jX   | jY | dS <| jZ dT t[ dU t\  | j] | dV <t j^ |  j d d  | dW <|
 jZ dT t_ dU t` dX dK  | jZ dT ta dU t` dX dK  | jb   t j# d dY dZ d d[ } | |  _c d\ |  _d |  jd |  _e |  jf   tg |  _h dh |  _i |  jj |  |  _k } |  jl   |  _m } | jn |  | jo | _o | jp | _p | jq |  jr  |  js |   |  _t } | ju |  jv  t |  j d` d  |  _w |  jx da jy d db dc dd d  d |  jw |  jz   d  |  _{ | rt j j| |  rt j j |  r| j} |  q| j~ |  n  |  j   |  jr   |  j |  j |   |  j   |  jx j de  } | r	| j df  } | d  k rC	dg } n  | d  k rf	| j   | dK } 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.chmt   darwins0   Resources/English.lproj/Documentation/index.htmls   file://s   https://docs.python.org/%d.%d/i   s   >>> t   menus   recent-files.lstt   namet   vbart   mainRU   t   widtht   typet   intt   texti   t   padxt   nonet   wrapi    t   highlightthicknesst   heightg      !@t   wordprocessort   tabstylet   WM_DELETE_WINDOWs   <<close-window>>s   <Control-Button-1>s   <2>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%   lib/python2.7/idlelib/EditorWindow.pyt   <lambda>   t    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>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   fontt   expandt   Indents
   use-spacest   booli   i2   i  i@KL t   tearoffR*   t   labels   Recent Filest	   underlinet   windowst   endi(   i2   i  i@KL (   RU   t   help_urlR   R&   R'   RD   R   t   prefixt   platformt   countR   t   isdirR   t   isfilet   normpatht   flistt   roott   ps1R!   t   Menut   menubarR   t   ListedToplevelt   topt   varst   tkinter_varst   inversedictt   instance_dictR   t   GetUserCfgDirt   recent_files_patht   Framet
   text_framet	   ScrollbarRe   t	   GetOptionRg   t	   TkVersionR   t   TextRj   t   focused_widgett   createmenubart   apply_bindingst   protocolR   RI   t   close_eventR   t   isAquaTkt   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   GetFontt   LEFTt   BOTHt   TOPt	   focus_sett   usetabst   tabwidtht   indentwidtht   set_notabs_indentwidthRH   t   context_use_ps1t   num_context_linesRV   t   perRX   t   undot   insertfiltert   undo_block_startt   undo_block_stopt   set_saved_change_hookt   saved_change_hookRY   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(   R6   R   R,   t   keyR   t   dochomet   pyvert   basepatht   chmfileR   R   Re   t   text_optionsRj   t	   usespacesR   R   R   Rc   R   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR7      s4   					





	
		

	%


	
	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   decodeRZ   t   UnicodeDecodeErrorR[   (   R6   R,   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyt   _filename_to_unicode_  s    c         C   s)   |  j  j   \ } } |  j j |  d S(   NRs   (   R   t   defaultfilenameR   t   new(   R6   Rt   RF   t   basename(    (    s%   lib/python2.7/idlelib/EditorWindow.pyR   n  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   >Rs   (   R  s   	(   t   statet   keysymRj   R   t   compareRi   R   R   t   xranget   lent   strt
   tag_removet   mark_sett   tag_addt   see(   R6   Rt   t   insertptt   linet   lineatt   destt   firstt   last(    (    s%   lib/python2.7/idlelib/EditorWindow.pyR   s  s>    "(%	0c         C   s  |  j  |  j  |  _ t |  j d d d d d d } t j d k ra |  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 d	 t	 d t
  |  j j d |  j  |  j j d d d  |  j j |  j  d  S(   NRo   i   t   borderwidtht
   backgroundt   grey75Rb   t	   _padding1s       Rx   t   columns   Col: ?R  s   Ln: ?Ry   s   <<set-line-and-column>>s   <KeyRelease>s   <ButtonRelease>(   R^   R   t
   status_barR   R   R   t	   set_labelR   R   t   BOTTOMt   XRj   RI   t   set_line_and_columnt	   event_addt
   after_idle(   R6   t   sep(    (    s%   lib/python2.7/idlelib/EditorWindow.pyR     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(   Rj   R   t   INSERTR   R)  R*  (   R6   Rt   R  R(  (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR-    s    !R*   t   _Filet   editt   _Editt   formatt   F_ormatt   runt   _Runt   optionst   _OptionsR   t   _WindowR   t   _Helpc         C   s   |  j  } i  |  _ } xe |  j D]Z \ } } t |  \ } } t | d | d d | | <} | j d | d | d |  q  Wt j   r t | d d d d | d <} | j d d	 d |  n  |  j   |  j d
 j	 t
  |  _ |  j   d  S(   NRd   R   i    R   Rc   R   t   applet   applicationt   IDLER   (   R   R   t
   menu_specst   prepstrR   t   add_cascadeR   t
   isCarbonTkt
   fill_menusR   t   ENDt   base_helpmenu_lengtht   reset_help_menu_entries(   R6   t   mbarR   Rd   R   R   Rc   (    (    s%   lib/python2.7/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(   R6   Rc   R   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR     s    	c   	      C   s%  |  j  j d d | j | j f  |  j s9 |  j   n  |  j } | |  _ t j d  d k } | rz |  j  j	 d d  n  xr |  j
 D]g } y | \ } } } Wn t k
 r q n X| d  k r q n  t |  |    } | j | d | q W| j | j | j  | r!|  j  j	 d d  n  d  S(	   NR  s   @%d,%di   Ra   t   cursort   arrowR  t   ibeam(   Rj   R  t   xt   yt   rmenut
   make_rmenuRt   R   R   t   configt   rmenu_specst
   ValueErrorR   t   getattrt   entryconfiguret   tk_popupt   x_roott   y_root(	   R6   Rt   RP  t   iswint   itemR   t	   eventnamet   verify_stateR  (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR     s(    #			t   Closes   <<close-window>>c         C   s   t  |  j d d } xg |  j D]\ } | d | d } } | d  k	 rq |  j | d  } | j d | d |  q | j   q W| |  _ d  S(   NR   i    i   c         S   s   |  j  |  d  S(   N(   t   event_generate(   Rj   R\  (    (    s%   lib/python2.7/idlelib/EditorWindow.pyRw     s    R   Rw   (   R   Rj   RS  R   t   add_commandR   RP  (   R6   RP  R[  R   R\  Rw   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyRQ    s    c         C   s
   |  j    S(   N(   t   rmenu_check_copy(   R6   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyt   rmenu_check_cut  s    c         C   s=   y |  j  j d  } Wn t k
 r* d SX| r5 d Sd Sd  S(   Ns	   sel.firstt   disabledt   normal(   Rj   R   t   TclError(   R6   t   indx(    (    s%   lib/python2.7/idlelib/EditorWindow.pyRa    s
    c         C   s=   y  |  j  j j d |  j  d  Wn t k
 r4 d SXd Sd  S(   Ns   tk::GetSelectiont	   CLIPBOARDRc  Rd  (   Rj   t   tkt   callRe  (   R6   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyt   rmenu_check_paste  s
     c         C   s   t  j |  j d  d S(   s   Handle Help 'About IDLE' event.s
   About IDLEN(   R   t   AboutDialogR   (   R6   Rt   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR     s    c         C   s   t  j |  j d  d S(   s&   Handle Options 'Configure IDLE' event.t   SettingsN(   R
   t   ConfigDialogR   (   R6   Rt   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR     s    c         C   s/   |  j  r |  j  } n	 |  j } t j |  d S(   s   Handle Help 'IDLE Help' event.N(   R   R   R   t   show_idlehelp(   R6   Rt   R4   (    (    s%   lib/python2.7/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   Ra   t   titles   Document Start Failuret   messageR4   Rs   (   R   R   R&   t	   startfileR   t   WindowsErrorR   R   R  Rj   t
   webbrowsert   open(   R6   Rt   t   why(    (    s%   lib/python2.7/idlelib/EditorWindow.pyR   *  s    c         C   s   |  j  j d  d S(   Ns   <<Cut>>Rs   (   Rj   R_  (   R6   Rt   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR   5  s    c         C   s*   |  j  j d  s d  S|  j  j d  d S(   NR  s   <<Copy>>Rs   (   Rj   t
   tag_rangesR_  (   R6   Rt   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR   9  s    c         C   s$   |  j  j d  |  j  j d  d S(   Ns	   <<Paste>>R  Rs   (   Rj   R_  R  (   R6   Rt   (    (    s%   lib/python2.7/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  Rs   (   Rj   R  R  R  (   R6   Rt   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR   E  s    c         C   s*   |  j  j d d d  |  j  j d  d  S(   NR  s   1.0R   R  (   Rj   R  R  (   R6   Rt   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR   K  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  Re  (   Rt   (   t
   edge_indext   edges_tablet   self_text_indext   self_text_mark_set(    s%   lib/python2.7/idlelib/EditorWindow.pyt   move_at_edgeZ  s    
(   s   sel.first+1cs   sel.last-1c(   Rj   R   R  (   R6   Rw  R{  (    (   Rw  Rx  Ry  Rz  s%   lib/python2.7/idlelib/EditorWindow.pyR   O  s
    c         C   s   |  j  j d  d S(   Ns   <Meta-Delete>Rs   (   Rj   R_  (   R6   Rt   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR   c  s    c         C   s   |  j  j d  d S(   Ns   <Meta-d>Rs   (   Rj   R_  (   R6   Rt   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR   g  s    c         C   s   t  j |  j  d S(   NRs   (   R   t   findRj   (   R6   Rt   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR   k  s    c         C   s   t  j |  j  d S(   NRs   (   R   t
   find_againRj   (   R6   Rt   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR   o  s    c         C   s   t  j |  j  d S(   NRs   (   R   t   find_selectionRj   (   R6   Rt   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR   s  s    c         C   s    t  j |  j |  j |  j  d S(   NRs   (   R   t   grepRj   R   R   (   R6   Rt   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR   w  s    c         C   s   t  j |  j  d S(   NRs   (   R   t   replaceRj   (   R6   Rt   (    (    s%   lib/python2.7/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:R4   Rs   i    R  s   %d.0(   Rj   R   R   R   t   bellR  R  (   R6   Rt   Rj   t   lineno(    (    s%   lib/python2.7/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 |  | S(   Ns	   sel.firsts   sel.lastRv   t   ModulesA   Enter the name of a Python module
to search on sys.path and open:R4   t   initialvalues   Import errors   Unsupported types   %s is not a source module(   Rj   R   Re  t   stripR   t	   askstringR2   t	   NameErrorR"   R   R   R  R   R   R   R   Rt  R   R   (	   R6   Rt   Rd   t   ft	   file_patht   suffixt   modet   mtypet   msg(    (    s%   lib/python2.7/idlelib/EditorWindow.pyR     s6    
	"		c         C   s   |  j  j } |  j j d k o! | sC |  j   } | d  k rC d  Sn  t j j |  \ } } t j j	 |  \ } } d d l
 m } | j |  j | | g  d  S(   Nt   PyShellEditorWindowi(   t   ClassBrowser(   R   R,   t	   __class__R#   R   R   R&   R'   R   R(   t   idlelibR  R   (   R6   Rt   R,   t   headt   tailR0   R1   R  (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR     s    c         C   s$   d d l  m } | j |  j  d  S(   Ni(   t   PathBrowser(   R  R  R   (   R6   Rt   R  (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR     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   Rj   R  R  R  t   center(   R6   R  (    (    s%   lib/python2.7/idlelib/EditorWindow.pyt   gotoline  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'   R   t   TrueR(   R
  t   normcaseRt  t   readlineR   t   IOErrorRH   t
   startswithR|  (   R6   R,   R0   R1   R  R  (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR     s    $c         C   s)   |  j  r% |  j  j |   d  |  _  n  d  S(   N(   R   t   unregister_maybe_terminateR   (   R6   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyt
   close_hook  s    	c         C   s   | |  _  d  S(   N(   R  (   R6   R  (    (    s%   lib/python2.7/idlelib/EditorWindow.pyt   set_close_hook  s    c         C   sD   |  j  r |  j  j |   n  |  j   |  j j |   |  j   d  S(   N(   R   t   filename_changed_editR   R   t   update_windowlist_registryR   (   R6   (    (    s%   lib/python2.7/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,   RW   R   t   removefilterR   R   (   R6   (    (    s%   lib/python2.7/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   (   R6   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyt   _rmcolorizer  s
    	c         C   s   |  j    |  j   t j   } t j | d  } t j | d d d } t j | d  } |  j j d | d d | d d | d	 | d d
 | d  t d k r |  j j d | d  n  d S(   s   Update the color themeRd  RK  t   fgBgt   fgt   hilitet
   foregroundR%  t   insertbackgroundt   selectforegroundt   selectbackgroundg      !@t   inactiveselectbackgroundN(   R  R  R   t   CurrentThemet   GetHighlightRj   RR  R   (   R6   t   themet   normal_colorst   cursor_colort   select_colors(    (    s%   lib/python2.7/idlelib/EditorWindow.pyR     s    




c         C   s#   t  j |  j d d  |  j d <d S(   s.   Update the text widgets' font if it is changedRf   RU   R{   N(   R   R   R   Rj   (   R6   (    (    s%   lib/python2.7/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   itemsRj   t   event_deletet   get_standard_extension_namest   GetExtensionBindings(   R6   t   keydefsRt   t   keylistt   extensionNamet   xkeydefs(    (    s%   lib/python2.7/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 k rq n  | d 7} 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   Rw   t   acceleratorR   Rv   N(   R   R  R\   R  R   R  R  t   menudefsRA  R   t   keysR   RE  R   t   rangeRh   t	   entrycgett   get_acceleratort   entryconfig(   R6   R  R  R  t   menuEventDictRc   R[  t   menubarItemR   R   t   accelt   itemNameRt   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyt   ApplyKeybindings  s<    
/
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 windowRf   R}   s
   num-spacesRh   Ri   N(   R   R   R   R   (   R6   (    (    s%   lib/python2.7/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    Rw   N(
   R   t   GetAllExtraHelpSourcesListR   R   RE  RF  RI  R   t"   _EditorWindow__extra_help_callbackR`  (   R6   t	   help_listt   helpmenut   helpmenu_lengtht   entryt   cmd(    (    s%   lib/python2.7/idlelib/EditorWindow.pyRG  D  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   Ra   Ro  s   Document Start FailureRp  R4   (   R  R  (   R  R&   R'   R   R   R   Rq  Rr  R   R   R  Rj   Rs  Rt  (   t   helpfileRu  (   R6   (    s%   lib/python2.7/idlelib/EditorWindow.pyt   display_extra_helpW  s    (    (   R6   R  R  (    (   R6   s%   lib/python2.7/idlelib/EditorWindow.pyt   __extra_help_callbackU  s    c         C   sS  g  } t  j j |  j  rE t |  j d   } | j   } Wd QXn  | 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
 |  !} y, t |  j d   } | j |  Wd QXWn` t k
 r} t |  j d	 t  st |  j _ t j d
 d d d t |  d |  j  qn Xx |  j j j   D] }	 |	 j }
 |
 j d t  xl t |  D]^ \ } } | j   } |  j |  } |	 j |  } |
 j  d | | d | d | d d  qWqWd S(   s/   Load and update the recent files list and menust   rNs   
i    s    it   1234567890ABCDEFGHIJKR?   t   recentfilelist_error_displayedRo  s   IDLE WarningRp  s|   Cannot update File menu Recent Files list. Your operating system says:
%s
Select OK and IDLE will continue without updating.R4   R   R  Rw   R   (!   R&   R'   R   R   Rt  t	   readlinesRE   t   removeR  t   appendR  t
   writelinesR  RU  R   RH   R  R  R   t   showwarningR  Rj   R   R   R  R   RI  RE  t	   enumeratet   rstripR  t#   _EditorWindow__recent_file_callbackR`  (   R6   t   new_filet   rf_listt   rf_list_filet	   bad_pathsR'   t   ulcharst   rf_filet   errt   instanceRc   t   it	   file_namet
   ufile_namet   callback(    (    s%   lib/python2.7/idlelib/EditorWindow.pyR   d  sH    &%	c            s   |   f d  } | S(   Nc            s     j  j d |   d  S(   Nt   editFile(   R   Rt  (   t
   fn_closure(   R6   (    s%   lib/python2.7/idlelib/EditorWindow.pyt   open_recent_file  s    (    (   R6   R  R  (    (   R6   s%   lib/python2.7/idlelib/EditorWindow.pyt   __recent_file_callback  s    c         C   s   |  j    } |  j   } | r9 | r9 | d | t } n$ | rH | } n | rW | } n d } | pl | pl | } |  j   s d | } d | } n  |  j j |  |  j j |  d  S(   Ns    - t   Untitleds   *%s*s   *%s(   t   short_titlet
   long_titlet   _py_versiont	   get_savedR   t   wm_titlet   wm_iconname(   R6   t   shortt   longRo  t   icon(    (    s%   lib/python2.7/idlelib/EditorWindow.pyR     s    		
c         C   s   |  j  j   S(   N(   R   R  (   R6   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR    s    c         C   s   |  j  j |  d  S(   N(   R   t	   set_saved(   R6   t   flag(    (    s%   lib/python2.7/idlelib/EditorWindow.pyR    s    c         C   s   |  j  j   d  S(   N(   R   t
   reset_undo(   R6   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR     s    c         C   s:   |  j  j } | r' t j j |  } n d } |  j |  S(   NR  (   R   R,   R&   R'   R
  R  (   R6   R,   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR    s
    c         C   s   |  j  |  j j p d  S(   NRv   (   R  R   R,   (   R6   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR    s    c         C   s   |  j    d  S(   N(   R  (   R6   Rt   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR     s    R  c         C   sb   |  j  } |  j   \ } } |  j |  } | | } t d | | d  } | j t |   d  S(   Ni   i   (   Rj   t   getwindowlinest	   getlinenot   maxR   t   float(   R6   t   markRj   R   t   botR  Ro   t   newtop(    (    s%   lib/python2.7/idlelib/EditorWindow.pyR    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   Ro   (   Rj   R  t   winfo_heightRi   (   R6   Rj   R   R  Ro   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR    s    	c         C   s"   |  j  } t t | j |    S(   N(   Rj   Ri   R  R   (   R6   R  Rj   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR    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+)(   R   t   wm_geometryt   ret   matcht   mapRi   t   groups(   R6   RR   R/   t   tuple(    (    s%   lib/python2.7/idlelib/EditorWindow.pyt   get_geometry  s    c         C   s   |  j    d  S(   N(   R   (   R6   Rt   (    (    s%   lib/python2.7/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(   NRd  (   R   R  R   R  RP   t   lowerRQ   t	   maybesave(   R6   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR    s    	c         C   s/   |  j    } t |  d k r+ |  j   n  | S(   Nt   cancel(   R  R  t   _close(   R6   t   reply(    (    s%   lib/python2.7/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   RH   Rj   R   R   R   RJ   R  (   R6   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR    s"    
							c         C   s   i  |  _  |  j   d  S(   N(   t
   extensionst   load_standard_extensions(   R6   (    (    s%   lib/python2.7/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   (   R6   t   ins(    (    s%   lib/python2.7/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(   R6   Rd   R  (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR    s    c         C   s   t  j d t  S(   Nt   editor_only(   R   t   GetExtensionsR  (   R6   (    (    s%   lib/python2.7/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"   RU  R   R  R  RD  R  R  R   R  R  Rj   RI   (   R6   Rd   t   modt   clsR  R  t   veventt
   methodname(    (    s%   lib/python2.7/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  Rj   R  R  R.  (   R6   R  Rj   Rt   R  (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR   1  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_  (   Rj   R\  (    (    s%   lib/python2.7/idlelib/EditorWindow.pyRw   S  s    R   R   Rw   R  t   variableN(   R   R\   R  R  R   Rj   R   R   RA  R  t   get_var_objt
   BooleanVart   add_checkbuttonR`  (   R6   R  R  R   Rj   t   mnamet	   entrylistRc   R  R   R\  t   checkbuttonR   R  Rw   t   var(    (    s%   lib/python2.7/idlelib/EditorWindow.pyRD  :  s8    		
c         C   s2   |  j  |  } | r% | j   } | St |  d  S(   N(   R-  R   R  (   R6   Rd   R3  t   value(    (    s%   lib/python2.7/idlelib/EditorWindow.pyt   getvar_  s
    c         C   s5   |  j  | |  } | r( | j |  n	 t |  d  S(   N(   R-  R   R  (   R6   Rd   R4  t   vartypeR3  (    (    s%   lib/python2.7/idlelib/EditorWindow.pyt   setvarg  s    c         C   s@   |  j  j |  } | r< | r< | |  j  |  j  | <} n  | S(   N(   R   R   Rj   (   R6   Rd   R6  R3  (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR-  n  s    c         C   s<   |  j  r4 |  j j d |  p3 d |  j j |  k Sd Sd  S(   Nt   TODOt   STRINGi   (   R   Rj   t   tag_prevranget	   tag_names(   R6   t
   text_index(    (    s%   lib/python2.7/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(   Rj   R   Re  R   (   R6   R"  R#  (    (    s%   lib/python2.7/idlelib/EditorWindow.pyt   get_selection_indices  s    c         C   s   |  j  d p t } t |  S(   Nt   tabs(   Rj   t   TK_TABWIDTH_DEFAULTRi   (   R6   t   current(    (    s%   lib/python2.7/idlelib/EditorWindow.pyt   get_tabwidth  s    c         C   s^   |  j  } |  j   | k rZ | j j d d | d d | j d |  } | j d |  n  d  S(   NR{   t   measures
   -displayoft   nR?  (   Rj   RB  Rh  Ri  t   mastert	   configure(   R6   t   newtabwidthRj   t   pixels(    (    s%   lib/python2.7/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   RH   R   RI  (   R6   R   t   guessR  (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR     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 } |  j r't j j d  d }	 n d }	 d
 }
 x] | |	 k rFPn  | d  } |
 d }
 t | j	 |   } | | k s| d d	 k r6Pq6q6W| j   | j d |
 d  | | k  r| j d d | |  n  | j   d S(   NR  Rs   s   insert linestartRv   R  s   1.0s	   insert-1cis    	i    i   s   
s
   insert-%dcR  (   Rj   R>  RI  R  R   R  R  R   R  t
   expandtabst   AssertionErrorR   R   R   R   R   R   R  R   (   R6   Rt   Rj   R"  R#  t   charsR   t   havet   wantt   last_line_of_promptt   ncharsdeleted(    (    s%   lib/python2.7/idlelib/EditorWindow.pyR     sJ    	
		



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  Rs   (   Rj   R>  R   t
   index2lineR   RI  R  R   t
   classifywsR   R  t   reindent_toR   R   RL  R  R  R   (
   R6   Rt   Rj   R"  R#  R   t   rawt	   effectivet   padRD  (    (    s%   lib/python2.7/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!    nc | 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   
Rs   is   insert - %d charss   .0t   consoles   1.0s   bogus continuation type %r(-   Rj   R>  R   RI  R  R   R  R  R   R   R   RS  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_BRACKETRU  t   compute_bracket_indentt   C_BACKSLASHt   get_num_lines_in_stmtt   compute_backslash_indentRM  t   get_base_indent_stringt   is_block_openerR   t   is_block_closerR   R  R   (   R6   Rt   Rj   R"  R#  R  R  RD  t   indentRQ  t   lnoRO  t   contextt   startatt   startatindext   rawtextt   bodR  R  (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR     s    	

%
	c         C   s   | |  j  d  } | S(   Nc         S   s   | | d |   S(   Ns   +%dc(    (   t   offsett   _startindext   _icis(    (    s%   lib/python2.7/idlelib/EditorWindow.pyt   innerq  s    (   R=  (   R6   t
   startindexRu  (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR]  p  s    c   
      C   s   |  j    \ } } } } xm t t |   D]Y } | | } | r+ t | |  j  \ } }	 |	 |  j }	 |  j |	  | | | | <q+ q+ W|  j | | | |  d S(   NRs   (   t
   get_regionR  R  RT  R   R   t   _make_blankst
   set_region(
   R6   Rt   R  R  RN  t   linest   posR  RV  RW  (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR   v  s    
"c   
      C   s   |  j    \ } } } } xv t t |   D]b } | | } | r+ t | |  j  \ } }	 t |	 |  j d  }	 |  j |	  | | | | <q+ q+ W|  j | | | |  d S(   Ni    Rs   (	   Rw  R  R  RT  R   R  R   Rx  Ry  (
   R6   Rt   R  R  RN  Rz  R{  R  RV  RW  (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR     s    
"c         C   sk   |  j    \ } } } } x6 t t |  d  D] } | | } d | | | <q/ W|  j | | | |  d  S(   Ni   s   ##(   Rw  R  R  Ry  (   R6   Rt   R  R  RN  Rz  R{  R  (    (    s%   lib/python2.7/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   #(   Rw  R  R  Ry  (   R6   Rt   R  R  RN  Rz  R{  R  (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR     s    
c         C   s   |  j    \ } } } } |  j   } | d  k r4 d  Sxu t t |   D]a } | | } | rG t | |  \ }	 }
 t |
 |  \ } } d | d | | |	 | | <qG qG W|  j | | | |  d  S(   Ns   	R  (   Rw  t   _asktabwidthR   R  R  RT  t   divmodRy  (   R6   Rt   R  R  RN  Rz  R   R{  R  RV  RW  t   ntabst   nspaces(    (    s%   lib/python2.7/idlelib/EditorWindow.pyR     s     
%c         C   s   |  j    \ } } } } |  j   } | d  k r4 d  Sx1 t t |   D] } | | j |  | | <qG W|  j | | | |  d  S(   N(   Rw  R}  R   R  R  RL  Ry  (   R6   Rt   R  R  RN  Rz  R   R{  (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR     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 columnsR4   i   Rs   (   R  R  (   s   will bes
   remains at(   R   R   Rj   R   (   R6   Rt   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR     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)R4   R  t   minvaluei   t   maxvaluei   Rs   (   R   Rj   R   R   (   R6   Rt   R	  (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR     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   
(   Rj   R>  R   R   R   (   R6   Rj   R"  R#  R  R  RN  Rz  (    (    s%   lib/python2.7/idlelib/EditorWindow.pyRw    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  (
   Rj   RD   R  R  R  R   RI  R  R   R  (   R6   R  R  RN  Rz  Rj   t   newchars(    (    s%   lib/python2.7/idlelib/EditorWindow.pyRy    s    	


c         C   s=   |  j  r1 t | |  j  \ } } d | d | Sd | Sd  S(   Ns   	R  (   R   R~  R   (   R6   RD  R  R  (    (    s%   lib/python2.7/idlelib/EditorWindow.pyRx    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  (   Rj   R   R  RI  R  Rx  R   (   R6   R(  Rj   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyRU    s    	
c         C   s.   |  j  d d d |  j d |  j d d d d S(	   Ns	   Tab widths   Columns per tab? (2-16)R4   R  R  i   R  i   (   R   Rj   R   (   R6   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR}    s    		c         C   sr   t  |  j |  j  j   \ } } | r` | r` t | |  j  \ } } t | |  j  \ } } n
 d } } | | S(   Ni    (   t   IndentSearcherRj   R   R7  RT  (   R6   t   openert   indentedRV  t   indentsmallt   indentlarge(    (    s%   lib/python2.7/idlelib/EditorWindow.pyRJ    s    !
N(   R*   R2  (   R3  R4  (   R5  R6  (   R7  R8  (   R9  R:  (   R   R;  (   R   R<  (   R^  s   <<close-window>>N(z   R#   RT   t   idlelib.PercolatorRV   t   idlelib.ColorDelegatorRW   t   idlelib.UndoDelegatorRX   t   idlelib.IOBindingRY   RZ   R[   R  R\   t   TkinterR]   t   idlelib.MultiStatusBarR^   R   R   R7   R  R   R   R   R-  R@  R   R   RP  R   RS  RQ  Rb  Ra  Rj  R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R  R   R  R  R   R  R  R   R  R  R  R   RG  R  R   R  R   R  R  R   R  R  R   R  R  R  R  R   R  R   R  R   R  R  R  R  R   RD  R5  R7  R-  R=  R>  RB  RI  R  R   R   R   R   R]  R   R   R   R   R   R   R   R   Rw  Ry  Rx  RU  R}  RJ  (    (    (    s%   lib/python2.7/idlelib/EditorWindow.pyRU   x   s   			)				
																			"											$			,										
													%							0	#	k												
			c         C   s   t  t |    S(   N(   Ri   R  (   R   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyRS    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   RV  RW  t   ch(    (    s%   lib/python2.7/idlelib/EditorWindow.pyRT  &  s    


R  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    (   Rj   R   R  t   finishedR   t   blkopenlinet   indentedline(   R6   Rj   R   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR7   >  s    		c         C   sd   |  j  r d S|  j d } |  _ t |  d } |  j j | d d  rM d S|  j j | | d  S(   NRv   i   s   .0s   >=R   s    lineend+1c(   R  R  R  Rj   R  R   (   R6   R  R  (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR  D  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   (   R  R  R  (	   R6   Rh   t   tokent   startR   R  t   INDENTt   NAMEt   OPENERS(    (    s%   lib/python2.7/idlelib/EditorWindow.pyt
   tokeneaterM  s    		c         C   sm   t  j } |  j t  _ z; y t  j |  j |  j  Wn t  j t f k
 rN n XWd  | t  _ X|  j |  j	 f S(   N(
   t	   _tokenizet   tabsizeR   t   tokenizeR  R  t
   TokenErrort   SyntaxErrorR  R  (   R6   t   save_tabsize(    (    s%   lib/python2.7/idlelib/EditorWindow.pyR7  Y  s    	
(   R  R  R  R  R  R  (	   R#   RT   R7   R  R  R  R  R  R7  (    (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR  7  s   		
	c         C   s>   |  j  d  } | d k r4 |  |  |  | d }  n  | |  f S(   NR#  i    i   (   R|  (   R  R  (    (    s%   lib/python2.7/idlelib/EditorWindow.pyRA  i  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>>Rv   i    s   -[a-z]\bc         S   s   |  j    j   S(   N(   t   groupt   upper(   R/   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyRu     Rv   s   \b\w+\bc         S   s   t  j |  j   |  j    S(   N(   t   keynamesR   R  (   R/   (    (    s%   lib/python2.7/idlelib/EditorWindow.pyRu     Rv   s   Key-t   Cancels
   Ctrl-Breaks   Control-s   Ctrl-R"  RC   s   ><R  R  R  (   R   R   t	   isCocoaTkR
  t   sub(   R  R\  R  R  (    (    s%   lib/python2.7/idlelib/EditorWindow.pyR  x  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_](   Rh  Ri  (   R   Rh  (    (    s%   lib/python2.7/idlelib/EditorWindow.pyt   fixwordbreaks  s    	c         C   sr   |  } t  |  t j d r- t j d } n d  } t j | d   t d | d |  } | j j d | j	  d  S(   Ni   R   R,   s   <<close-all-windows>>(
   R  R   t   argvR   R   t   setupAppRU   Rj   RI   R   (   R4   R   R,   R3  (    (    s%   lib/python2.7/idlelib/EditorWindow.pyt   _editor_window  s    
t   __main__(   R7  (/   R   R&   R   R
  R   R  R   R   Rs  t   idlelib.MultiCallR   R  R   R   R   R   R   t   idlelib.configHandlerR   R   R	   R
   R   R   R@  t   python_versionR  R   R   R2   t   objectR3   t
   helpDialogRU   RS  RT  R  R  R  RA  R  R  R  R  R#   t   idlelib.idle_test.htestR7  (    (    (    s%   lib/python2.7/idlelib/EditorWindow.pyt   <module>   s^   
	!-	     		2		
				