[@s`dZddlTddljZddljZddlj Z ddl m Z ddl mZddlmZddlmZddlmZdd lmZddlmZdd lmZGd d d eZGd ddeZddZGdddeZedkr\ddl Z e j!dddddddl"m#Z#e#eendS)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) TabbedPageSet) GetKeysDialog)GetCfgSectionNameDialog)GetHelpSourceDialog) macosxSupportc@s|eZdZdddddZddZddZd 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\Z/d]d^d_Z0d`daZ1dbdcZ2dddeZ3dfdgZ4dhdiZ5djdkZ6dldmZ7dndoZ8dpdqZ9drdsZ:dtduZ;dvdwZ<dxdyZ=dzd{Z>d|d}Z?d~dZ@ddZAddZBddZCddZDddZEddZFddZGddZHddZIddZJd]S) ConfigDialogFcCstj||||_|r+i|_n|j|jdd|j|pTd|jd|jd|j |sdndfi d3d 6d4d 6d5d6d6d6d7d6d8d6d9d6d:d6d;d"6d<d%6d=d(6d>d+6d?d.6|_ |j |j |j d/td0t|j||j|jd1|j|jj|j|j|s|j|jnd2S)@z _htest - bool, change box location when running htest _utest - bool, don't wait_window when running unittest borderwidthzIDLE Preferencesz+%d+%dnormal00z Normal Textkeyword01zPython Keywords definition02zPython Definitionsbuiltin03zPython Builtinscomment04zPython Commentsstring05zPython Stringshilite06z Selected Texthit07z Found Textcursor08Cursorerror09z Error Textconsole10zShell Normal Textstdout11zShell Stdout Textstderr12zShell Stderr TextheightwidthWM_DELETE_WINDOWN)rr)zkeywordr)rr)rr)rr)zstringr)rr)rr )zcursorr")zerrorr%)r&r')zstdoutr))zstderrr+)Toplevel__init__parent instance_dict wm_withdraw configuretitlegeometry winfo_rootx winfo_rooty themeElementsResetChangedItems CreateWidgets resizableFALSE transientgrab_setprotocolCanceltabPages focus_set LoadConfigsAttachVarCallbacks wm_deiconify wait_window)selfr1r5_htestZ_utestrJ*/usr/lib/python3.4/idlelib/configDialog.pyr0sH   !         zConfigDialog.__init__cCst|dddddg|_|jjdtdtdt|j|j|j|j |j jdt dS) N page_namesz Fonts/Tabs HighlightingKeysGeneralsideexpandfill) rrBpackTOPTRUEBOTHCreatePageFontTabCreatePageHighlightCreatePageKeysCreatePageGeneralcreate_action_buttonsBOTTOM)rHrJrJrKr;Os     zConfigDialog.CreateWidgetsc CsCtjri}nidd6dd6}t|dd}t|dd}t|ddd|jd t||_t|dd d|jd t||_t|dd d|j d t||_ |jj d t dd |jj d t dd |j j d t dd t|ddddj d t |j d t|S)NpadxpadytextOkcommand takefocusApplyrArPr r,r r)r ZisAquaTkFrameButtonrcr=ZbuttonOkrfZ buttonApplyrAZ buttonCancelrSLEFTrTr\)rHZ paddingArgsZouterZbuttonsrJrJrKr[Xs(  "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 rareliefrbz Base Editor Font z Indentation Width Zjustifyz Font Face :r,r reexportselectionzrdyscrollcommandzSize :variableonvalueoffvaluerZBoldfontz,AaBbCcDdEe FfGgHhIiJjK 1234567890 #:+=(){}[]zPython Standard: 4 Spaces!orientZ horizontalZ tickintervalZfrom_ZtorPr^r`rQrRanchorr)rjrkznormal)+r1 StringVarfontSize BooleanVarfontBoldfontNameIntVarspaceNumtkFontZFontZeditFontrBpagesframe LabelFrameGROOVErgLabelriListboxr= listFontNamebindOnListFontButtonRelease Scrollbarconfigyviewsetr SetFontSampleoptMenuFontSize CheckbuttonSOLIDlabelFontSampleZScaleZ scaleSpaceNumrSrUrVYrTXW)rHr1rZ frameFontZ frameIndentZ frameFontNameZframeFontParamZlabelFontNameTitleZ scrollFontZlabelFontSizeTitleZ checkFontBoldZframeFontSampleZframeIndentSizeZlabelSpaceNumTitlerJrJrKrWwsn          ("""(zConfigDialog.CreatePageFontTabcCs|j}t||_t||_t||_t||_t||_t||_t||_ |j j dj }t |dddtdd}t |dddtdd}t|dtddd dXd ddddddtdddt |_|j}|jddd|jddddw}x)|D]!}|jt|d|dqHWx>|jD]3}|d?d@} |j|j|ddA| qwW|jdBtt|dtdd|_t|} t|jddCdD|jdd} t|j|j ddd|_ t!| dE|jdFdddGdD|j"|_#t!| dE|jdFdddHdD|j"|_$|jj%dt|ddIdD|j&} t'|ddJ} t!|dE|jdFddD|j(ddK|_)t!|dE|jdFddD|j(ddL|_*t||jddDd|_+t||jddDd|_,t|ddMdD|j-|_.|j/dNt0dOdPdQdPdRt1dSt2|j/dNt0dOdPdQdPdSt3|jj/dNt4dOdPdQdPdRt1dSt5| j/dNt4dOdPdQd|jj/dNt4dOdPdQdPdRt1dSt2| j/dNt4dRt1dSt5dOdTdQdU|j j/dNt4dRt1dSt5dOdTdQdV|j#j/dNt0dWt6|j$j/dNt7dWt8| j/dNt9dSt5dOdPdQdP| j/dNt4dWt8dOdPdQdP|j)j/dNt4dWt8dOdP|j*j/dNt4dWt8dOdPdQd|j+j/dNt4dSt5dOdPdQdP|j,j/dNt4dSt5dWt8dOdPdQdP|j.j/dNt4dSt5dOdPdQdP|S)xNrMr rarlrbz Custom Highlighting z Highlighting Theme rqrsrj r r!Zhand2r-r, rehighlightthicknessrZwrapzcSsdS)NbreakrJ)erJrJrKsz2ConfigDialog.CreatePageHighlight..z cSsdS)NrrJ)rrJrJrKrs#you can click herer r#to choose itemsdefr funcr (param): """string"""r var0 = 'string' var1 = 'selected'r var2 = 'found'r var3 = listr(None)  error r$cursor | shellr&r(r*cSs|jjjj|dS)N)ZwidgetZwinfo_toplevelhighlightTargetr)eventelemrJrJrKtemsz-ConfigDialog.CreatePageHighlight..temzstatezChoose Colour for :rdrovalueZ ForegroundZ BackgroundzSave as New Custom Themez Select : za Built-in Themeza Custom ThemezDelete Custom ThemerPr^r r`rQrRr_rv)zcourierrr rcommentrnormalrrrrzdefkeywordrrzfuncz definitionrrrstringrrrrrrrzhiliterrrzhitrrzlistzbuiltinrrzNonerrrrzerrorrrrr!rrzshellzconsolerrstdoutrrrstderrrrr)rrrrrrrrrrrrrrrrrrrrrrrrrrrrrr):r1rw builtinTheme customThemeryfgHilitecolourr{themeIsBuiltinrrBrrrrZTextrr=ZNONEtextHighlightSamplerinsertENDr9Ztag_bindrDISABLEDrgframeColourSetrh GetColourroptMenuHighlightTarget RadiobuttonSetColourSampleBindingradioFgradioBgrSaveAsNewThemer SetThemeTypeZradioThemeBuiltinradioThemeCustomoptMenuThemeBuiltinoptMenuThemeCustomDeleteCustomThemebuttonDeleteCustomThemerSrirUrVrrTrERIGHTrr\)rHr1r frameCustomZ frameThemerbZ textAndTagsZtxTaelementrZ frameFgBgZbuttonSetColourZbuttonSaveCustomThemeZlabelTypeTitlerJrJrKrXs          ("+ ( ""%%+%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)(NrNr rarlrbz Custom Key Bindings z Key Set zAction - Key(s)rtrermzrdrnZxscrollcommandzGet New Keys for Selectionrc s.g|]$}tddddddqS)r^rar`r r)rg).0i) frameKeySetsrJrK Hs z/ConfigDialog.CreatePageKeys..rrorrqzUse a Built-in Key SetzUse a Custom Key SetzDelete Custom Key SetzSave as New Custom Key SetrPr^r r`rQrRweightrowcolumnZ columnspanstickyT)7r1rwZ bindingTarget builtinKeys customKeysrykeysAreBuiltin keyBindingrBrrrrrgrrZ HORIZONTALrr= listBindingsrKeyBindingSelectedrrZxviewrrh GetNewKeysr buttonNewKeysranger SetKeysTypeZradioKeysBuiltinradioKeysCustomroptMenuKeysBuiltinoptMenuKeysCustomDeleteCustomKeysbuttonDeleteCustomKeysSaveAsNewKeySetrSr\rUrVrricolumnconfigure rowconfiguregridrNSEWZNSZEWrT) rHr1rrZ frameTargetZlabelTargetTitleZ scrollTargetYZ scrollTargetXZframesZbuttonSaveCustomKeysrJ)rrKrY'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),NrOr rarlrbz Startup Preferences z Autosave Preferences z Additional Help Sources z At StartuprorrqrdzOpen Edit WindowrzOpen Shell WindowzAt Start of Run (F5) zPrompt to Savez No Promptz$Initial Window Size (in characters)ZWidth textvariabler-r_ZHeightr,r rermrnzZEditrrZAddZRemoverPr^r`rRrQrvrk)0r1rwwinWidth winHeightr| startupEditautoSaveencodingryZuserHelpBrowserZ helpBrowserrBrrrrrgrrr Entryrrr=listHelprrrrHelpSourceSelectedrhrHelpListItemEditbuttonHelpListEditHelpListItemAddZbuttonHelpListAddHelpListItemRemovebuttonHelpListRemoverSrTrrUrVrirrrr)rHr1rZframeRunZ frameSaveZ frameWinSizeZ frameHelpZlabelRunChoiceTitleZradioStartupEditZradioStartupShellZlabelRunSaveTitleZ radioSaveAskZ radioSaveAutoZlabelWinSizeTitleZlabelWinWidthTitleZ entryWinWidthZlabelWinHeightTitleZentryWinHeightZ frameHelpListZframeHelpListButtonsZscrollHelpListrJrJrKrZts         """(""""""""""(%zConfigDialog.CreatePageGeneralcCs|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"|j#jd|j$dS)Nw)%rxZtrace_variableVarChanged_fontSizer{VarChanged_fontNamerzVarChanged_fontBoldr}VarChanged_spaceNumrVarChanged_colourrVarChanged_builtinThemerVarChanged_customThemerVarChanged_themeIsBuiltinrVarChanged_highlightTargetrVarChanged_keyBindingrVarChanged_builtinKeysrVarChanged_customKeysrVarChanged_keysAreBuiltinrVarChanged_winWidthrVarChanged_winHeightrVarChanged_startupEditrVarChanged_autoSaverVarChanged_encoding)rHrJrJrKrEs$zConfigDialog.AttachVarCallbackscGs)|jj}|jddd|dS)Nmain EditorWindowz font-size)rxgetAddChangedItem)rHparamsrrJrJrKr$sz ConfigDialog.VarChanged_fontSizecGs)|jj}|jddd|dS)Nr6r7rs)r{r8r9)rHr:rrJrJrKr%sz ConfigDialog.VarChanged_fontNamecGs)|jj}|jddd|dS)Nr6r7z font-bold)rzr8r9)rHr:rrJrJrKr&sz ConfigDialog.VarChanged_fontBoldcGs)|jj}|jddd|dS)Nr6Indentz num-spaces)r}r8r9)rHr:rrJrJrKr'sz ConfigDialog.VarChanged_spaceNumcGs|jdS)N)OnNewColourSet)rHr:rJrJrKr(szConfigDialog.VarChanged_colourcGs3|jj}|jddd||jdS)Nr6Themename)rr8r9PaintThemeSample)rHr:rrJrJrKr)sz$ConfigDialog.VarChanged_builtinThemecGsB|jj}|dkr>|jddd||jndS)Nz- no custom themes -r6r=r>)rr8r9r?)rHr:rrJrJrKr*s z#ConfigDialog.VarChanged_customThemecGsF|jj}|jddd||r8|jn |jdS)Nr6r=default)rr8r9r)r*)rHr:rrJrJrKr+s  z&ConfigDialog.VarChanged_themeIsBuiltincGs|jdS)N)SetHighlightTarget)rHr:rJrJrKr,sz'ConfigDialog.VarChanged_highlightTargetcGs|jj}|jj}|jjtjd}tj|rb|jd|||n/tj |}|d}|jd|||dS)NrkeysZ _cfgBindings extensions) rr8rrANCHORsplitrZ IsCoreBindingr9ZGetExtnNameForEvent)rHr:rkeySetrZextNameZextKeybindSectionrJrJrKr-s z"ConfigDialog.VarChanged_keyBindingcGs6|jj}|jddd||j|dS)Nr6rNr>)rr8r9 LoadKeysList)rHr:rrJrJrKr.sz#ConfigDialog.VarChanged_builtinKeyscGsE|jj}|dkrA|jddd||j|ndS)Nz- no custom keys -r6rNr>)rr8r9rG)rHr:rrJrJrKr/"s z"ConfigDialog.VarChanged_customKeyscGsF|jj}|jddd||r8|jn |jdS)Nr6rNr@)rr8r9r.r/)rHr:rrJrJrKr0(s  z&ConfigDialog.VarChanged_keysAreBuiltincGs)|jj}|jddd|dS)Nr6r7r-)rr8r9)rHr:rrJrJrKr10sz ConfigDialog.VarChanged_winWidthcGs)|jj}|jddd|dS)Nr6r7r,)rr8r9)rHr:rrJrJrKr24sz!ConfigDialog.VarChanged_winHeightcGs)|jj}|jddd|dS)Nr6rOzeditor-on-startup)rr8r9)rHr:rrJrJrKr38sz#ConfigDialog.VarChanged_startupEditcGs)|jj}|jddd|dS)Nr6rOautosave)rr8r9)rHr:rrJrJrKr4<sz ConfigDialog.VarChanged_autoSavecGs)|jj}|jddd|dS)Nr6r7r)rr8r9)rHr:rrJrJrKr5@sz ConfigDialog.VarChanged_encodingcCs)iid6id6id6id6|_dS)Nr6 highlightrBrC) changedItems)rHrJrJrKr:DszConfigDialog.ResetChangedItemscCsLt|}||j|kr3i|j||tjddtjdd}t|d||j}|S)NuserrBr@zNew Custom Key Set)rrOrrY)rHrd usedNamesrerJrJrKrZs zConfigDialog.GetNewKeysNamecCs)|jd}|r%|j|ndS)NzNew Key Set Name:)rZr])rHZ newKeysNamerJrJrKrszConfigDialog.SaveAsNewKeySetcCs|jjdtdS)Nr)rrrV)rHrrJrJrKrszConfigDialog.KeyBindingSelectedc Cs&|jjr!|jj}n|jj}tj|}i}x;|D]3}|dd}dj||}||||jj}d}tjd||d|s5dStjdj|||jdkrm|jd|=ntjdjtj dd}|j |s|j j dt |jj|dn|jj||d|jjtjd jd d |jjtjd jd d |j|jdS) Nz0Are you sure you wish to delete the key set %r ?zDelete Key Setr1rBrfrz- no custom keys -rr6rNr@r>)rr8 tkMessageBoxaskyesnoruserCfgremove_sectionrJSaverOrkr rrr rlrrrPrRrrfr )rHrodelmsgitemListrJrJrKrs& ## zConfigDialog.DeleteCustomKeyscCs>|jj}d}tjd||d|s5dStjdj|||jdkrm|jd|=ntjdjtj dd}|j |s|j j dt |jj|dn|jj||d|jjtjd jd d |jjtjd jd d |j|jdS) Nz.Are you sure you wish to delete the theme %r ?z Delete Themer1rIrfrz- no custom themes -rr6r=r@r>)rr8rqrrrrsrtrJrurOrkrrrrrlrrrPrRrrfr)rH themeNamervrwrJrJrKrs& ## zConfigDialog.DeleteCustomThemecCs|jj}|jjd}tjd|dd|d|\}}|r||kr|jjrd}|j|}|sdS|j||j j |q|j j |ndS)Nbgr1r5zPick new colour for : Z initialcolorz_Your changes will be saved as a new Custom Theme. Enter a name for your new Custom Theme below.) rr8rZcgettkColorChooserZaskcolorrGetNewThemeNameCreateNewThemerr)rHtargetZ prevColourZ rgbTupletZ colourStringrdnewThemerJrJrKrs  zConfigDialog.GetColourcCs|jj}|jjd||jjr7dnd}|j|jjd}|jj|i||6|j j}|d|}|j d|||dS)Nry foreground backgroundr-rI) rr8rrrr9rr tag_configrr9)rHZ newColourplaneZ sampleElementthemeZ themeElementrJrJrKr<$szConfigDialog.OnNewColourSetcCs>tjddtjdd}t|d||j}|S)NrfrIr@zNew Custom Theme)rrOrrY)rHrdrgr~rJrJrKr{.s zConfigDialog.GetNewThemeNamecCs)|jd}|r%|j|ndS)NzNew Theme Name:)r{r|)rH newThemeNamerJrJrKr5szConfigDialog.SaveAsNewThemecCs|jjr'd}|jj}nd}|jj}tj||}||jdkr|jd|}x|D]}|||||jjdt|jjdtn^|jjrv|jjdt|jjdtn&|jjdt|jjdtdS)Nrqr)rsizerrrr"rmrV)rHrJrJrKrsz$ConfigDialog.SetHelpListButtonStatescCsht|dj}|rZ|jj|d|df|jjt|d|jn|jdS)NzNew Help Sourcerrq) rrY userHelpListappendrrrUpdateUserHelpChangedItemsr)rH helpSourcerJrJrKr s  zConfigDialog.HelpListItemAddcCs|jjt}|j|}t|dd|dd|dj}| sX||kr\dS||j|<|jj||jj||d|j|j dS)NzEdit Help SourceZmenuItemrZfilePathrq) rrWrDrrrYr^rrr)rH itemIndexrZ newHelpSourcerJrJrKrs   zConfigDialog.HelpListItemEditcCsD|jjt}|j|=|jj||j|jdS)N)rrWrDrr^rr)rHrrJrJrKr!s   zConfigDialog.HelpListItemRemovec Csvi|jdd.z font-sizetypeintr'789r)r+131416182022z font-boldrbool) rrrz10z11z12rrrrrr)rr~Zfamiliesrkrrrr GetOptionrr{rrWrnr[r\rrlrzr)rHZfontsrsZconfiguredFontZlc_configuredFontZlc_fontsZcurrentFontIndexrxrJrJrK LoadFontCfgs*      zConfigDialog.LoadFontCfgcCs5tjddddddd}|jj|dS)Nr6r;z num-spacesr@rrr)rrr}r)rHr}rJrJrK 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)Nr6r=r@rrrqrIrfrz- no custom themes -rrpcsj|dS)Nrq)r9)x)rHrJrKrsz+ConfigDialog.LoadThemeCfg..)rrrrZ CurrentThemer8rOrkrrlrrrrrrrr9rBrr?rA)rH currentOptionrwZ themeNamesrJ)rHrK 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) Nr6rNr@rrrqrBrfrz- no custom keys -r)rrrrZ CurrentKeysr8rOrkr rlr rrrr r rG)rHrrwrorJrJrK 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)Nr6rOzeditor-on-startupr@rqrrrHrr7r-rr,rZnone)rrrrrrrrZGetAllExtraHelpSourcesListrrrrr)rHZhelpItemrJrJrKLoadGeneralCfgszConfigDialog.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)rHrJrJrKrD1s     zConfigDialog.LoadConfigscCsftjdj|s-tjdj|nx2|D]*}||}tjdj|||q4WdS)z save a newly created core key set. keySetName - string, the name of the new key set keySet - dictionary containing the new key set rBN)rrs has_section add_section SetOption)rHrorFrrrJrJrKrj@s   zConfigDialog.SaveNewKeySetcCsftjdj|s-tjdj|nx2|D]*}||}tjdj|||q4WdS)z save a newly created theme. themeName - string, the name of the new theme theme - dictionary containing the new theme rIN)rrsrrr)rHrxrrrrJrJrKrLs   zConfigDialog.SaveNewThemecCsltj|j||rRtj|j|||krRtj|j||Sntj|j|||S)N)rrPZ has_optionrRrs RemoveOptionr)rHrSrMrNrrJrJrK SetUserValueXszConfigDialog.SetUserValuecCstjdjx|jD]}d}x|j|D]}|dkrdtjdjdd}nxO|j||D]<}|j|||}|j||||rvd}qvqvWq5W|rtj|jqqWx%ddgD]}tj|jqW|jdS)z3Save configuration changes to the user config file.r6FrTrBrIN)rrsrurJrtrr:)rHrSZcfgTypeHasChangesrMrNrrJrJrKSaveAllChangedConfigs`s   z"ConfigDialog.SaveAllChangedConfigscCs1|jjj}x|D]}|jqWdS)N)r1r2rBZRemoveKeybindings)rH winInstancesinstancerJrJrKDeactivateCurrentConfigus z$ConfigDialog.DeactivateCurrentConfigcCsY|jjj}x@|D]8}|j|j|j|j|jqWdS)z'Dynamically apply configuration changesN)r1r2rBZResetColorizerZ ResetFontZset_notabs_indentwidthZApplyKeybindingsZreset_help_menu_entries)rHrrrJrJrKActivateConfigChanges|s     z"ConfigDialog.ActivateConfigChangescCs|jdS)N)destroy)rHrJrJrKrAszConfigDialog.CancelcCs|j|jdS)N)rfr)rHrJrJrKrcs zConfigDialog.OkcCs"|j|j|jdS)N)rrr)rHrJrJrKrfs  zConfigDialog.ApplycCsdS)NrJ)rHrJrJrKHelpszConfigDialog.Help)K__name__ __module__ __qualname__r0r;r[rWrXrYrZrEr$r%r&r'r(r)r*r+r,r-r.r/r0r1r2r3r4r5r:r9rUrr rrZrrr]rGrrrr<r{rr|rrrArrr?rrr rr!rrrrrrrDrjrrrrrrArcrfrrJrJrJrKr s 4  D l M `                    $                       !         r c@s"eZdZdZddZdS)VerticalScrolledFramezA 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 cs0tj||||t|dt}|jdtdtdtt|ddddd|j jdt dt dt |j d jjdjdt|_jddd d tfd d }jd|fdd}jd|dS)NrtrRrPrQZbdrrrnrdZwindowrvcsajjf}jdd|jjkr]jdjndS)NZ scrollregionz 0 0 %s %sr-)winfo_reqwidthZwinfo_reqheightr winfo_width)rr)canvasinteriorrJrK_configure_interiorsz;VerticalScrolledFrame.__init__.._configure_interiorz cs8jjkr4jdjndS)Nr-)rrZ itemconfigure)r)rr interior_idrJrK_configure_canvassz9VerticalScrolledFrame.__init__.._configure_canvas)rgr0rZVERTICALrSrrr=ZCanvasrrirVrUrrZ xview_movetoZ yview_movetorZ create_windowNWr)rHr1rkwZ vscrollbarrrrJ)rrrrKr0s    zVerticalScrolledFrame.__init__N)rrr__doc__r0rJrJrJrKrs rc Cs9|s dSyt|dSWntk r4dSYnXdS)z(Return 's is blank or represents an int'TFN)r ValueError)rrJrJrKis_ints  rc@seZdZdZddddZddZdd ZejZd d Z ej Z d d Z ej Z ddZ ddZddZdS)ConfigExtensionsDialogaA dialog for configuring IDLE extensions. This dialog is generic - it works for any and all IDLE extensions. IDLE extensions save their configuration options using idleConf. ConfigExtensionsDialog 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 an True/False button. NFcCs^tj|||j|jdd|jd|jd|j|sUdndf|j|ppdtj d|_ tj d|_ |j t |_ |j |j|jd td t|j||jd |j|jj|j|j|jd |jd td t|j|sZ|j|jndS) Nr r z+%d+%drrrzIDLE Extensions ConfigurationrCr,r-r.rq)r/r0r3r4r6r7r8Zwm_titlerrPrsregisterrload_extensionscreate_widgetsr<r=r>r@rAtabbed_page_setrCupdateZ wm_minsizerrUrFr?rG)rHr1r5rIrJrJrKr0s. !       zConfigExtensionsDialog.__init__c Csi|_x'tjddD]}g|j|.rawTTrueFalserrNrr@r>rvar)rCrZ GetExtensionssortedrPrQremoverRKeyErrorrrrsrwrrKr) rHext_nameZopt_listZenablesrZdef_strZdef_objZopt_typerrrJrJrKrsF               z&ConfigExtensionsDialog.load_extensionsc Cs|jddd|jddd|jdddt|d|jjddddd tj|_|jjd dd dd tx|jD]}|j |qW|j jd ddS) zCreate the dialog's widgets.rrrqrLZn_rowsNZmax_tabs_per_rowr Z page_classrrr) rrrrCrBZ PageRemoverrrcreate_tab_pager[)rHrrJrJrKr-s z%ConfigExtensionsDialog.create_widgetsc Cst|jj|jdddddtdd|}|jdtdd dd d dt|d dd d }|jdtdtdt |j }|j ddd|j dddxFt |j |D]1\}}t|d|d}|jd|dddt|d}|ddkr{t|d|d|dddddtd d!d"d#jd|dddtdd$q|dd%krt|d|d&d'd(|jd)fjd|dddtdd$qt|d|jd|dddtdd$qWd*S)+z!Create the page for an extension.Zborderrar^rlrbz %s rRrQTrr`r,rPrrrqr>rrrrrrrrorprrrrZ indicatoronZ selectcolorr r-rrZvalidaterpZvalidatecommandz%PN)rrrrrrSrVrr\rUrr enumeraterCrrrrr=rrrr) rHrZpageZscrolled_frameZ entry_arearoptZlabelrrJrJrKr@s2 "    z&ConfigExtensionsDialog.create_tab_pagecCs|jdS)N)save_all_changed_configs)rHrJrJrKrfgs zConfigExtensionsDialog.ApplycCsdS)NrJ)rHrJrJrKrmszConfigExtensionsDialog.HelpcCsv|d}|d}|djjp-|}|dj|||kr`|jj||S|jj|||S)Nr>r@r)r8striprrsrr)rHrMrr>r@rrJrJrKset_user_valueps   z%ConfigExtensionsDialog.set_user_valuecCsmd}xJ|jD]?}|j|}x)|D]!}|j||r*d}q*q*WqW|ri|jjndS)z3Save configuration changes to the user config file.FTN)rCrrsru)rHZ has_changesrrTrrJrJrKr|s  z/ConfigExtensionsDialog.save_all_changed_configs)rrrrr0rrr r[rrcrfrArrrrJrJrJrKrs  -   %     r__main__z#idlelib.idle_test.test_configdialog verbosityraexitF)run)$rZtkinterZtkinter.messageboxZ messageboxrqZtkinter.colorchooserZ colorchooserrzZ tkinter.fontrsr~Zidlelib.configHandlerrZidlelib.dynOptionMenuWidgetrZidlelib.tabbedpagesrZidlelib.keybindingDialogrZidlelib.configSectionNameDialogrZidlelib.configHelpSourceEditrZidlelibr r/r rgrrrrZunittestr6Zidlelib.idle_test.htestrrJrJrJrK s4 -