PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB`  pY%@sVdZddlTddljZddljZddlj Z ddl m Z ddl mZddlmZddlmZddlmZdd lmZdd lmZdd lmZGd d d eZdZddiZddZGddde Z!e"dkrRddl#Z#e#j$dddddddl%m&Z&e&edS)aIDLE 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. )*N)idleConf) DynOptionMenu) GetKeysDialog)GetCfgSectionNameDialog)GetHelpSourceDialog) TabbedPageSet) view_text) macosxSupportc@seZdZdddddZddZddZd d Zd d Zd dZddZ ddZ ddZ ddZ ddZ ddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Zd7d8Zd9d:Zd;d<Zd=d>Z d?d@Z!dAdBZ"dCdDZ#dEdFZ$dGdHZ%dIdJZ&dKdLZ'dMdNZ(dOdPZ)dQdRZ*dSdTZ+dUdVZ,dWdXZ-dYdZZ.d[d\d]Z/d^d_Z0d`daZ1dbdcZ2dddeZ3dfdgZ4dhdiZ5djdkZ6dldmZ7dndoZ8dpdqZ9drdsZ:dtduZ;dvdwZ<dxdyZ=dzd{Z>d|d}Z?d~dZ@ddZAddZBddZCddZDddZEddZFddZGddZHddZIddZJddZKddZLddZMddZNddZOd[S) ConfigDialogFcCs|tj||||_|r(i|_|j|jdd|j|pQd|jd|jd|j |sdndfdd6d d7dd8dd9dd:dd;dd<dd=d d>d#d?d&d@d)dAd,dBd/dCi|_ |j |j |j d2td3t|j||j|jd4|j|jj|j|j|sx|j|jd5S)Dz _htest - bool, change box location when running htest _utest - bool, don't wait_window when running unittest borderwidthzIDLE Preferencesz+%d+%dz Normal Textnormal00zPython Keywordskeyword01zPython Definitions definition02zPython Builtinsbuiltin03zPython Commentscomment04zPython Stringsstring05z Selected Texthilite06z Found Texthit07Cursorcursor08zEditor Breakpointbreak09zShell Normal Textconsole10zShell Error Texterror11zShell Stdout Textstdout12zShell Stderr Textstderr13heightwidthZWM_DELETE_WINDOWN)rr)rr)rr)rr)rr)rr)rr)r r!)r#r$)r%r&)r'r()r)r*)r+r,)r-r.)Toplevel__init__parent instance_dictZ wm_withdraw configuretitleZgeometryZ winfo_rootxZ winfo_rooty themeElementsResetChangedItems CreateWidgetsZ resizableFALSEZ transientZgrab_setprotocolCanceltabPagesZ focus_set LoadConfigsAttachVarCallbacksZ wm_deiconifyZ wait_window)selfr3r6Z_htestZ_utestrA+/opt/python35/lib/python3.5/configDialog.pyr2sH   !        zConfigDialog.__init__cCst|ddddddg|_|jjdtdtd t|j|j|j|j |j |j jdt dS) NZ page_namesz Fonts/Tabs HighlightingKeysGeneral Extensionssideexpandfill) rr=packTOPTRUEBOTHCreatePageFontTabCreatePageHighlightCreatePageKeysCreatePageGeneralCreatePageExtensionscreate_action_buttonsBOTTOM)r@rArArBr9Qs       zConfigDialog.CreateWidgetsc Cstjri}nddddi}t|dd}t|dd}xud|jfd|jfd|jfd |jffD]=\}}t|d |d |d t|j d t ddqWt|ddddj d t |j d t |S)NpadxpadyOkApplyr<Helptextcommand takefocusrGrr/r r) r ZisAquaTkFramerZr[r<r\Buttonr:rJLEFTrKrT)r@Z paddingArgsZouterZbuttonsZtxtcmdrArArBrS]s     "z"ConfigDialog.create_action_buttonsc Cs|j}t||_t||_t||_t||_tj |d+|_ |j j dj }t|dddtdd }t|dddtdd }t|}t|}t|d tdd }t|d ddtdt|_|jjd|jt|}|jd|jj|jjd|jt|dd} t||jdd|j|_t|d|jddddddd|j} t|dt dd} t| d td|j dd|_!t|} t| d tdd} t"| d|jddd dd!dd"d#|_#|j$d$td%dd&dd't%d(t&|j$d$td%dd&dd(t'|j$d$t(d%dd&dd(t)|j$d$t(d%dd&dd(t)|j$d$t(d)t*|jj$d$td't%d(t)|j$d$td(t'| j$d$td)t*|jj$d$td)t*| j$d$td)t*d%d*| j$d$t(d%dd&dd'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%dd(t)|S),Ncourier rz Fonts/Tabsr rYreliefr]z Base Editor Font z Indentation Width Zjustifyz Font Face :r/rr_exportselectionzr^yscrollcommandzSize :variableonvalueoffvaluerZBoldfontz,AaBbCcDdEe FfGgHhIiJjK 1234567890 #:+=(){}[]zPython Standard: 4 Spaces!orientZ horizontalZ tickintervalZfrom_ZtorGrUrWrHrIanchorr)rdrer)+r3 StringVarfontSize BooleanVarfontBoldfontNameIntVarspaceNumtkFontZFontZeditFontr=pagesframe LabelFrameGROOVEr`LabelrbListboxr: listFontNamebindOnListFontButtonRelease Scrollbarconfigyviewsetr SetFontSampleoptMenuFontSize CheckbuttonSOLIDlabelFontSampleZScaleZ scaleSpaceNumrJrLrMYrKXW)r@r3rzZ frameFontZ frameIndentZ frameFontNameZframeFontParamZlabelFontNameTitleZ scrollFontZlabelFontSizeTitleZ checkFontBoldZframeFontSampleZframeIndentSizeZlabelSpaceNumTitlerArArBrNrsn          ("""(zConfigDialog.CreatePageFontTabc!Cs|j}t||_t||_t||_t||_t||_t||_t||_ |j j dj }t |dddtdd}t |dddtdd}t|dtddd d\d ddddddtdddt |_|j}|jddd|jdddd}}x)|D]!}|jt|d|dqHWx>|jD]3}|dBdC} |j|j|ddD| qwW|jdEtt|dtdd|_t|} t|jddFdG|jdd} t|j|j ddd|_ t!| dH|jdIdddJdG|j"|_#t!| dH|jdIdddKdG|j"|_$|jj%dt|ddLdG|j&} t'|ddM} t!|dH|jdIddG|j(ddN|_)t!|dH|jdIddG|j(ddO|_*t||jddGd|_+t||jddGd|_,t|ddPdG|j-|_.t'|dQd|_/|j0dRt1dSdTdUdTdVt2dWt3|j0dRt1dSdTdUdTdWt4|jj0dRt5dSdTdUdTdVt2dWt6| j0dRt5dSdTdUd|jj0dRt5dSdTdUdTdVt2dWt3| j0dRt5dVt2dWt6dSdXdUdY|j j0dRt5dVt2dWt6dSdXdUdZ|j#j0dRt1d[t7|j$j0dRt8d[t9| j0dRt:dWt6dSdTdUdT| j0dRt5d[t9dSdTdUdT|j)j0dRt5d[t9dSdT|j*j0dRt5d[t9dSdTdUd|j+j0dRt5dWt6dSdTdUdT|j,j0dRt5dWt6d[t9dSdTdUdT|j.j0dRt5dWt6dSdTdUdT|j/j0dRt5dWt6dUdT|S)~NrCr rYrfr]z Custom Highlighting z Highlighting Theme rkrmrd r r#Zhand2r0r/ r_highlightthicknessrwrapzcSsdS)Nr%rA)erArArBsz2ConfigDialog.CreatePageHighlight..z cSsdS)Nr%rA)rrArArBrs#you can click herer r#to choose itemsdefr funcr (param): """string"""r var0 = 'string' var1 = 'selected'r var2 = 'found'r var3 = listr(None)  breakpoint("line")r%  error r)cursor | shellr'r+r-cSs|jjjj|dS)N)ZwidgetZwinfo_toplevelhighlightTargetr)eventelemrArArBtemsz-ConfigDialog.CreatePageHighlight..temzstatezChoose Colour for :r^rivalueZ ForegroundZ BackgroundzSave as New Custom Themez Select : za Built-in Themeza Custom ThemezDelete Custom ThemebdrGrUrrWrHrIrXrp)rdrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrr rrrrrrrrrrrr%rrrr)rrrr#rrrr'rrr+r+rrr-r-rr) rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr);r3rq builtinTheme customThemersfgHilitecolourruthemeIsBuiltinrr=ryrzr{r|ZTextrr:NONEtextHighlightSamplerinsertENDr7Ztag_bindrDISABLEDr`frameColourSetra GetColourroptMenuHighlightTarget RadiobuttonSetColourSampleBindingradioFgradioBgrSaveAsNewThemer} SetThemeTypeZradioThemeBuiltinradioThemeCustomoptMenuThemeBuiltinoptMenuThemeCustomDeleteCustomThemebuttonDeleteCustomThemenew_custom_themerJrbrLrMrrKrERIGHTrrT)r@r3rz frameCustomZ frameThemer]Z textAndTagsZtxTaelementrZ frameFgBgZbuttonSetColourZbuttonSaveCustomThemeZlabelTypeTitlerArArBrOs          ("+ ( ""%%+%z ConfigDialog.CreatePageHighlightc s|j}t||_t||_t||_t||_t||_|jj dj }t |dddt dd}t |dddt ddt |}t|dd}t|}t|d t}t|d td t|_|jjd |j|jd |jj|jd |jj|jjd|j|jjd|jt|ddd |jdt|_fddtdD}t|dd|jddd |j dd|_!t|dd|jddd |j dd|_"t#|d|jdd d|_$t#|d|jdd d|_%t|dddd |j&|_'t|dddd |j(} |j)dt*ddddd t+d!t,j)dt*ddddd!t,|jj)dt*d!t-dddd|j)dt.ddddd t+d!t,|j/dd"d|j0dd"d|j1d#dd$dd%dd&t2|jj1d#dd$dd&t3|j1d#dd$dd&t4|j1d#dd$dd&t5|j!j1d#dd$dd&t2t4|j"j1d#dd$dd&t2t4|j$j1d#dd$dd&t3|j%j1d#dd$dd&t3|j'j)dt.d!t-d d'dd| j)dt.d!t-d d'dd|dj)dt6d!t,d d'|dj)dt6d!t-d d'dd|S)(NrDr rYrfr]z Custom Key Bindings z Key Set zAction - Key(s)rnr_rgzr^rhZxscrollcommandzGet New Keys for Selectionrc s.g|]$}tddddddqS)rUrYrWr r)r`).0i) frameKeySetsrArB Fs z/ConfigDialog.CreatePageKeys..rrirrkzUse a Built-in Key SetzUse a Custom Key SetzDelete Custom Key SetzSave as New Custom Key SetrGrUrrWrHrIweightrowcolumnZ columnspanstickyT)7r3rqZ bindingTarget builtinKeys customKeysrskeysAreBuiltin keyBindingr=ryrzr{r|r`r}rZ HORIZONTALr~r: listBindingsrKeyBindingSelectedrrZxviewrra GetNewKeysr buttonNewKeysranger SetKeysTypeZradioKeysBuiltinradioKeysCustomroptMenuKeysBuiltinoptMenuKeysCustomDeleteCustomKeysbuttonDeleteCustomKeysSaveAsNewKeySetrJrTrLrMrrbcolumnconfigure rowconfiguregridrNSEWZNSZEWrK) r@r3rzrZ frameTargetZlabelTargetTitleZ scrollTargetYZ scrollTargetXZframesZbuttonSaveCustomKeysrA)rrBrP%s~      ("%("##%" &zConfigDialog.CreatePageKeysc Cs |j}t||_t||_t||_t||_t||_t||_ t||_ |j j dj }t|dddtdd}t|dddtdd}t|dddt}t|dddtdd}t|dd }t|d |jd d d |jdd}t|d |jd dd |jdd} t|dd} t|d |jd dd |jdd} t|d |jd d d |jdd} t|dd} t|dd}t|d|jdd}t|dd}t|d|jdd}t|}t|}t|}t|dddtdt|_|jd |jj|jjd|j|jjd|jt|dd d!tdd"d |j |_!t|dd#dd"d |j"|_#t|dd$d!tdd"d |j$|_%|j&d%t'd&dd'dd(t(|j&d%t'd&dd'dd(t(|j&d%t'd&dd'dd(t(|j&d%t'd&dd'dd)t)d(t*|j&d%t+d*t,d&dd'd| j&d%t-d*t,d&dd'd|j&d%t-d*t,d&dd'd| j&d%t+d*t,d&dd'd| j&d%t-d*t,d&dd'd| j&d%t-d*t,d&dd'd| j&d%t+d*t,d&dd'd|j&d%t-d*t.d&d+d'd|j&d%t-d*t.d'd|j&d%t-d*t.d&d+d'd|j&d%t-d*t.d'd|j&d%t-d&dd'dd(t/|j&d%t'd&dd'dd)t)d(t*|j&d%t-d*t,d(t/|jj&d%t+d*t.d)t)d(t*|j!j&d%t'd*t,d'd|j#j&d%t'd*t,|j%j&d%t'd*t,d'd|S),NrEr rYrfr]z Startup Preferences z Autosave Preferences z Additional Help Sources z At Startuprirrkr^zOpen Edit WindowrzOpen Shell WindowzAt Start of Run (F5) zPrompt to Savez No Promptz$Initial Window Size (in characters)ZWidth textvariabler0rXZHeightr/rr_rgrhzZEditrrZAddZRemoverGrUrWrIrHrpre)0r3rqwinWidth winHeightrv startupEditautoSaveencodingrsZuserHelpBrowserZ helpBrowserr=ryrzr{r|r`r}rrEntryrr~r:listHelprrrrHelpSourceSelectedrarHelpListItemEditbuttonHelpListEditHelpListItemAddZbuttonHelpListAddHelpListItemRemovebuttonHelpListRemoverJrKrrLrMrbrrrr)r@r3rzZframeRunZ frameSaveZ frameWinSizeZ frameHelpZlabelRunChoiceTitleZradioStartupEditZradioStartupShellZlabelRunSaveTitleZ radioSaveAskZ radioSaveAutoZlabelWinSizeTitleZlabelWinWidthTitleZ entryWinWidthZlabelWinHeightTitleZentryWinHeightZ frameHelpListZframeHelpListButtonsZscrollHelpListrArArBrQrs         """(""""""""""(%zConfigDialog.CreatePageGeneralcCs|jjd|j|jjd|j|jjd|j|jjd|j|jjd|j|j jd|j |j jd|j |j jd|j|jjd|j|jjd|j|jjd|j|jjd|j|jjd|j|jjd|j|jjd|j|jjd|j|jjd|j |j!jd|j"dS)Nw)#rrZtrace_variableVarChanged_fontrurtrwVarChanged_spaceNumrVarChanged_colourrVarChanged_builtinThemerVarChanged_customThemerVarChanged_themeIsBuiltinrVarChanged_highlightTargetrVarChanged_keyBindingrVarChanged_builtinKeysrVarChanged_customKeysrVarChanged_keysAreBuiltinrVarChanged_winWidthrVarChanged_winHeightrVarChanged_startupEditrVarChanged_autoSaverVarChanged_encoding)r@rArArBr?s$zConfigDialog.AttachVarCallbackscCsx|j|j|j|j|j|j|j|j|j|j |j |j |j |j |j|j|j|jfD]$}|jd|jddqsWdS)z)Remove callbacks to prevent memory leaks.rrrkN)rrrurtrwrrrrrrrrrrrrrrZ trace_vdeleteZ trace_vinfo)r@varrArArBremove_var_callbackssz!ConfigDialog.remove_var_callbackscGss|jj}|jddd||jj}|jddd||jj}|jddd|dS)zWhen one font attribute changes, save them all, as they are not independent from each other. In particular, when we are overriding the default font, we need to write out everything. main EditorWindowrmz font-sizez font-boldN)rugetAddChangedItemrrrt)r@paramsrrArArBrs zConfigDialog.VarChanged_fontcGs)|jj}|jddd|dS)Nr1Indentz num-spaces)rwr3r4)r@r5rrArArBr sz ConfigDialog.VarChanged_spaceNumcGs|jdS)N)OnNewColourSet)r@r5rArArBr!szConfigDialog.VarChanged_colourcGs|jj}|dkr~tjddddkrL|jdddd|jddd||jjdd d d nE|jddd||jdddd |jjdd d d |jdS)Nz IDLE Darkr1ThemenamezIDLE Newz IDLE ClassicZname2r]zNew theme, see HelpZfgz#500000r Zblack)rr3r GetOptionr4rrPaintThemeSample)r@r5rrArArBr"s  z$ConfigDialog.VarChanged_builtinThemecGs?|jj}|dkr;|jddd||jdS)Nz- no custom themes -r1r8r9)rr3r4r;)r@r5rrArArBr#s z#ConfigDialog.VarChanged_customThemecGsF|jj}|jddd||r8|jn |jdS)Nr1r8default)rr3r4r"r#)r@r5rrArArBr$s  z&ConfigDialog.VarChanged_themeIsBuiltincGs|jdS)N)SetHighlightTarget)r@r5rArArBr% sz'ConfigDialog.VarChanged_highlightTargetcGs|jj}|jj}|jjtjd}tj|rb|jd|||n/tj |}|d}|jd|||dS)NrkeysZ _cfgBindings extensions) rr3rrANCHORsplitrZ IsCoreBindingr4ZGetExtnNameForEvent)r@r5rkeySetrZextNameZextKeybindSectionrArArBr&#s z"ConfigDialog.VarChanged_keyBindingcGs6|jj}|jddd||j|dS)Nr1rDr9)rr3r4 LoadKeysList)r@r5rrArArBr'/sz#ConfigDialog.VarChanged_builtinKeyscGsB|jj}|dkr>|jddd||j|dS)Nz- no custom keys -r1rDr9)rr3r4rC)r@r5rrArArBr(4s z"ConfigDialog.VarChanged_customKeyscGsF|jj}|jddd||r8|jn |jdS)Nr1rDr<)rr3r4r'r()r@r5rrArArBr):s  z&ConfigDialog.VarChanged_keysAreBuiltincGs)|jj}|jddd|dS)Nr1r2r0)rr3r4)r@r5rrArArBr*Bsz ConfigDialog.VarChanged_winWidthcGs)|jj}|jddd|dS)Nr1r2r/)rr3r4)r@r5rrArArBr+Fsz!ConfigDialog.VarChanged_winHeightcGs)|jj}|jddd|dS)Nr1rEzeditor-on-startup)rr3r4)r@r5rrArArBr,Jsz#ConfigDialog.VarChanged_startupEditcGs)|jj}|jddd|dS)Nr1rEautosave)rr3r4)r@r5rrArArBr-Nsz ConfigDialog.VarChanged_autoSavecGs)|jj}|jddd|dS)Nr1r2r)rr3r4)r@r5rrArArBr.Rsz ConfigDialog.VarChanged_encodingcCs%didididii|_dS)Nr1 highlightr>r?) changedItems)r@rArArBr8VszConfigDialog.ResetChangedItemscCsIt|}||j|kr0i|j||<||j|||r?r<)rGetSectionList defaultCfg GetOptionListGet)r@ZdItems configTypeZsectionsrIoptionsoptionrArArBGetDefaultItemses   1zConfigDialog.GetDefaultItemscCs|jjrK|jjdt|jjdt|jjdtnL|jjdt|jjdt|jjdt|jjdtdS)Nr) rr3rrNORMALrrrr)r@rArArBrqszConfigDialog.SetThemeTypecCs|jjrK|jjdt|jjdt|jjdtnL|jjdt|jjdt|jjdt|jjdtdS)Nr) rr3rrrSrrr r)r@rArArBr|szConfigDialog.SetKeysTypec Cs|jjt}|jj|}|jd}|jjrU|jj}n|jj}tj }||j dkr|j d|}x"|D]}||j||z Get New KeyszcYour changes will be saved as a new Custom Key Set. Enter a name for your new Custom Key Set below.z - )rindexr@r3rArrrrZGetCurrentKeySetrFrvaluesrresultGetNewKeysName select_set select_anchorCreateNewKeySetdeleterrr) r@ listIndexbindingbindNameZcurrentKeySetNameZcurrentBindings keySetChangesrZcurrentKeySequencesnewKeysmessage newKeySetrArArBrs<     zConfigDialog.GetNewKeyscCs>tjddtjdd}t|d||j}|S)Nuserr>r<zNew Custom Key Set)rrKrrV)r@ra usedNamesrbrArArBrWs zConfigDialog.GetNewKeysNamecCs&|jd}|r"|j|dS)NzNew Key Set Name:)rWrZ)r@Z newKeysNamerArArBr szConfigDialog.SaveAsNewKeySetcCs|jjdtdS)Nr)rrrS)r@rrArArBrszConfigDialog.KeyBindingSelectedc Cs#|jjr!|jj}n|jj}tj|}i}x;|D]3}|dd}dj||}|||rcr)rr3rrrZ GetCoreKeysjoinrF SaveNewKeySetrKsortrSetMenurr) r@Z newKeySetNameZprevKeySetNameZprevKeysr`rZ eventNamer]r_Z customKeyListrArArBrZs&   zConfigDialog.CreateNewKeySetc Cs9d}d}|jjr3d}|jjt}tj|}t|j}|j|jj dt x|D]}dj ||}|dd}||j dkr||j d|kr|j d||}|jj t |d|qxW|r5|jj||jj||jj|dS)NrrkrrYr>z - re)r curselectionrTr@rZ GetKeySetrr>rhr[rrfrFrseerXrY) r@ keySetNameZreselectrbr\rBZ bindNamesr^keyrArArBrCs(  zConfigDialog.LoadKeysListcCsO|jj}d}tjd||d|s5dS|jtjdj|||jdkrt|jd|=tjdj tj dd}|j |s|j j dt|jj|dn|jj||d|jjtjd jd d |jjtjd jd d |j|j|jdS) Nz0Are you sure you wish to delete the key set %r ?zDelete Key Setr3r>rcrz- no custom keys -rr1rDr<r9)rr3 tkMessageBoxaskyesnoDeactivateCurrentConfigruserCfgremove_sectionrFSaverKrhrrrrrirrrLrNrSaveAllChangedConfigsActivateConfigChangesr)r@rldelmsgitemListrArArBr s*  ##  zConfigDialog.DeleteCustomKeyscCsO|jj}d}tjd||d|s5dS|jtjdj|||jdkrt|jd|=tjdj tj dd}|j |s|j j dt|jj|dn|jj||d|jjtjd jd d |jjtjd jd d |j|j|jdS) Nz.Are you sure you wish to delete the theme %r ?z Delete Themer3rErcrz- no custom themes -rr1r8r<r9)rr3rnrorprrqrrrFrsrKrhrrrrrirrrLrNrrtrur)r@ themeNamervrwrArArBr s*  ##  zConfigDialog.DeleteCustomThemecCs|jj}|jjd}tjd|dd|d|\}}|r||kr|jjrd}|j|}|sdS|j||j j |n|j j |dS)Nbgr3r6zPick new colour for : Z initialcolorz_Your changes will be saved as a new Custom Theme. Enter a name for your new Custom Theme below.) rr3rZcgettkColorChooserZaskcolorrGetNewThemeNameCreateNewThemerr)r@targetZ prevColourZ rgbTupletZ colourStringranewThemerArArBr&s  zConfigDialog.GetColourcCs|jj}|jjd||jjr7dnd}|j|jjd}|jj|||i|j j}|d|}|j d|||dS)Nry foreground backgroundr-rE) rr3rrrr7rr tag_configrr4)r@Z newColourplaneZ sampleElementthemeZ themeElementrArArBr7:szConfigDialog.OnNewColourSetcCs>tjddtjdd}t|d||j}|S)NrcrEr<zNew Custom Theme)rrKrrV)r@rardr~rArArBr{Ds zConfigDialog.GetNewThemeNamecCs&|jd}|r"|j|dS)NzNew Theme Name:)r{r|)r@ newThemeNamerArArBrKszConfigDialog.SaveAsNewThemecCs|jjr'd}|jj}nd}|jj}tj||}||jdkr|jd|}x|D]}|||||jjdt|jjdtn^|jjrv|jjdt|jjdtn&|jjdt|jjdtdS)Nrkr)rsizerrrrrjrS)r@rArArBrsz$ConfigDialog.SetHelpListButtonStatescCset|dj}|rW|jj|d|df|jjt|d|j|jdS)NzNew Help Sourcerrk) rrV userHelpListappendrrrUpdateUserHelpChangedItemsr)r@ helpSourcerArArBrs  zConfigDialog.HelpListItemAddcCs|jjt}|j|}t|dd|dd|dj}| sX||kr\dS||j|<|jj||jj||d|j|j dS)NzEdit Help SourceZmenuItemrZfilePathrk) rrTr@rrrVr[rrr)r@ itemIndexrZ newHelpSourcerArArBrs   zConfigDialog.HelpListItemEditcCsD|jjt}|j|=|jj||j|jdS)N)rrTr@rr[rr)r@rrArArBrs   zConfigDialog.HelpListItemRemovec Csvi|jdd.789r(r*r,r.1416182022) rrrr(r*r,r.rrrrr)rrxfamiliesrhrrrrZGetFontrrurrTrkrXrY ValueErrorrrirtr) r@ZfontsrmZconfiguredFontrurrrtZlc_fontsZcurrentFontIndexrArArB LoadFontCfgs*      zConfigDialog.LoadFontCfgcCs5tjddddddd}|jj|dS)Nr1r6z num-spacesr<rtypeint)rr:rwr)r@rwrArArB LoadTabCfgszConfigDialog.LoadTabCfgc sjjtjdddddddtj}jjrtjdd}|jjj ||tjdd}|j|sj j d t j jd q9jj ||d nbtjdd}|jjj ||tjdd}|jjj ||d jtjj}|jd fd djj ||d jjdS)Nr1r8r<rboolrkrErcrz- no custom themes -rrmcsj|dS)Nrk)r7)x)r@rArBrsz+ConfigDialog.LoadThemeCfg..)rrrr:Z CurrentThemer3rKrhrrirrrrrrrr7r>rr;r=)r@ currentOptionrwZ themeNamesrA)r@rB LoadThemeCfgs2       zConfigDialog.LoadThemeCfgc Cs`|jjtjdddddddtj}|jjrtjdd}|j|jj ||tjdd}|j|s|j j d t |j jd q9|jj ||d nbtjdd}|j|jj ||tjdd}|j|jj ||d |jtj}|j|dS) Nr1rDr<rrrkr>rcrz- no custom keys -r)rrrr:Z CurrentKeysr3rKrhrrirrrrrrrC)r@rrwrlrArArB LoadKeyCfgs,       zConfigDialog.LoadKeyCfgc Cs |jjtjddddddd|jjtjddddd dd|jjtjdd d dd |jjtjdd d dd |jjtjdd dddtj|_ x(|j D]}|j j t |d qW|j dS)Nr1rEzeditor-on-startupr<rkrrrDrr2r0rr/rZnone)rrrr:rrrrZGetAllExtraHelpSourcesListrrrrr)r@ZhelpItemrArArBLoadGeneralCfg2szConfigDialog.LoadGeneralCfgcCs6|j|j|j|j|jdS)z load configuration from default and user config files and populate the widgets on the config dialog pages. N)rrrrr)r@rArArBr>Gs     zConfigDialog.LoadConfigscCsctjdj|s*tjdj|x2|D]*}||}tjdj|||q1WdS)z 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)rrq has_section add_section SetOption)r@rlrBrrrArArBrgWs   zConfigDialog.SaveNewKeySetcCsctjdj|s*tjdj|x2|D]*}||}tjdj|||q1WdS)z save a newly created theme. themeName - string, the name of the new theme theme - dictionary containing the new theme rEN)rrqrrr)r@rxrrrrArArBrcs   zConfigDialog.SaveNewThemecCsitj|j||rOtj|j|||krOtj|j||Stj|j|||S)N)rrLZ has_optionrNrq RemoveOptionr)r@rOrIrJrrArArB SetUserValueoszConfigDialog.SetUserValuecCstjdjx|jD]}d}x|j|D]{}|dkratjdjdd}xL|j||D]9}|j|||}|j||||rsd}qsWq5W|rtj|jqWx%ddgD]}tj|jqW|j|jdS)z3Save configuration changes to the user config file.r1FrTr>rEN)rrqrsrFrrrr8save_all_changed_extensions)r@rOZcfgTypeHasChangesrIrJrrArArBrtws"  z"ConfigDialog.SaveAllChangedConfigscCs1|jjj}x|D]}|jqWdS)N)r3r4r>ZRemoveKeybindings)r@ winInstancesinstancerArArBrps z$ConfigDialog.DeactivateCurrentConfigcCsY|jjj}x@|D]8}|j|j|j|j|jqWdS)z'Dynamically apply configuration changesN)r3r4r>ZResetColorizerZ ResetFontZset_notabs_indentwidthZApplyKeybindingsZreset_help_menu_entries)r@rrrArArBrus     z"ConfigDialog.ActivateConfigChangescCs|jdS)N)destroy)r@rArArBr<szConfigDialog.CancelcCs|j|jdS)N)r[r)r@rArArBrZs zConfigDialog.OkcCs"|j|j|jdS)N)rprtru)r@rArArBr[s  zConfigDialog.Applyc Cs6|jj}t|dddttj|ddS)Nr6zHelp for IDLE preferencesr]r )r=Z _current_pager help_common help_pagesr3)r@ZpagerArArBr\s zConfigDialog.Helpc Cs|j}|jjdj}tjd|_tjd|_|j t |_ |j t ||_ |jddd|jdddt|d|j dd |_|jjd |jt|d |jj}|j|j_t|d d dd |_|jjdddddd|jdddddd|jjdddddddddg|jddddi|_d|_||_|j|_d}x6t |j!D]%}|j"||d|d}qW|j j||jj#d|jddS)aPart of the config dialog used for configuring IDLE extensions. This code is generic - it works for any and all IDLE extensions. IDLE extensions save their configuration options using idleConf. This code reads the current configuration using idleConf, supplies a GUI interface to change the configuration values, and saves the changes using idleConf. Not all changes take effect immediately - some may require restarting IDLE. This depends on each extension's implementation. All values are treated as text, and it is up to the user to supply reasonable values. The only exception to this are the 'enable*' options, which are boolean, and can be toggled with a True/False button. rFr?rrrkrYZ listvariableZ selectmodeZbrowsez<>r^r0r/rrrZnwsnsnsewrUrerWNr {z} )$r3r=ryrzrrLext_defaultCfgrq ext_userCfgregisteris_intload_extensionsrqZextension_namesr r r~extension_listrextension_selectedrrrrhr{ details_framerr5 config_framecurrent_extensionZ outerframeZtabbed_page_setsortedr?create_extension_frameZ selection_set)r@r3rzZscrollZ ext_namesext_namerArArBrRs<   +     z!ConfigDialog.CreatePageExtensionsc #Csi|_x'tjddD]}g|j|.rawTTrueFalserrNrr<r9rr/)r?rZ GetExtensionsrrrMremoverNKeyErrorrrrrqrrGr) r@rZopt_listZenablesrZdef_strZdef_objZopt_typerr/rArArBrsF               zConfigDialog.load_extensionscCs|jj}|r'|jj|}|dksB||jkr{|jr{|jjdd|j|jjd|_|r|jjd||j|jdddddd||_dS)Nr]r rrrrr) rrjr3rrrrZ grid_forgetr)r@rZnewselrArArBrs  #zConfigDialog.extension_selectedcCs~t|jdddd}||j|<|j}xFt|j|D]1\}}t|d|d}|jd|ddd t|d }|d d krt |d |d|dddddt ddddjd|ddd t ddqE|d dkrHt |d |ddd|j dfjd|ddd tddqEt |d |jd|ddd tddqEWdS) z=Create a frame holding the widgets to configure one extensionr/rr0r]r9rrrrr/rrrrirjrrlrZ indicatoronZ selectcolorr rrkrUrZvalidatermZvalidatecommandz%PN)VerticalScrolledFramerrinterior enumerater?r}rNWrr:rrrr)r@rfZ entry_arearoptZlabelr/rArArBrs&     z#ConfigDialog.create_extension_framecCsv|d}|d}|djjp-|}|dj|||kr`|jj||S|jj|||S)Nr9r<r/)r3striprrrr)r@rIrr9r<rrArArBset_extension_value9s   z ConfigDialog.set_extension_valuecCsgd}xG|jD]<}|j|}x&|D]}|j||r*d}q*WqW|rc|jjdS)z3Save configuration changes to the user config file.FTN)r?rrrs)r@Z has_changesrrPrrArArBrEs  z(ConfigDialog.save_all_changed_extensions)P__name__ __module__ __qualname__r2r9rSrNrOrPrQr?r0rr r!r"r#r$r%r&r'r(r)r*r+r,r-r.r8r4rRrrrrWr rrZrCr rrr7r{rr|rrr=rrr;rrrrrrrrrrrr>rgrrrtrprur<rZr[r\rRrrrrrrArArArBr s 5  D o M `                 $                       !           5 -   r ahWhen you click either the Apply or Ok buttons, settings in this dialog that are different from IDLE's default are saved in a .idlerc directory in your home directory. Except as noted, these changes apply to all versions of IDLE installed on this machine. Some do not take affect until IDLE is restarted. [Cancel] only cancels changes made since the last save. rCz Highlighting: The IDLE Dark color theme is new in October 2015. It can only be used with older IDLE releases if it is saved as a custom theme, with a different name. c Cs9|s dSyt|dSWntk r4dSYnXdS)z(Return 's is blank or represents an int'TFN)rr)rrArArBrcs  rc@s"eZdZdZddZdS)rzA pure Tkinter vertically scrollable frame. * Use the 'interior' attribute to place widgets inside the scrollable frame * Construct and pack/place/grid normally * This frame only allows vertical scrolling c s6tj||||t|dt}|jdtdtdtt|ddddd|j d d jdt dt dt |j d jjdjdt|_jddd d tfdd}jd|fdd}jd|dS)NrnrIrGrHrrrrhr0r^Zwindowrpcs0jjf}jdd|dS)NZ scrollregionz 0 0 %s %s)winfo_reqwidthZwinfo_reqheightr)rr)canvasrrArB_configure_interiorsz;VerticalScrolledFrame.__init__.._configure_interiorz cs5jjkr1jdjdS)Nr0)rZ winfo_widthZ itemconfigure)r)rr interior_idrArB_configure_canvassz9VerticalScrolledFrame.__init__.._configure_canvas)r`r2rZVERTICALrJrrr:ZCanvasrrbrMrLrrZ xview_movetoZ yview_movetorZ create_windowrr)r@r3rkwZ vscrollbarrrrA)rrrrBr2us   zVerticalScrolledFrame.__init__N)rrr__doc__r2rArArArBrns r__main__z#idlelib.idle_test.test_configdialog verbosityrYexitF)run)'rtkinterZtkinter.messageboxZ messageboxrnZtkinter.colorchooserZ colorchooserrzZ tkinter.fontrmrxZidlelib.configHandlerrZidlelib.dynOptionMenuWidgetrZidlelib.keybindingDialogrZidlelib.configSectionNameDialogrZidlelib.configHelpSourceEditrZidlelib.tabbedpagesrZidlelib.textViewr Zidlelibr r1r rrrr`rrZunittestr1Zidlelib.idle_test.htestrrArArArB s: C  +