tQc@sdZddlTddlZddlZddlZddlZddlmZddlm Z ddl m Z ddl m Z ddlmZdd lmZdd lmZd efd YZed kreZeeddddjie_ejndS(sIDLE 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(tidleConf(t DynOptionMenu(t TabbedPageSet(t GetKeysDialog(tGetCfgSectionNameDialog(tGetHelpSourceDialog(t macosxSupportt ConfigDialogcBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!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.dHd-Z0d.Z1d/Z2d0Z3d1Z4d2Z5d3Z6d4Z7d5Z8d6Z9d7Z:d8Z;d9Z<d:Z=d;Z>d<Z?d=Z@d>ZAd?ZBd@ZCdAZDdBZEdCZFdDZGdEZHdFZIdGZJRS(IcCs\tj|||j|jdd|jd|jd|jd|jdfi d1d 6d2d 6d3d6d4d6d5d6d6d6d7d6d8d6d9d!6d:d$6d;d'6d<d*6d=d-6|_|j |j |j d.t d/t |j ||j|jd0|j||_|jj|j|j|j|jdS(>Nt borderwidthisIDLE Preferencess+%d+%diitnormalt00s Normal Texttkeywordt01sPython Keywordst definitiont02sPython Definitionstbuiltint03sPython Builtinstcommentt04sPython Commentststringt05sPython Stringsthilitet06s Selected Textthitt07s Found Texttcursort08tCursorterrort09s Error Texttconsolet10sShell Normal Texttstdoutt11sShell Stdout Texttstderrt12sShell Stderr TexttheighttwidthtWM_DELETE_WINDOW(R R (R R (RR(RR(RR(sstringR(RR(RR(scursorR(serrorR(RR (sstdoutR"(sstderrR$(tToplevelt__init__t wm_withdrawt configurettitletgeometryt winfo_rootxt winfo_rootyt themeElementstResetChangedItemst CreateWidgetst resizabletFALSEt transienttgrab_settprotocoltCanceltparentttabPagest focus_sett LoadConfigstAttachVarCallbackst wm_deiconifyt wait_window(tselfR9R,((s*/sys/lib/python2.7/idlelib/configDialog.pyR)s>             c Cst|dddddg|_t|dd}tjrHi}nidd 6d d6}t|d d d |jdt||_t|d dd |j dt||_ t|d dd |j dt||_ t|d dd |j dt||_|j|j|j|j|jjdtd d|j jdtd d|j jdtd d|jjdtd d|jdtt|ddddjdt|jjdtdtdtdS(Nt page_namess Fonts/Tabst HighlightingtKeystGeneraltpadyiitpadxittexttHelptcommandt takefocustOktApplyR8tsideiR%R itexpandtfill(RR:tFrameRtrunningAsOSXApptButtonRHR4t buttonHelpRKtbuttonOkRLt buttonApplyR8t buttonCanceltCreatePageFontTabtCreatePageHighlighttCreatePageKeystCreatePageGeneraltpacktRIGHTtLEFTtBOTTOMtTOPtTRUEtBOTH(R@tframeActionButtonst paddingArgs((s*/sys/lib/python2.7/idlelib/configDialog.pyR2Es:               "c Cst||_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| ddd td|j |_!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(,Ntcourieri R s Fonts/TabsR itreliefRGs Base Editor Font s Indentation Width tjustifys Font Face :R%iRJtexportselectionsRItyscrollcommandsSize :tvariabletonvalueitoffvalueitBolds,AaBbCcDdEe FfGgHhIiJjK 1234567890 #:+=(){}[]tfontsPython Standard: 4 Spaces!torientt horizontalt tickintervaltfrom_ttoiRMRFRERNROtanchori(Rdi snormal(+t StringVartfontSizet BooleanVartfontBoldtfontNametIntVartspaceNumttkFonttFontteditFontR:tpagestframet LabelFrametGROOVERPtLabelR]tListboxR4t listFontNametbindtOnListFontButtonReleaset ScrollbartconfigtyviewtsetRtNonet SetFontSampletoptMenuFontSizet CheckbuttontSOLIDtlabelFontSampletScalet scaleSpaceNumR[R`RatYR_tXtW( R@Rt frameFontt frameIndentt frameFontNametframeFontParamtlabelFontNameTitlet scrollFonttlabelFontSizeTitlet checkFontBoldtframeFontSampletframeIndentSizetlabelSpaceNumTitle((s*/sys/lib/python2.7/idlelib/configDialog.pyRWisf          ("""(c Cst||_t||_t||_t||_t||_t||_t||_|j j dj }t |dddt dd}t |dddt dd}t|dtddd dWd ddddddtdddt |_|j}|jdd|jdddXdYdZd[d\d]d^d_d`dadbdcdddedfdgdhdidjdkdldmdndodpdqdrdsdtdudvf}x)|D]!}|jt|d|dqWx;|jjD]*}|j|j|dd?|d@qW|jdAtt|dtdd|_t|}t|jddBdC|jdd} t|j|jddd|_!t"|dD|jdEdddFdC|j#|_$t"|dD|jdEdddGdC|j#|_%|jj&dt|ddHdC|j'} t(|ddI} t"|dD|jdEddC|j)ddJ|_*t"|dD|jdEddC|j)ddK|_+t||jddCd|_,t||jddCd|_-t|ddLdC|j.|_/|j0dMt1dNdOdPdOdQt2dRt3|j0dMt1dNdOdPdOdRt4|jj0dMt5dNdOdPdOdQt2dRt6|j0dMt5dNdOdPd|jj0dMt5dNdOdPdOdQt2dRt3| j0dMt5dQt2dRt6dNdSdPdT|j!j0dMt5dQt2dRt6dNdSdPdU|j$j0dMt1dVt7|j%j0dMt8dVt9| j0dMt:dRt6dNdOdPdO| j0dMt5dVt9dNdOdPdO|j*j0dMt5dVt9dNdO|j+j0dMt5dVt9dNdOdPd|j,j0dMt5dRt6dNdOdPdO|j-j0dMt5dRt6dVt9dNdOdPdO|j/j0dMt5dRt6dNdOdPdO|S(wNRBR iReRGs Custom Highlighting s Highlighting Theme iRmRdi tRthand2R&iR%i RJthighlightthicknessitwrapscSsdS(Ntbreak((te((s*/sys/lib/python2.7/idlelib/configDialog.pytss cSsdS(NR((R((s*/sys/lib/python2.7/idlelib/configDialog.pyRss#you can click hereRs R s#to choose itemstdefR t tfuncRs(param):s s """string"""Rs var0 = s'string's var1 = s 'selected'Rs var2 = s'found'Rs var3 = tlistRt(Rs) s error Rscursor |s tshellRR!R#scSs|jjjj|S(N(twidgettwinfo_toplevelthighlightTargetR(teventtelem((s*/sys/lib/python2.7/idlelib/configDialog.pyRststatesChoose Colour for :RIRitvaluet Foregroundt BackgroundsSave as New Custom Themes Select : sa Built-in Themesa Custom ThemesDelete Custom ThemeRMRFiRERNROiiiRs(scourieri R(s#you can click herescomment(s snormal(s#to choose itemsscomment(s snormal(Rskeyword(Rsnormal(sfuncs definition(s(param):snormal(s snormal(s """string"""sstring(s var0 = snormal(s'string'sstring(s var1 = snormal(s 'selected'shilite(s var2 = snormal(s'found'shit(s var3 = snormal(slistsbuiltin(Rsnormal(sNonesbuiltin(s) snormal(s error serror(Rsnormal(scursor |R(s snormal(sshellsconsole(Rsnormal(sstdoutsstdout(Rsnormal(sstderrsstderr(s snormal(;Rtt builtinThemet customThemeRvtfgHilitetcolourRxtthemeIsBuiltinRR:R~RRRtTextRR4tNONEttextHighlightSampleRtinserttENDR0tkeysttag_bindRtDISABLEDRPtframeColourSetRRt GetColourRRtoptMenuHighlightTargett RadiobuttontSetColourSampleBindingtradioFgtradioBgRtSaveAsNewThemeRt SetThemeTypetradioThemeBuiltintradioThemeCustomtoptMenuThemeBuiltintoptMenuThemeCustomtDeleteCustomThemetbuttonDeleteCustomThemeR[R]R`RaRR_RtER\RR^( R@Rt frameCustomt frameThemeRGt textAndTagsttxTatelementt frameFgBgtbuttonSetColourtbuttonSaveCustomThemetlabelTypeTitle((s*/sys/lib/python2.7/idlelib/configDialog.pyRXs              ("+$(+""%%+%c Cst||_t||_t||_t||_t||_|jjdj }t |dddt dd}t |dddt dd}t |}t |dd}t|}t|d t}t|d td t|_|jjd |j|jd |jj|jd |jj|jjd|j|jjd|jt|ddd |jdt|_gtdD]$}t |dddddd^q} t| dd|jddd |jdd|_ t| dd|jddd |jdd|_!t"| d|jdd d|_$t"| d|jdd d|_%t| dddd |j&|_'t| dddd |j(} |j)dt*dddddt+dt,|j)dt*dddddt,|jj)dt*dt-dddd|j)dt.dddddt+dt,|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.dt-dt6dd| j)dt.dt-dt6dd| dj)dt7dt,dt6| dj)dt7dt-dt6dd|S(%NRCR iReRGs Custom Key Bindings s Key Set sAction - Key(s)RnRJRgsRIRhtxscrollcommandsGet New Keys for SelectionRRFREiRiRisUse a Built-in Key SetsUse a Custom Key SetsDelete Custom Key SetsSave as New Custom Key SetRMiRNROtweighttrowtcolumnt columnspantsticky(8Rtt bindingTargett builtinKeyst customKeysRvtkeysAreBuiltint keyBindingR:R~RRRRPRRt HORIZONTALRR4t listBindingsRtKeyBindingSelectedRRtxviewRRRt GetNewKeysRt buttonNewKeystrangeRt SetKeysTypetradioKeysBuiltintradioKeysCustomRRtoptMenuKeysBuiltintoptMenuKeysCustomtDeleteCustomKeystbuttonDeleteCustomKeystSaveAsNewKeySetR[R^R`RaRR]tcolumnconfiguret rowconfiguretgridRtNSEWtNStEWtTrueR_( R@RRt frameKeySetst frameTargettlabelTargetTitlet scrollTargetYt scrollTargetXtitframestbuttonSaveCustomKeys((s*/sys/lib/python2.7/idlelib/configDialog.pyRYsp     4   ("%("##%" &c Cst||_t||_t||_t||_t||_t||_t||_ t||_ |j j dj }t|dddtdd}t|dddtdd}t|dddt}t|dddt}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|ddd}t|dd}t|d|jdd}t|dd}t|d|jdd}t|ddd}t|d|jdd}t|dd}t|d |jd ddd}t|d |jd d dd!}t|d |jd d"dd#}t|}t|}t|}t|d$d%d&td't|_|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'd0d%d1d%d2t(|j&d/t'd0d%d1d%d2t(|j&d/t'd0d%d1d%d2t(|j&d/t'd0d%d1d%d2t(|j&d/t'd0d%d1d%d2t(|j&d/t'd0d%d1d%d3t)d2t*|j&d/t+d4t,d0d%d1d%| j&d/t-d4t,d0d%d1d%| j&d/t-d4t,d0d%d1d%| j&d/t+d4t,d0d%d1d%| j&d/t-d4t,d0d%d1d%| j&d/t-d4t,d0d%d1d%|j&d/t+d4t,d0d%d1d%|j&d/t-d4t.d0d5d1d%|j&d/t-d4t.d1d%|j&d/t-d4t.d0d5d1d%|j&d/t-d4t.d1d%|j&d/t+d4t,d0d%d1d%|j&d/t-d4t.d0d5d1d%|j&d/t+d4t,d0d%d1d%|j&d/t-d4t.d1d%|j&d/t-d4t.d1d%|j&d/t-d4t.d1d%|j&d/t-d0d%d1d%d2t/|j&d/t'd0d%d1d%d3t)d2t*|j&d/t-d4t,d2t/|jj&d/t+d4t.d3t)d2t*|j!j&d/t'd4t,d1d%|j#j&d/t'd4t,|j%j&d/t'd4t,d1d%|S(6NRDR iReRGs Startup Preferences s Autosave Preferences s Additional Help Sources s At StartupRiRiRIsOpen Edit WindowisOpen Shell WindowsAt Start of Run (F5) sPrompt to Saves No PromptsInitial Window Sizes (in characters)tWidtht textvariableR&itHeightsParagraph reformats width (in characters)sDefault Source EncodingtlocalesLocale-definedsutf-8sUTF-8tnoneRR%iRJRgRhstEditRitAddtRemoveRMRFRERORNRsi (0RttwinWidtht winHeightt paraWidthRyt startupEdittautoSavetencodingRvtuserHelpBrowsert helpBrowserR:R~RRRRPRRRtEntryRRR4tlistHelpRRRRtHelpSourceSelectedRRRtHelpListItemEdittbuttonHelpListEdittHelpListItemAddtbuttonHelpListAddtHelpListItemRemovetbuttonHelpListRemoveR[R_RR`RaR]RR\RR(R@RtframeRunt frameSavet frameWinSizet frameParaSizet frameEncodingt frameHelptlabelRunChoiceTitletradioStartupEdittradioStartupShelltlabelRunSaveTitlet radioSaveAskt radioSaveAutotlabelWinSizeTitletlabelWinWidthTitlet entryWinWidthtlabelWinHeightTitletentryWinHeighttlabelParaWidthTitletentryParaWidthtlabelEncodingTitletradioEncLocalet radioEncUTF8t radioEncNonet frameHelpListtframeHelpListButtonstscrollHelpList((s*/sys/lib/python2.7/idlelib/configDialog.pyRZFs              """""("""""""""""""(%cCs|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$|j%jd|j&dS(Ntw('Ruttrace_variabletVarChanged_fontSizeRxtVarChanged_fontNameRwtVarChanged_fontBoldRztVarChanged_spaceNumRtVarChanged_colourRtVarChanged_builtinThemeRtVarChanged_customThemeRtVarChanged_themeIsBuiltinRtVarChanged_highlightTargetRtVarChanged_keyBindingRtVarChanged_builtinKeysRtVarChanged_customKeysRtVarChanged_keysAreBuiltinRtVarChanged_winWidthRtVarChanged_winHeightRtVarChanged_paraWidthRtVarChanged_startupEditRtVarChanged_autoSaveRtVarChanged_encoding(R@((s*/sys/lib/python2.7/idlelib/configDialog.pyR=s&cGs)|jj}|jddd|dS(Ntmaint EditorWindows font-size(RutgettAddChangedItem(R@tparamsR((s*/sys/lib/python2.7/idlelib/configDialog.pyR;scGs)|jj}|jddd|dS(NRNRORm(RxRPRQ(R@RRR((s*/sys/lib/python2.7/idlelib/configDialog.pyR<scGs)|jj}|jddd|dS(NRNROs font-bold(RwRPRQ(R@RRR((s*/sys/lib/python2.7/idlelib/configDialog.pyR=scGs)|jj}|jddd|dS(NRNtIndents num-spaces(RzRPRQ(R@RRR((s*/sys/lib/python2.7/idlelib/configDialog.pyR>scGs|jdS(N(tOnNewColourSet(R@RR((s*/sys/lib/python2.7/idlelib/configDialog.pyR?scGs3|jj}|jddd||jdS(NRNtThemetname(RRPRQtPaintThemeSample(R@RRR((s*/sys/lib/python2.7/idlelib/configDialog.pyR@scGsB|jj}|dkr>|jddd||jndS(Ns- no custom themes -RNRURV(RRPRQRW(R@RRR((s*/sys/lib/python2.7/idlelib/configDialog.pyRAs cGsF|jj}|jddd||r8|jn |jdS(NRNRUtdefault(RRPRQR@RA(R@RRR((s*/sys/lib/python2.7/idlelib/configDialog.pyRBs  cGs|jdS(N(tSetHighlightTarget(R@RR((s*/sys/lib/python2.7/idlelib/configDialog.pyRCscGs|jj}|jj}|jjtjd}tj|rb|jd|||n/tj |}|d}|jd|||dS(NiRt _cfgBindingst extensions( RRPRRtANCHORtsplitRt IsCoreBindingRQtGetExtnNameForEvent(R@RRRtkeySetRtextNametextKeybindSection((s*/sys/lib/python2.7/idlelib/configDialog.pyRDs cGs6|jj}|jddd||j|dS(NRNRCRV(RRPRQt LoadKeysList(R@RRR((s*/sys/lib/python2.7/idlelib/configDialog.pyREscGsE|jj}|dkrA|jddd||j|ndS(Ns- no custom keys -RNRCRV(RRPRQRc(R@RRR((s*/sys/lib/python2.7/idlelib/configDialog.pyRFs cGsF|jj}|jddd||r8|jn |jdS(NRNRCRX(RRPRQRERF(R@RRR((s*/sys/lib/python2.7/idlelib/configDialog.pyRG s  cGs)|jj}|jddd|dS(NRNROR&(RRPRQ(R@RRR((s*/sys/lib/python2.7/idlelib/configDialog.pyRHscGs)|jj}|jddd|dS(NRNROR%(RRPRQ(R@RRR((s*/sys/lib/python2.7/idlelib/configDialog.pyRIscGs)|jj}|jddd|dS(NRNtFormatParagrapht paragraph(RRPRQ(R@RRR((s*/sys/lib/python2.7/idlelib/configDialog.pyRJscGs)|jj}|jddd|dS(NRNRDseditor-on-startup(RRPRQ(R@RRR((s*/sys/lib/python2.7/idlelib/configDialog.pyRKscGs)|jj}|jddd|dS(NRNRDtautosave(RRPRQ(R@RRR((s*/sys/lib/python2.7/idlelib/configDialog.pyRL#scGs)|jj}|jddd|dS(NRNROR(RRPRQ(R@RRR((s*/sys/lib/python2.7/idlelib/configDialog.pyRM'scCs)iid6id6id6id6|_dS(NRNt highlightRR[(t changedItems(R@((s*/sys/lib/python2.7/idlelib/configDialog.pyR1+scCsLt|}||j|kr3i|j||    cCs>tjddtjdd}t|d||j}|S(NtuserRRXsNew Custom Key Set(RRmRR{(R@Rt usedNamesR((s*/sys/lib/python2.7/idlelib/configDialog.pyR|s  cCs)|jd}|r%|j|ndS(NsNew Key Set Name:(R|R(R@t newKeysName((s*/sys/lib/python2.7/idlelib/configDialog.pyRscCs|jjdtdS(NR(RRRw(R@R((s*/sys/lib/python2.7/idlelib/configDialog.pyRsc Cs5|jjr!|jj}n|jj}tj|}i}x>|jD]0}|dd!}tj||}|||tjddtjdd}t|d||j}|S(NRRgRXsNew Custom Theme(RRmRR{(R@RRR((s*/sys/lib/python2.7/idlelib/configDialog.pyRs  cCs)|jd}|r%|j|ndS(NsNew Theme Name:(RR(R@t newThemeName((s*/sys/lib/python2.7/idlelib/configDialog.pyRscCs|jjr'd}|jj}nd}|jj}tj||}||jdjkr|jd|}x%|jD]}|||||jjdt|jjdtn^|jjrv|jjdt|jjdtn&|jjdt|jjdtdS(NiR(RtsizeRRRRRRw(R@((s*/sys/lib/python2.7/idlelib/configDialog.pyRuscCsht|dj}|rZ|jj|d|df|jjt|d|jn|jdS(NsNew Help Sourceii( RR{t userHelpListtappendRRRtUpdateUserHelpChangedItemsR(R@t helpSource((s*/sys/lib/python2.7/idlelib/configDialog.pyRs  cCs|jjt}|j|}t|dd|dd|dj}| sX||kr\dS||j|<|jj||jj||d|j|j dS(NsEdit Help SourcetmenuItemitfilePathi( RRxR\RRR{RRRR(R@t itemIndexRt newHelpSource((s*/sys/lib/python2.7/idlelib/configDialog.pyRs    cCsD|jjt}|j|=|jj||j|jdS(N(RRxR\RRRR(R@R((s*/sys/lib/python2.7/idlelib/configDialog.pyRs   c Cssi|jddR?R@RARBRCRDRERFRGRHRIRJRKRLRMR1RQRvRRRR|RRRRcRRRRTRRRRRRRYRRRWRRRRRRRRRRRR<RRRRRRR8RKRLRH(((s*/sys/lib/python2.7/idlelib/configDialog.pyRs + $ ? Y E p                      $                      !         t__main__RGtDialogRIcCs ttdS(NtSettings(Rtroot(((s*/sys/lib/python2.7/idlelib/configDialog.pyRs(t__doc__tTkinterRRR{Rtidlelib.configHandlerRtidlelib.dynOptionMenuWidgetRtidlelib.tabbedpagesRtidlelib.keybindingDialogRtidlelib.configSectionNameDialogRtidlelib.configHelpSourceEditRtidlelibRR(RRtTkRRRR[Rtmainloop(((s*/sys/lib/python2.7/idlelib/configDialog.pyt s* $ l