
|Nc           @   s  d  Z  d d l Td d l Z d 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 e f d     YZ e d k re   Z e e d d d d   j   i  e _ e j   n  d S(   s  IDLE Configuration Dialog: support user customization of IDLE by GUI

Customize font faces, sizes, and colorization attributes.  Set indentation
defaults.  Customize keybindings.  Colorization and keybindings can be
saved as user defined sets.  Select startup options including shell/editor
and default window size.  Define additional help sources.

Note that tab width in IDLE is currently fixed at eight due to Tk issues.
Refer to comments in EditorWindow autoindent code for details.

i(   t   *N(   t   idleConf(   t   DynOptionMenu(   t   TabbedPageSet(   t   GetKeysDialog(   t   GetCfgSectionNameDialog(   t   GetHelpSourceDialog(   t   macosxSupportt   ConfigDialogc           B   s  e  Z d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z  d   Z! d    Z" d!   Z# d"   Z$ d#   Z% d$   Z& d%   Z' d&   Z( d'   Z) d(   Z* d)   Z+ d*   Z, d+   Z- d,   Z. dH d-  Z0 d.   Z1 d/   Z2 d0   Z3 d1   Z4 d2   Z5 d3   Z6 d4   Z7 d5   Z8 d6   Z9 d7   Z: d8   Z; d9   Z< d:   Z= d;   Z> d<   Z? d=   Z@ d>   ZA d?   ZB d@   ZC dA   ZD dB   ZE dC   ZF dD   ZG dE   ZH dF   ZI dG   ZJ RS(I   c         C   s\  t  j |  |  |  j   |  j d d  |  j d  |  j d | j   d | j   d f  i d1 d	 6d2 d 6d3 d 6d4 d 6d5 d 6d6 d 6d7 d 6d8 d 6d9 d! 6d: d$ 6d; d' 6d< d* 6d= d- 6|  _ |  j	   |  j
   |  j d. t d/ t  |  j |  |  j   |  j d0 |  j  | |  _ |  j j   |  j   |  j   |  j   |  j   d  S(>   Nt   borderwidthi   s   IDLE Preferencess   +%d+%di   i   t   normalt   00s   Normal Textt   keywordt   01s   Python Keywordst
   definitiont   02s   Python Definitionst   builtint   03s   Python Builtinst   commentt   04s   Python Commentst   stringt   05s   Python Stringst   hilitet   06s   Selected Textt   hitt   07s
   Found Textt   cursort   08t   Cursort   errort   09s
   Error Textt   consolet   10s   Shell Normal Textt   stdoutt   11s   Shell Stdout Textt   stderrt   12s   Shell Stderr Textt   heightt   widtht   WM_DELETE_WINDOW(   s   normalR   (   s   keywordR   (   R   R   (   R   R   (   R   R   (   s   stringR   (   s   hiliteR   (   s   hitR   (   s   cursorR   (   s   errorR   (   s   consoleR    (   s   stdoutR"   (   s   stderrR$   (   t   Toplevelt   __init__t   wm_withdrawt	   configuret   titlet   geometryt   winfo_rootxt   winfo_rootyt   themeElementst   ResetChangedItemst   CreateWidgetst	   resizablet   FALSEt	   transientt   grab_sett   protocolt   Cancelt   parentt   tabPagest	   focus_sett   LoadConfigst   AttachVarCallbackst   wm_deiconifyt   wait_window(   t   selfR9   R,   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR)      s>    




	


c      	   C   s  t  |  d d d d d g |  _ t |  d d } t j   rH i  } n i d d	 6d
 d 6} t | d d d |  j d t | |  _ t | d d d |  j	 d t | |  _
 t | d d d |  j d t | |  _ t | d d d |  j d t | |  _ |  j   |  j   |  j   |  j   |  j j d t d	 d  |  j
 j d t d	 d  |  j j d t d	 d  |  j j d t d	 d  | j d t  t |  d d d d j d t  |  j j d t d t d t  d  S(   Nt
   page_namess
   Fonts/Tabst   Highlightingt   Keyst   Generalt   padyi   i   t   padxi   t   textt   Helpt   commandt	   takefocust   Okt   ApplyR8   t   sidei   R%   R	   i    t   expandt   fill(   R   R:   t   FrameR   t   runningAsOSXAppt   ButtonRH   R4   t
   buttonHelpRK   t   buttonOkRL   t   buttonApplyR8   t   buttonCancelt   CreatePageFontTabt   CreatePageHighlightt   CreatePageKeyst   CreatePageGeneralt   packt   RIGHTt   LEFTt   BOTTOMt   TOPt   TRUEt   BOTH(   R@   t   frameActionButtonst   paddingArgs(    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR2   E   s:    		



"c         C   s  t  |   |  _ t |   |  _ t  |   |  _ t |   |  _ t j |  d+  |  _	 |  j
 j d j } t | d d d t d d	 } t | d d d t d d
 } t |  } t |  } t | d t d d } t | d d d t d t |  _ |  j j d |  j  t |  } | j d |  j j  |  j j d | j  t | d d } t | |  j d  d |  j |  _ t | d |  j d d d d d d d |  j }	 t | d t  d d }
 t |
 d d d t d |  j	 |  _! t |  } t | d t d d } t" | d |  j d d d  d d! d d" d# |  _# | j$ d$ t d% d d& d d' t% d( t&  | j$ d$ t d% d d& d d( t'  | j$ d$ t( d% d d& d d( t)  | j$ d$ t( d% d d& d d( t)  | j$ d$ t( d) t*  |  j j$ d$ t d' t% d( t)  | j$ d$ t d( t'  | j$ d$ t d) t*  |  j j$ d$ t d) t*  |	 j$ d$ t d) t* d% d*  |
 j$ d$ t( d% d d& d d' t% d( t&  |  j! j$ d' t% d( t&  | j$ d$ t( d( t)  | j$ d$ t( d) t* d% d  |  j# j$ d$ t( d% d d( t)  | S(,   Nt   courieri
   R
   s
   Fonts/TabsR	   i   t   reliefRG   s    Base Editor Font s    Indentation Width t   justifys   Font Face :R%   i   RJ   t   exportselections   <ButtonRelease-1>RI   t   yscrollcommands   Size :t   variablet   onvaluei   t   offvaluei    t   Bolds,   AaBbCcDdEe
FfGgHhIiJjK
1234567890
#:+=(){}[]t   fonts   Python Standard: 4 Spaces!t   orientt
   horizontalt   tickintervalt   from_t   toi   RM   RF   RE   RN   RO   t   anchori   (   s   courieri
   s   normal(+   t	   StringVart   fontSizet
   BooleanVart   fontBoldt   fontNamet   IntVart   spaceNumt   tkFontt   Fontt   editFontR:   t   pagest   framet
   LabelFramet   GROOVERP   t   LabelR]   t   ListboxR4   t   listFontNamet   bindt   OnListFontButtonReleaset	   Scrollbart   configt   yviewt   setR   t   Nonet   SetFontSamplet   optMenuFontSizet   Checkbuttont   SOLIDt   labelFontSamplet   Scalet   scaleSpaceNumR[   R`   Ra   t   YR_   t   Xt   W(   R@   R   t	   frameFontt   frameIndentt   frameFontNamet   frameFontParamt   labelFontNameTitlet
   scrollFontt   labelFontSizeTitlet   checkFontBoldt   frameFontSamplet   frameIndentSizet   labelSpaceNumTitle(    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyRW   i   sf    					("""(c          C   s  t  |   |  _ t  |   |  _ t |   |  _ t  |   |  _ t  |   |  _ t |   |  _ t  |   |  _ |  j	 j
 d j } t | d d d t d d } t | d d d t d d } t | d t d d d	 dW d d d d d d d t d d d t 	|  _ |  j } | j d d    | j d d    dX dY dZ d[ d\ d] d^ d_ d` da db dc dd de df dg dh di dj dk dl dm dn do dp dq dr ds dt du dv f } x) | D]! } | j t | d | d  qWx; |  j j   D]* } | j |  j | d d? | d@   qW| j dA t  t | d t d d |  _ t |  } t |  j d dB dC |  j d d }	 t |  j |  j d  d d |  _! t" | dD |  j dE d d dF dC |  j# |  _$ t" | dD |  j dE d d dG dC |  j# |  _% |  j j& d  t | d dH dC |  j' }
 t( | d dI } t" | dD |  j dE d dC |  j) d dJ |  _* t" | dD |  j dE d dC |  j) d dK |  _+ t | |  j d  dC d  |  _, t | |  j d  dC d  |  _- t | d dL dC |  j. |  _/ | j0 dM t1 dN dO dP dO dQ t2 dR t3  | j0 dM t1 dN dO dP dO dR t4  |  j j0 dM t5 dN dO dP dO dQ t2 dR t6  | j0 dM t5 dN dO dP d  |  j j0 dM t5 dN dO dP dO dQ t2 dR t3  |	 j0 dM t5 dQ t2 dR t6 dN dS dP dT  |  j! j0 dM t5 dQ t2 dR t6 dN dS dP dU  |  j$ j0 dM t1 dV t7  |  j% j0 dM t8 dV t9  |
 j0 dM t: dR t6 dN dO dP dO  | j0 dM t5 dV t9 dN dO dP dO  |  j* j0 dM t5 dV t9 dN dO  |  j+ j0 dM t5 dV t9 dN dO dP d  |  j, j0 dM t5 dR t6 dN dO dP dO  |  j- j0 dM t5 dR t6 dV t9 dN dO dP dO  |  j/ j0 dM t5 dR t6 dN dO dP dO  | S(w   NRB   R	   i   Re   RG   s    Custom Highlighting s    Highlighting Theme i   Rm   Rd   i   t    R   t   hand2R&   i   R%   i
   RJ   t   highlightthicknessi    t   wraps   <Double-Button-1>c         S   s   d S(   Nt   break(    (   t   e(    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyt   <lambda>   s    s   <B1-Motion>c         S   s   d S(   NR   (    (   R   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR      s    s   #you can click hereR   s   
R
   s   #to choose itemst   defR   t    t   funcR   s   (param):s   
  s   """string"""R   s
   
  var0 = s   'string's
   
  var1 = s
   'selected'R   s
   
  var2 = s   'found'R   s
   
  var3 = t   listR   t   (R   s   )

s    error R   s   cursor |s   
 t   shellR   R!   R#   s   <ButtonPress-1>c         S   s   |  j  j   j j |  S(   N(   t   widgett   winfo_toplevelt   highlightTargetR   (   t   eventt   elem(    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR      s   t   states   Choose Colour for :RI   Ri   t   valuet
   Foregroundt
   Backgrounds   Save as New Custom Themes	   Select : s   a Built-in Themes   a Custom Themes   Delete Custom ThemeRM   RF   i   RE   RN   RO   i   i   i   Rs   (   s   courieri   R   (   s   #you can click heres   comment(   s   
s   normal(   s   #to choose itemss   comment(   s   
s   normal(   s   defs   keyword(   R   s   normal(   s   funcs
   definition(   s   (param):s   normal(   s   
  s   normal(   s   """string"""s   string(   s
   
  var0 = s   normal(   s   'string's   string(   s
   
  var1 = s   normal(   s
   'selected's   hilite(   s
   
  var2 = s   normal(   s   'found's   hit(   s
   
  var3 = s   normal(   s   lists   builtin(   R   s   normal(   s   Nones   builtin(   s   )

s   normal(   s    error s   error(   R   s   normal(   s   cursor |R   (   s   
 s   normal(   s   shells   console(   R   s   normal(   s   stdouts   stdout(   R   s   normal(   s   stderrs   stderr(   s   
s   normal(;   Rt   t   builtinThemet   customThemeRv   t   fgHilitet   colourRx   t   themeIsBuiltinR   R:   R~   R   R   R   t   TextR   R4   t   NONEt   textHighlightSampleR   t   insertt   ENDR0   t   keyst   tag_bindR   t   DISABLEDRP   t   frameColourSetRR   t	   GetColourR   R   t   optMenuHighlightTargett   Radiobuttont   SetColourSampleBindingt   radioFgt   radioBgR   t   SaveAsNewThemeR   t   SetThemeTypet   radioThemeBuiltint   radioThemeCustomt   optMenuThemeBuiltint   optMenuThemeCustomt   DeleteCustomThemet   buttonDeleteCustomThemeR[   R]   R`   Ra   R   R_   R   t   ER\   R   R^   (   R@   R   t   frameCustomt
   frameThemeRG   t   textAndTagst   txTat   elementt	   frameFgBgt   buttonSetColourt   buttonSaveCustomThemet   labelTypeTitle(    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyRX      s    											("+$(+""%%+%c         C   s  t  |   |  _ t  |   |  _ t  |   |  _ t |   |  _ t  |   |  _ |  j j d j	 } t
 | d d d t d d } t
 | d d d t d d } t |  } t | d d } t |  } t | d	 t } t | d
 t d t |  _ |  j j d |  j  | j d |  j j  | j d |  j j  |  j j d | j  |  j j d | j  t | d d d |  j d t |  _ g  t d  D]$ } t | d d d d d d ^ q}	 t |	 d d |  j d d d |  j d d |  _  t |	 d d |  j d d d |  j d d |  _! t" |	 d |  j d  d d  |  _$ t" |	 d |  j d  d d  |  _% t |	 d d d d |  j& |  _' t |	 d d d d |  j( }
 | j) d t* d d d d d t+ d t,  | j) d t* d d d d d t,  |  j j) d t* d t- d d d d  | j) d t. d d d d d t+ d t,  | j/ d d  d | j0 d d  d | j1 d! d d" d d# d d$ t2  |  j j1 d! d d" d d$ t3  | j1 d! d d" d d$ t4  | j1 d! d d" d d$ t5  |  j  j1 d! d d" d d$ t2 t4  |  j! j1 d! d d" d d$ t2 t4  |  j$ j1 d! d d" d d$ t3  |  j% j1 d! d d" d d$ t3  |  j' j) d t. d t- d t6 d d  |
 j) d t. d t- d t6 d d  |	 d j) d t7 d t, d t6  |	 d j) d t7 d t- d t6 d d  | S(%   NRC   R	   i   Re   RG   s    Custom Key Bindings s	    Key Set s   Action - Key(s)Rn   RJ   Rg   s   <ButtonRelease-1>RI   Rh   t   xscrollcommands   Get New Keys for SelectionR   RF   RE   i    Ri   R   i   s   Use a Built-in Key Sets   Use a Custom Key Sets   Delete Custom Key Sets   Save as New Custom Key SetRM   i   RN   RO   t   weightt   rowt   columnt
   columnspant   sticky(8   Rt   t   bindingTargett   builtinKeyst
   customKeysRv   t   keysAreBuiltint
   keyBindingR:   R~   R   R   R   RP   R   R   t
   HORIZONTALR   R4   t   listBindingsR   t   KeyBindingSelectedR   R   t   xviewR   RR   t
   GetNewKeysR   t   buttonNewKeyst   rangeR   t   SetKeysTypet   radioKeysBuiltint   radioKeysCustomR   R   t   optMenuKeysBuiltint   optMenuKeysCustomt   DeleteCustomKeyst   buttonDeleteCustomKeyst   SaveAsNewKeySetR[   R^   R`   Ra   R   R]   t   columnconfiguret   rowconfiguret   gridR   t   NSEWt   NSt   EWt   TrueR_   (   R@   R   R   t   frameKeySetst   frameTargett   labelTargetTitlet   scrollTargetYt   scrollTargetXt   it   framest   buttonSaveCustomKeys(    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyRY     sp    		4

("%("##%" &c         C   s  t  |   |  _ t  |   |  _ t  |   |  _ t |   |  _ t |   |  _ t  |   |  _ t |   |  _	 t  |   |  _
 |  j j d j } t | d d d t d d } t | d d d t d d } t | d d d t } t | d d d t } t | d d d t } t | d d d t d d } t | d d	 } t | d
 |  j d d d |  j d d }	 t | d
 |  j d d d |  j d d }
 t | d d } t | d
 |  j d d d |  j d d } t | d
 |  j d d d |  j d d } t | d d d } t | d d } t | d |  j d d } t | d d } t | d |  j d d } t | d d d } t | d |  j d d } t | d d } t | d
 |  j d d d d } t | d
 |  j d d  d d! } t | d
 |  j d d" d d# } t |  } t |  } t |  } t | d$ d% d& t d' t |  _ | j d |  j j  |  j j d( | j  |  j j d) |  j  t | d d* d+ t d d, d |  j  |  _! t | d d- d d, d |  j" |  _# t | d d. d+ t d d, d |  j$ |  _% | j& d/ t' d0 d% d1 d% d2 t(  | j& d/ t' d0 d% d1 d% d2 t(  | j& d/ t' d0 d% d1 d% d2 t(  | j& d/ t' d0 d% d1 d% d2 t(  | j& d/ t' d0 d% d1 d% d2 t(  | j& d/ t' d0 d% d1 d% d3 t) d2 t*  | j& d/ t+ d4 t, d0 d% d1 d%  |
 j& d/ t- d4 t, d0 d% d1 d%  |	 j& d/ t- d4 t, d0 d% d1 d%  | j& d/ t+ d4 t, d0 d% d1 d%  | j& d/ t- d4 t, d0 d% d1 d%  | j& d/ t- d4 t, d0 d% d1 d%  | j& d/ t+ d4 t, d0 d% d1 d%  | j& d/ t- d4 t. d0 d5 d1 d%  | j& d/ t- d4 t. d1 d%  | j& d/ t- d4 t. d0 d5 d1 d%  | j& d/ t- d4 t. d1 d%  | j& d/ t+ d4 t, d0 d% d1 d%  | j& d/ t- d4 t. d0 d5 d1 d%  | j& d/ t+ d4 t, d0 d% d1 d%  | j& d/ t- d4 t. d1 d%  | j& d/ t- d4 t. d1 d%  | j& d/ t- d4 t. d1 d%  | j& d/ t- d0 d% d1 d% d2 t/  | j& d/ t' d0 d% d1 d% d3 t) d2 t*  | j& d/ t- d4 t, d2 t/  |  j j& d/ t+ d4 t. d3 t) d2 t*  |  j! j& d/ t' d4 t, d1 d%  |  j# j& d/ t' d4 t,  |  j% j& d/ t' d4 t, d1 d%  | S(6   NRD   R	   i   Re   RG   s    Startup Preferences s    Autosave Preferences s    Additional Help Sources s
   At StartupRi   R   i   RI   s   Open Edit Windowi    s   Open Shell Windows   At Start of Run (F5)  s   Prompt to Saves	   No Prompts   Initial Window Sizes     (in characters)t   Widtht   textvariableR&   i   t   Heights   Paragraph reformats    width (in characters)s   Default Source Encodingt   locales   Locale-defineds   utf-8s   UTF-8t   noneR   R%   i   RJ   Rg   Rh   s   <ButtonRelease-1>t   EditR   i   t   Addt   RemoveRM   RF   RE   RO   RN   Rs   i
   (0   Rt   t   winWidtht	   winHeightt	   paraWidthRy   t   startupEditt   autoSavet   encodingRv   t   userHelpBrowsert   helpBrowserR:   R~   R   R   R   RP   R   R   R   t   EntryR   R   R4   t   listHelpR   R   R   R   t   HelpSourceSelectedRR   R   t   HelpListItemEditt   buttonHelpListEditt   HelpListItemAddt   buttonHelpListAddt   HelpListItemRemovet   buttonHelpListRemoveR[   R_   R   R`   Ra   R]   R   R\   R   R   (   R@   R   t   frameRunt	   frameSavet   frameWinSizet   frameParaSizet   frameEncodingt	   frameHelpt   labelRunChoiceTitlet   radioStartupEditt   radioStartupShellt   labelRunSaveTitlet   radioSaveAskt   radioSaveAutot   labelWinSizeTitlet   labelWinWidthTitlet   entryWinWidtht   labelWinHeightTitlet   entryWinHeightt   labelParaWidthTitlet   entryParaWidtht   labelEncodingTitlet   radioEncLocalet   radioEncUTF8t   radioEncNonet   frameHelpListt   frameHelpListButtonst   scrollHelpList(    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyRZ   F  s    			
		
	"""""("""""""""""""(%c         C   s  |  j  j d |  j  |  j j d |  j  |  j j d |  j  |  j j d |  j  |  j	 j d |  j
  |  j j d |  j  |  j j d |  j  |  j j d |  j  |  j j d |  j  |  j j d |  j  |  j j d |  j  |  j j d |  j  |  j j d |  j  |  j j d |  j  |  j j d |  j  |  j j d |  j   |  j! j d |  j"  |  j# j d |  j$  |  j% j d |  j&  d  S(   Nt   w('   Ru   t   trace_variablet   VarChanged_fontSizeRx   t   VarChanged_fontNameRw   t   VarChanged_fontBoldRz   t   VarChanged_spaceNumR   t   VarChanged_colourR   t   VarChanged_builtinThemeR   t   VarChanged_customThemeR   t   VarChanged_themeIsBuiltinR   t   VarChanged_highlightTargetR   t   VarChanged_keyBindingR   t   VarChanged_builtinKeysR   t   VarChanged_customKeysR   t   VarChanged_keysAreBuiltinR  t   VarChanged_winWidthR  t   VarChanged_winHeightR  t   VarChanged_paraWidthR  t   VarChanged_startupEditR  t   VarChanged_autoSaveR  t   VarChanged_encoding(   R@   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR=     s&    c         G   s)   |  j  j   } |  j d d d |  d  S(   Nt   maint   EditorWindows	   font-size(   Ru   t   gett   AddChangedItem(   R@   t   paramsR   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR;    s    c         G   s)   |  j  j   } |  j d d d |  d  S(   NRN  RO  Rm   (   Rx   RP  RQ  (   R@   RR  R   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR<    s    c         G   s)   |  j  j   } |  j d d d |  d  S(   NRN  RO  s	   font-bold(   Rw   RP  RQ  (   R@   RR  R   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR=    s    c         G   s)   |  j  j   } |  j d d d |  d  S(   NRN  t   Indents
   num-spaces(   Rz   RP  RQ  (   R@   RR  R   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR>    s    c         G   s   |  j    d  S(   N(   t   OnNewColourSet(   R@   RR  (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR?    s    c         G   s3   |  j  j   } |  j d d d |  |  j   d  S(   NRN  t   Themet   name(   R   RP  RQ  t   PaintThemeSample(   R@   RR  R   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR@    s    c         G   sB   |  j  j   } | d k r> |  j d d d |  |  j   n  d  S(   Ns   - no custom themes -RN  RU  RV  (   R   RP  RQ  RW  (   R@   RR  R   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyRA    s    c         G   sF   |  j  j   } |  j d d d |  | r8 |  j   n
 |  j   d  S(   NRN  RU  t   default(   R   RP  RQ  R@  RA  (   R@   RR  R   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyRB    s
    c         G   s   |  j    d  S(   N(   t   SetHighlightTarget(   R@   RR  (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyRC    s    c         G   s   |  j  j   } |  j j   } |  j j t  j   d } t j |  rb |  j d | | |  n/ t j	 |  } | d } |  j d | | |  d  S(   Ni    R   t   _cfgBindingst
   extensions(
   R   RP  R   R   t   ANCHORt   splitR   t   IsCoreBindingRQ  t   GetExtnNameForEvent(   R@   RR  R   t   keySetR   t   extNamet   extKeybindSection(    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyRD    s    
c         G   s6   |  j  j   } |  j d d d |  |  j |  d  S(   NRN  RC   RV  (   R   RP  RQ  t   LoadKeysList(   R@   RR  R   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyRE     s    c         G   sE   |  j  j   } | d k rA |  j d d d |  |  j |  n  d  S(   Ns   - no custom keys -RN  RC   RV  (   R   RP  RQ  Rc  (   R@   RR  R   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyRF    s    c         G   sF   |  j  j   } |  j d d d |  | r8 |  j   n
 |  j   d  S(   NRN  RC   RX  (   R   RP  RQ  RE  RF  (   R@   RR  R   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyRG    s
    c         G   s)   |  j  j   } |  j d d d |  d  S(   NRN  RO  R&   (   R  RP  RQ  (   R@   RR  R   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyRH    s    c         G   s)   |  j  j   } |  j d d d |  d  S(   NRN  RO  R%   (   R  RP  RQ  (   R@   RR  R   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyRI    s    c         G   s)   |  j  j   } |  j d d d |  d  S(   NRN  t   FormatParagrapht	   paragraph(   R  RP  RQ  (   R@   RR  R   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyRJ    s    c         G   s)   |  j  j   } |  j d d d |  d  S(   NRN  RD   s   editor-on-startup(   R  RP  RQ  (   R@   RR  R   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyRK    s    c         G   s)   |  j  j   } |  j d d d |  d  S(   NRN  RD   t   autosave(   R  RP  RQ  (   R@   RR  R   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyRL  #  s    c         G   s)   |  j  j   } |  j d d d |  d  S(   NRN  RO  R  (   R  RP  RQ  (   R@   RR  R   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyRM  '  s    c         C   s)   i i  d 6i  d 6i  d 6i  d 6|  _  d  S(   NRN  t	   highlightR   R[  (   t   changedItems(   R@   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR1   +  s    c         C   sL   t  |  } | |  j | k r3 i  |  j | | <n  | |  j | | | <d  S(   N(   t   strRh  (   R@   t   typet   sectiont   itemR   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyRQ  3  s    c         C   s   i i  d 6i  d 6i  d 6i  d 6} x | j    D] } t j d |  } xh | D]` } i  | | | <t j | j |  } x3 | D]+ } t j | j | |  | | | | <q WqN Wq/ W| S(   NRN  Rg  R   R[  RX  (   R   R   t   GetSectionListt
   defaultCfgt   GetOptionListt   Get(   R@   t   dItemst
   configTypet   sectionsRk  t   optionst   option(    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyt   GetDefaultItems9  s    "1c         C   s   |  j  j   rK |  j j d t  |  j j d t  |  j j d t  nL |  j j d t  |  j j d t  |  j j d t  |  j j d t  d  S(   NR   (	   R   RP  R   R   t   NORMALR   R   R   R   (   R@   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR   E  s    c         C   s   |  j  j   rK |  j j d t  |  j j d t  |  j j d t  nL |  j j d t  |  j j d t  |  j j d t  |  j j d t  d  S(   NR   (	   R   RP  R   R   Rw  R   R   R   R   (   R@   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR   P  s    c         C   s  |  j  j t  } |  j  j |  } | j   d } |  j j   rU |  j j   } n |  j j   } t j	   } | |  j
 d j   k r |  j
 d | } x+ | j   D] } | | j   | | <q Wn  | j   } t |  d | |  j }	 |	 r|  j j   rTd d }
 |  j |
  } | sD|  j  j |  |  j  j |  d  S|  j |  n  |  j  j |  |  j  j | | d |	  |  j  j |  |  j  j |  |  j j |	  n  |  j  j |  |  j  j |  d  S(   Ni    R   s   Get New Keyss4   Your changes will be saved as a new Custom Key Set. s/   Enter a name for your new Custom Key Set below.s    - (   R   t   indexR\  RP  R]  R   R   R   R   t   GetCurrentKeySetRh  R   t   valuesR   t   resultt   GetNewKeysNamet
   select_sett   select_anchort   CreateNewKeySett   deleteR   R   R   (   R@   t	   listIndext   bindingt   bindNamet   currentKeySetNamet   currentBindingst   keySetChangesR   t   currentKeySequencest   newKeyst   messaget	   newKeySet(    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR   [  s>    c         C   s>   t  j d d  t  j d d  } t |  d | |  j } | S(   Nt   userR   RX  s   New Custom Key Set(   R   Rm  R   R{  (   R@   R  t	   usedNamesR  (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR|    s
    	c         C   s)   |  j  d  } | r% |  j |  n  d  S(   Ns   New Key Set Name:(   R|  R  (   R@   t   newKeysName(    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR     s    c         C   s   |  j  j d t  d  S(   NR   (   R   R   Rw  (   R@   R   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR     s    c   
      C   s5  |  j  j   r! |  j j   } n |  j j   } t j |  } i  } x> | j   D]0 } | d d !} t j | |  } | | | <qR W| |  j	 d j   k r |  j	 d | } x% | j   D] } | | | | <q Wn  |  j
 | |  t j d d  }	 |	 j   |  j j |	 |  |  j  j d  |  j   d  S(   Ni   iR   R  i    (   R   RP  R   R   R   t   GetCoreKeysR   R   t   joinRh  t   SaveNewKeySetRm  t   sortR   t   SetMenuR   R   (
   R@   t   newKeySetNamet   prevKeySetNamet   prevKeysR  R   t	   eventNameR  R  t   customKeyList(    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR    s&    
c   	      C   sH  d } d } |  j  j   r6 d } |  j  j t  } n  t j |  } | j   } | j   |  j  j d t	  x | D] } t
 j | |  } | d d !} | |  j d j   k r | |  j d | j   k r |  j d | | } q n  |  j  j t	 | d |  qu W| rD|  j  j |  |  j  j |  |  j  j |  n  d  S(   Ni    i   i   iR   s    - (   R   t   curselectionRx  R\  R   t	   GetKeySetR   R  R  R   R   R  Rh  R   t   seeR}  R~  (	   R@   t
   keySetNamet   reselectR  R  R`  t	   bindNamesR  t   key(    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyRc    s(    
c         C   s<  |  j  j   } t j d d d | d |  s3 d  St j d j |  | |  j d k rk |  j d | =n  t j d j   t j	 d d  } | j
   | s |  j j d t  |  j j | d  n |  j j | | d	  |  j j t j d
 j d d   |  j j t j d
 j d d   |  j   |  j   d  S(   Ns   Delete Key Sets   Are you sure you wish s   to delete the key set %r ?R9   R   R  R   s   - no custom keys -i    RN  RC   RX  RV  (   R   RP  t   tkMessageBoxt   askyesnoR   t   userCfgt   remove_sectionRh  t   SaveRm  R  R   R   R   R   R  R   R   Rn  Rp  R   RL   R   (   R@   R  t   itemList(    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR     s&    	
##
c         C   s?  |  j  j   } t j d d d | f d |  s6 d  St j d j |  | |  j d k rn |  j d | =n  t j d j   t j	 d d  } | j
   | s |  j j d t  |  j j | d  n |  j j | | d	  |  j j t j d
 j d d   |  j j t j d
 j d d   |  j   |  j   d  S(   Ns   Delete Themes   Are you sure you wish s   to delete the theme %r ?R9   Rg  R  R   s   - no custom themes -i    RN  RU  RX  RV  (   R   RP  R  R  R   R  R  Rh  R  Rm  R  R   R   R   R   R  R   R   Rn  Rp  R   RL   R   (   R@   t	   themeNameR  (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR     s&    	
##
c         C   s   |  j  j   } |  j j d  } t j d |  d d | d |  \ } } | r | | k r |  j j   r d d } |  j |  } | s d  S|  j |  |  j	 j
 |  q |  j	 j
 |  n  d  S(   Nt   bgR9   R,   s   Pick new colour for : t   initialcolors2   Your changes will be saved as a new Custom Theme. s-   Enter a name for your new Custom Theme below.(   R   RP  R   t   cgett   tkColorChoosert   askcolorR   t   GetNewThemeNamet   CreateNewThemeR   R   (   R@   t   targett
   prevColourt	   rgbTuplett   colourStringR  t   newTheme(    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR     s    c         C   s   |  j  j   } |  j j d |  |  j j   r: d } n d } |  j |  j j   d } |  j j | i | | 6 |  j	 j   } | d | } |  j
 d | | |  d  S(   NR  t
   foregroundt
   backgroundi    t   -Rg  (   R   RP  R   R   R   R0   R   R   t
   tag_configR   RQ  (   R@   t	   newColourt   planet   sampleElementt   themet   themeElement(    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyRT  	  s     	c         C   s>   t  j d d  t  j d d  } t |  d | |  j } | S(   NR  Rg  RX  s   New Custom Theme(   R   Rm  R   R{  (   R@   R  R  R  (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR    s
    	c         C   s)   |  j  d  } | r% |  j |  n  d  S(   Ns   New Theme Name:(   R  R  (   R@   t   newThemeName(    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR     s    c         C   s   |  j  j   r' d } |  j j   } n d } |  j j   } t j | |  } | |  j d j   k r |  j d | } x% | j   D] } | | | | <q Wn  |  j | |  t j	 d d  } | j
   |  j j | |  |  j  j d  |  j   d  S(   NRX  R  Rg  i    (   R   RP  R   R   R   t   GetThemeDictRh  R   t   SaveNewThemeRm  R  R   R  R   R   (   R@   R  t	   themeTypeR  R  t   themeChangesR   t   customThemeList(    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR     s     
c         C   s6   |  j  j t  } |  j j | j    |  j   d  S(   N(   R   RP  R\  Rx   R   t   lowerR   (   R@   R   Rm   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR   8  s    c         C   s_   |  j  j   } |  j j   r* t j } n	 t j } |  j j d |  j j   d | d |  d  S(   Nt   sizeR   t   family(	   Rx   RP  Rw   R{   t   BOLDRw  R}   R   Ru   (   R@   R   Rx   t
   fontWeight(    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR   =  s    	c         C   s   |  j  j   d k rN |  j j d t  |  j j d t  |  j j d  n6 |  j j d t  |  j j d t  |  j j d  |  j	   d  S(   NR   R   i   (
   R   RP  R   R   R   R   R   R   Rw  t   SetColourSample(   R@   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyRY  F  s    c         G   s   |  j    d  S(   N(   R  (   R@   t   args(    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR   Q  s    c         C   sd   |  j  |  j j   d } |  j j   r2 d } n d } |  j j | |  } |  j j d |  d  S(   Ni    R  R  R  (   R0   R   RP  R   R   t   tag_cgetR   R   (   R@   t   tagR  R   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR  T  s     	c         C   s0  |  j  j   r! |  j j   } n |  j j   } x |  j j   D] } |  j | d } t j | |  } | d k r t j | d d d | d <n  | |  j d j   k r|  j d | } | d | k r | | d | d	 <n  | d
 | k r| | d
 | d <qn  |  j	 j
 | |  q@ W|  j   d  S(   Ni    R   R
   t   fgBgR  R  Rg  s   -foregroundR  s   -background(   R   RP  R   R   R0   R   R   t   GetHighlightRh  R   R  R  (   R@   R  t   elementTitleR   t   colourst	   themeDict(    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyRW  \  s"    	c         C   s   |  j    d  S(   N(   t   SetHelpListButtonStates(   R@   R   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR  q  s    c         C   s   |  j  j   d k  r> |  j j d t  |  j j d t  n^ |  j  j   rv |  j j d t  |  j j d t  n& |  j j d t  |  j j d t  d  S(   Ni   R   (   R  R  R  R   R   R  R  Rw  (   R@   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR  t  s    c         C   sh   t  |  d  j } | rZ |  j j | d | d f  |  j j t | d  |  j   n  |  j   d  S(   Ns   New Help Sourcei    i   (	   R   R{  t   userHelpListt   appendR  R   R   t   UpdateUserHelpChangedItemsR  (   R@   t
   helpSource(    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR    s    c         C   s   |  j  j t  } |  j | } t |  d d | d d | d j } | sX | | k r\ d  S| |  j | <|  j  j |  |  j  j | | d  |  j   |  j	   d  S(   Ns   Edit Help Sourcet   menuItemi    t   filePathi   (
   R  Rx  R\  R  R   R{  R  R   R  R  (   R@   t	   itemIndexR  t   newHelpSource(    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR    s    
c         C   sD   |  j  j t  } |  j | =|  j  j |  |  j   |  j   d  S(   N(   R  Rx  R\  R  R  R  R  (   R@   R  (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR    s
    

c      	   C   ss   i  |  j  d d <x[ t d t |  j  d  D]= } |  j d d t |  t j |  j | d d  d   q. Wd S(   s<   Clear and rebuild the HelpFiles section in self.changedItemsRN  t	   HelpFilesi   i   t   ;N(   Rh  R   t   lenR  RQ  Ri  R   R  (   R@   t   num(    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR    s    #c   	      C   sN  t  t j |    } | j   x! | D] } |  j j t |  q& Wt j d d d d d } | j	   } |  j
 j |  g  | D] } | j	   ^ q } | | k r | j |  } |  j j |  |  j j |  |  j j |  n  t j d d d d d } |  j j d |  |  j j t j d d d d d d d  |  j   d  S(   NRN  RO  Rm   RX  Rd   s	   font-sizeR    t   7t   8t   9R"   R$   t   13t   14t   16t   18t   20t   22s	   font-boldi    Rj  t   bool(   R  R  R  s   10s   11s   12R  R  R  R  R  R  (   R   R{   t   familiesR  R   R   R   R   t	   GetOptionR  Rx   R   Rx  R  R}  R~  R   R  Rw   R   (	   R@   t   fontsRm   t   configuredFontt   lc_configuredFontt   st   lc_fontst   currentFontIndexRu   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyt   LoadFontCfg  s*    
			
c         C   s5   t  j d d d d d d d } |  j j |  d  S(   NRN  RS  s
   num-spacesRX  i   Rj  t   int(   R   R  Rz   R   (   R@   Rz   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyt
   LoadTabCfg  s    c      	      s    j  j t j d d d d d d d  t j   }   j  j   r t j d d  } | j     j j	 | |  t j d d  } | j   | s   j
 j d	 t    j j d
  q9  j j	 | | d  nb t j d d  } | j     j j	 | |  t j d d  } | j     j j	 | | d    j     j j   } | j d   f d      j j	 | | d    j     j   d  S(   NRN  RU  RX  Rj  R  i   Rg  R  R   s   - no custom themes -i    R  c            s     j  |  d S(   Ni   (   R0   (   t   x(   R@   (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR     s    (   R   R   R   R  t   CurrentThemeRP  Rm  R  R   R  R   R   R   R   R   R   R0   R   R   RW  RY  (   R@   t   currentOptionR  t
   themeNames(    (   R@   s)   C:\RCS\Python\lib\idlelib\configDialog.pyt   LoadThemeCfg  s2    





c      	   C   s`  |  j  j t j d d d d d d d  t j   } |  j  j   r t j d d  } | j   |  j j	 | |  t j d d  } | j   | s |  j
 j d	 t  |  j j d
  q9|  j j	 | | d  nb t j d d  } | j   |  j j	 | |  t j d d  } | j   |  j j	 | | d  |  j   t j   } |  j |  d  S(   NRN  RC   RX  Rj  R  i   R   R  R   s   - no custom keys -i    (   R   R   R   R  t   CurrentKeysRP  Rm  R  R   R  R   R   R   R   R   R   Rc  (   R@   R  R  R  (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyt
   LoadKeyCfg  s,    




c      	   C   s   |  j  j t j d d d d d d d  |  j j t j d d d d d	 d d  |  j j t j d d
 d   |  j j t j d d
 d   |  j j t j d d d   |  j j t j d d
 d d d  t j	   |  _
 x( |  j
 D] } |  j j t | d	  q W|  j   d  S(   NRN  RD   s   editor-on-startupRX  i   Rj  R  Rf  i    RO  R&   R%   Rd  Re  R  R
  (   R  R   R   R  R  R  R  R  R  t   GetAllExtraHelpSourcesListR  R  R   R   R  (   R@   t   helpItem(    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyt   LoadGeneralCfg  s    c         C   s6   |  j    |  j   |  j   |  j   |  j   d S(   s   
        load configuration from default and user config files and populate
        the widgets on the config dialog pages.
        N(   R  R  R  R  R  (   R@   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR<     s
    



c         C   sl   t  j d j |  s- t  j d j |  n  x8 | j   D]* } | | } t  j d j | | |  q: Wd S(   s   
        save a newly created core key set.
        keySetName - string, the name of the new key set
        keySet - dictionary containing the new key set
        R   N(   R   R  t   has_sectiont   add_sectionR   t	   SetOption(   R@   R  R`  R   R   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR  '  s
    
c         C   sl   t  j d j |  s- t  j d j |  n  x8 | j   D]* } | | } t  j d j | | |  q: Wd S(   s   
        save a newly created theme.
        themeName - string, the name of the new theme
        theme - dictionary containing the new theme
        Rg  N(   R   R  R  R  R   R  (   R@   R  R  R   R   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR  3  s
    
c         C   sl   t  j | j | |  rR t  j | j | |  | k rR t  j | j | |  Sn  t  j | j | | |  S(   N(   R   Rn  t
   has_optionRp  R  t   RemoveOptionR  (   R@   Rr  Rk  Rl  R   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyt   SetUserValue?  s    c         C   s   t  j d j   x |  j j   D] } t } x |  j | j   D] } | d k rp t  j d j d  t } n  xU |  j | | j   D]< } |  j | | | } |  j | | | |  r t } q q WqA W| r! t  j | j   q! q! Wx% d d g D] } t  j | j   q W|  j	   d S(   s3   Save configuration changes to the user config file.RN  R  R   Rg  N(
   R   R  R  Rh  R   t   FalseR  R   R   R1   (   R@   Rr  t   cfgTypeHasChangesRk  Rl  R   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyt   SaveAllChangedConfigsG  s     	c         C   s1   |  j  j j   } x | D] } | j   q Wd  S(   N(   R9   t   instance_dictR   t   RemoveKeybindings(   R@   t   winInstancest   instance(    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyt   DeactivateCurrentConfig\  s    c         C   sY   |  j  j j   } x@ | D]8 } | j   | j   | j   | j   | j   q Wd S(   s'   Dynamically apply configuration changesN(   R9   R  R   t   ResetColorizert	   ResetFontt   set_notabs_indentwidtht   ApplyKeybindingst   reset_help_menu_entries(   R@   R  R  (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyt   ActivateConfigChangesc  s    



c         C   s   |  j    d  S(   N(   t   destroy(   R@   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR8   m  s    c         C   s   |  j    |  j   d  S(   N(   RL   R  (   R@   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyRK   p  s    
c         C   s"   |  j    |  j   |  j   d  S(   N(   R  R  R  (   R@   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyRL   t  s    

c         C   s   d  S(   N(    (   R@   (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyRH   y  s    N(K   t   __name__t
   __module__R)   R2   RW   RX   RY   RZ   R=   R;  R<  R=  R>  R?  R@  RA  RB  RC  RD  RE  RF  RG  RH  RI  RJ  RK  RL  RM  R1   RQ  Rv  R   R   R   R|  R   R   R  Rc  R   R   R   RT  R  R   R  R   R   R   RY  R   R  RW  R  R  R  R  R  R  R  R  R  R  R  R<   R  R  R   R  R  R  R8   RK   RL   RH   (    (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR      s   	+	$	?	Y	E	p																										$																											!									
			t   __main__RG   t   DialogRI   c           C   s   t  t d  S(   Nt   Settings(   R   t   root(    (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyR     s    (   t   __doc__t   TkinterR  R  R{   R   t   idlelib.configHandlerR   t   idlelib.dynOptionMenuWidgetR   t   idlelib.tabbedpagesR   t   idlelib.keybindingDialogR   t   idlelib.configSectionNameDialogR   t   idlelib.configHelpSourceEditR   t   idlelibR   R(   R   R  t   TkR  RR   R[   R  t   mainloop(    (    (    s)   C:\RCS\Python\lib\idlelib\configDialog.pyt   <module>   s*   
$    h		