|G_Tc@sdZddlTddlZddlZddlZddlZddlmZddlm Z ddl m Z ddl m Z ddlmZdd lmZdd lmZd efd YZed krddlmZeendS(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 ConfigDialogcBseZedZdZdZdZdZdZdZ dZ dZ d Z d Z d Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!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-Z1d.Z2d/Z3d0Z4d1Z5d2Z6d3Z7d4Z8d5Z9d6Z:d7Z;d8Z<d9Z=d:Z>d;Z?d<Z@d=ZAd>ZBd?ZCd@ZDdAZEdBZFdCZGdDZHdEZIdFZJdGZKRS(IcCsztj|||j|jdd|jd|rIi|_n|jd|jd|j|stdndfi d3d 6d4d 6d5d6d6d6d7d6d8d6d9d6d:d6d;d"6d<d%6d=d(6d>d+6d?d.6|_ |j |j |j d/t d0t |j||j|jd1|j||_|jj|j|j|j|jd2S(@sG _htest - bool, change box location when running htest t borderwidthisIDLE Preferencess+%d+%diiitnormalt00s Normal Texttkeywordt01sPython Keywordst definitiont02sPython Definitionstbuiltint03sPython Builtinstcommentt04sPython Commentststringt05sPython Stringsthilitet06s Selected Textthitt07s Found Texttcursort08tCursorterrort09s Error Texttconsolet10sShell Normal Texttstdoutt11sShell Stdout Texttstderrt12sShell Stderr TexttheighttwidthtWM_DELETE_WINDOWN(R R (R R (RR(RR(RR(sstringR(RR(RR(scursorR(serrorR(RR (sstdoutR"(sstderrR$(tToplevelt__init__t wm_withdrawt configurettitlet instance_dicttgeometryt winfo_rootxt winfo_rootyt themeElementstResetChangedItemst CreateWidgetst resizabletFALSEt transienttgrab_settprotocoltCanceltparentttabPagest focus_sett LoadConfigstAttachVarCallbackst wm_deiconifyt wait_window(tselfR:R,t_htest((s0/usr/local/lib/python2.7/idlelib/configDialog.pyR)sB   !           c Cst|dddddg|_t|dd}tjrHi}nidd 6d d6}t|d d d |jdt||_t|d dd |j dt||_ t|d dd |j dt||_ |j |j|j|j|jjdtd d|j jdtd d|j jdtd d|jdtt|ddddjdt|jjdtdtdtdS(Nt page_namess Fonts/Tabst HighlightingtKeystGeneraltpadyiitpadxittexttOktcommandt takefocustApplyR9tsideiR%R itexpandtfill(RR;tFrameRtisAquaTktButtonRJR5tbuttonOkRMt buttonApplyR9t buttonCanceltCreatePageFontTabtCreatePageHighlighttCreatePageKeystCreatePageGeneraltpacktLEFTtBOTTOMtTOPtTRUEtBOTH(RAtframeActionButtonst paddingArgs((s0/usr/local/lib/python2.7/idlelib/configDialog.pyR3Js2             "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 itreliefRIs Base Editor Font s Indentation Width tjustifys Font Face :R%iRLtexportselectionsRKtyscrollcommandsSize :tvariabletonvalueitoffvalueitBolds,AaBbCcDdEe FfGgHhIiJjK 1234567890 #:+=(){}[]tfontsPython Standard: 4 Spaces!torientt horizontalt tickintervaltfrom_ttoiRNRHRGRORPtanchori(Rci snormal(+t StringVartfontSizet BooleanVartfontBoldtfontNametIntVartspaceNumttkFonttFontteditFontR;tpagestframet LabelFrametGROOVERQtLabelR\tListboxR5t listFontNametbindtOnListFontButtonReleaset ScrollbartconfigtyviewtsetRtNonet SetFontSampletoptMenuFontSizet CheckbuttontSOLIDtlabelFontSampletScalet scaleSpaceNumR[R_R`tYR^tXtW( RAR~t frameFontt frameIndentt frameFontNametframeFontParamtlabelFontNameTitlet scrollFonttlabelFontSizeTitlet checkFontBoldtframeFontSampletframeIndentSizetlabelSpaceNumTitle((s0/usr/local/lib/python2.7/idlelib/configDialog.pyRWosf          ("""(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(wNRDR iRdRIs Custom Highlighting s Highlighting Theme iRlRci tRthand2R&iR%i RLthighlightthicknessitwrapscSsdS(Ntbreak((te((s0/usr/local/lib/python2.7/idlelib/configDialog.pytss cSsdS(NR((R((s0/usr/local/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((s0/usr/local/lib/python2.7/idlelib/configDialog.pyRststatesChoose Colour for :RKRhtvaluet Foregroundt BackgroundsSave as New Custom Themes Select : sa Built-in Themesa Custom ThemesDelete Custom ThemeRNRHiRGRORPiiiRr(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(;Rst builtinThemet customThemeRutfgHilitetcolourRwtthemeIsBuiltinRR;R}R~RRtTextRR5tNONEttextHighlightSampleRtinserttENDR1tkeysttag_bindRtDISABLEDRQtframeColourSetRSt GetColourRRtoptMenuHighlightTargett RadiobuttontSetColourSampleBindingtradioFgtradioBgRtSaveAsNewThemeRt SetThemeTypetradioThemeBuiltintradioThemeCustomtoptMenuThemeBuiltintoptMenuThemeCustomtDeleteCustomThemetbuttonDeleteCustomThemeR[R\R_R`RR^RtEtRIGHTRR]( RAR~t frameCustomt frameThemeRIt textAndTagsttxTatelementt frameFgBgtbuttonSetColourtbuttonSaveCustomThemetlabelTypeTitle((s0/usr/local/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(%NRER iRdRIs Custom Key Bindings s Key Set sAction - Key(s)RmRLRfsRKRgtxscrollcommandsGet New Keys for SelectionRRHRGiRhRisUse a Built-in Key SetsUse a Custom Key SetsDelete Custom Key SetsSave as New Custom Key SetRNiRORPtweighttrowtcolumnt columnspantsticky(8Rst bindingTargett builtinKeyst customKeysRutkeysAreBuiltint keyBindingR;R}R~RRRQRRt HORIZONTALRR5t listBindingsRtKeyBindingSelectedRRtxviewRRSt GetNewKeysRt buttonNewKeystrangeRt SetKeysTypetradioKeysBuiltintradioKeysCustomRRtoptMenuKeysBuiltintoptMenuKeysCustomtDeleteCustomKeystbuttonDeleteCustomKeystSaveAsNewKeySetR[R]R_R`RR\tcolumnconfiguret rowconfiguretgridRtNSEWtNStEWtTrueR^( RAR~Rt frameKeySetst frameTargettlabelTargetTitlet scrollTargetYt scrollTargetXtitframestbuttonSaveCustomKeys((s0/usr/local/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(6NRFR iRdRIs Startup Preferences s Autosave Preferences s Additional Help Sources s At StartupRhRiRKsOpen 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%iRLRfRgstEditRitAddtRemoveRNRHRGRPRORri (0RstwinWidtht winHeightt paraWidthRxt startupEdittautoSavetencodingRutuserHelpBrowsert helpBrowserR;R}R~RRRQRRRtEntryRRR5tlistHelpRRRRtHelpSourceSelectedRSRtHelpListItemEdittbuttonHelpListEdittHelpListItemAddtbuttonHelpListAddtHelpListItemRemovetbuttonHelpListRemoveR[R^RR_R`R\RRRR(RAR~tframeRunt frameSavet frameWinSizet frameParaSizet frameEncodingt frameHelptlabelRunChoiceTitletradioStartupEdittradioStartupShelltlabelRunSaveTitlet radioSaveAskt radioSaveAutotlabelWinSizeTitletlabelWinWidthTitlet entryWinWidthtlabelWinHeightTitletentryWinHeighttlabelParaWidthTitletentryParaWidthtlabelEncodingTitletradioEncLocalet radioEncUTF8t radioEncNonet frameHelpListtframeHelpListButtonstscrollHelpList((s0/usr/local/lib/python2.7/idlelib/configDialog.pyRZLs              """""("""""""""""""(%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('Rtttrace_variabletVarChanged_fontSizeRwtVarChanged_fontNameRvtVarChanged_fontBoldRytVarChanged_spaceNumRtVarChanged_colourRtVarChanged_builtinThemeRtVarChanged_customThemeRtVarChanged_themeIsBuiltinRtVarChanged_highlightTargetRtVarChanged_keyBindingRtVarChanged_builtinKeysRtVarChanged_customKeysRtVarChanged_keysAreBuiltinRtVarChanged_winWidthRtVarChanged_winHeightRtVarChanged_paraWidthRtVarChanged_startupEditRtVarChanged_autoSaveRtVarChanged_encoding(RA((s0/usr/local/lib/python2.7/idlelib/configDialog.pyR>s&cGs)|jj}|jddd|dS(Ntmaint EditorWindows font-size(RttgettAddChangedItem(RAtparamsR((s0/usr/local/lib/python2.7/idlelib/configDialog.pyR;scGs)|jj}|jddd|dS(NRNRORl(RwRPRQ(RARRR((s0/usr/local/lib/python2.7/idlelib/configDialog.pyR<scGs)|jj}|jddd|dS(NRNROs font-bold(RvRPRQ(RARRR((s0/usr/local/lib/python2.7/idlelib/configDialog.pyR=scGs)|jj}|jddd|dS(NRNtIndents num-spaces(RyRPRQ(RARRR((s0/usr/local/lib/python2.7/idlelib/configDialog.pyR>scGs|jdS(N(tOnNewColourSet(RARR((s0/usr/local/lib/python2.7/idlelib/configDialog.pyR?scGs3|jj}|jddd||jdS(NRNtThemetname(RRPRQtPaintThemeSample(RARRR((s0/usr/local/lib/python2.7/idlelib/configDialog.pyR@scGsB|jj}|dkr>|jddd||jndS(Ns- no custom themes -RNRURV(RRPRQRW(RARRR((s0/usr/local/lib/python2.7/idlelib/configDialog.pyRAs cGsF|jj}|jddd||r8|jn |jdS(NRNRUtdefault(RRPRQR@RA(RARRR((s0/usr/local/lib/python2.7/idlelib/configDialog.pyRBs  cGs|jdS(N(tSetHighlightTarget(RARR((s0/usr/local/lib/python2.7/idlelib/configDialog.pyRCscGs|jj}|jj}|jjtjd}tj|rb|jd|||n/tj |}|d}|jd|||dS(NiRt _cfgBindingst extensions( RRPRRtANCHORtsplitRt IsCoreBindingRQtGetExtnNameForEvent(RARRRtkeySetRtextNametextKeybindSection((s0/usr/local/lib/python2.7/idlelib/configDialog.pyRDs cGs6|jj}|jddd||j|dS(NRNRERV(RRPRQt LoadKeysList(RARRR((s0/usr/local/lib/python2.7/idlelib/configDialog.pyREscGsE|jj}|dkrA|jddd||j|ndS(Ns- no custom keys -RNRERV(RRPRQRc(RARRR((s0/usr/local/lib/python2.7/idlelib/configDialog.pyRF s cGsF|jj}|jddd||r8|jn |jdS(NRNRERX(RRPRQRERF(RARRR((s0/usr/local/lib/python2.7/idlelib/configDialog.pyRGs  cGs)|jj}|jddd|dS(NRNROR&(RRPRQ(RARRR((s0/usr/local/lib/python2.7/idlelib/configDialog.pyRHscGs)|jj}|jddd|dS(NRNROR%(RRPRQ(RARRR((s0/usr/local/lib/python2.7/idlelib/configDialog.pyRIscGs)|jj}|jddd|dS(NRNtFormatParagrapht paragraph(RRPRQ(RARRR((s0/usr/local/lib/python2.7/idlelib/configDialog.pyRJ!scGs)|jj}|jddd|dS(NRNRFseditor-on-startup(RRPRQ(RARRR((s0/usr/local/lib/python2.7/idlelib/configDialog.pyRK%scGs)|jj}|jddd|dS(NRNRFtautosave(RRPRQ(RARRR((s0/usr/local/lib/python2.7/idlelib/configDialog.pyRL)scGs)|jj}|jddd|dS(NRNROR(RRPRQ(RARRR((s0/usr/local/lib/python2.7/idlelib/configDialog.pyRM-scCs)iid6id6id6id6|_dS(NRNt highlightRR[(t changedItems(RA((s0/usr/local/lib/python2.7/idlelib/configDialog.pyR21scCsLt|}||j|kr3i|j||    cCs>tjddtjdd}t|d||j}|S(NtuserRRXsNew Custom Key Set(RRmRR{(RARt usedNamesR((s0/usr/local/lib/python2.7/idlelib/configDialog.pyR|s  cCs)|jd}|r%|j|ndS(NsNew Key Set Name:(R|R(RAt newKeysName((s0/usr/local/lib/python2.7/idlelib/configDialog.pyRscCs|jjdtdS(NR(RRRw(RAR((s0/usr/local/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{(RARRR((s0/usr/local/lib/python2.7/idlelib/configDialog.pyRs  cCs)|jd}|r%|j|ndS(NsNew Theme Name:(RR(RAt newThemeName((s0/usr/local/lib/python2.7/idlelib/configDialog.pyR!scCs|jjr'd}|jj}nd}|jj}tj||}||jdjkr|jd|}x%|jD]}||||scCsu|jj}|jjr*tj}n tj}||jj|f}|jjd||j j d|dS(NRl( RwRPRvRztBOLDRwRtRRRR+(RARRwt fontWeighttnewFont((s0/usr/local/lib/python2.7/idlelib/configDialog.pyRCs  cCs|jjdkrN|jjdt|jjdt|jjdn6|jjdt|jjdt|jjd|j dS(NRRi( RRPRRRRRRRwtSetColourSample(RA((s0/usr/local/lib/python2.7/idlelib/configDialog.pyRYMscGs|jdS(N(R(RAtargs((s0/usr/local/lib/python2.7/idlelib/configDialog.pyRXscCsd|j|jjd}|jjr2d}nd}|jj||}|jjd|dS(NiRRR(R1RRPRRttag_cgetRR(RAttagRR((s0/usr/local/lib/python2.7/idlelib/configDialog.pyR[s  cCs0|jjr!|jj}n|jj}x|jjD]}|j|d}tj||}|dkrtj|ddd|d|jjdt|jjdtn^|jjrv|jjdt|jjdtn&|jjdt|jjdtdS(NiR(RtsizeRRRRRRw(RA((s0/usr/local/lib/python2.7/idlelib/configDialog.pyR{scCsht|dj}|rZ|jj|d|df|jjt|d|jn|jdS(NsNew Help Sourceii( RR{t userHelpListtappendRRRtUpdateUserHelpChangedItemsR(RAt helpSource((s0/usr/local/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(RAt itemIndexRt newHelpSource((s0/usr/local/lib/python2.7/idlelib/configDialog.pyRs    cCsD|jjt}|j|=|jj||j|jdS(N(RRxR\RRRR(RAR((s0/usr/local/lib/python2.7/idlelib/configDialog.pyRs   c Cssi|jddR;R<R=R>R?R@RARBRCRDRERFRGRHRIRJRKRLRMR2RQRvRRRR|RRRRcRRRRTRRRRRRRYRRRWRRRRRRRRRRRR=RRRRRR R9RJRMR(((s0/usr/local/lib/python2.7/idlelib/configDialog.pyRs 0 % ? Y E p                      $                      !         t__main__(trun(t__doc__tTkinterRRRzRtidlelib.configHandlerRtidlelib.dynOptionMenuWidgetRtidlelib.tabbedpagesRtidlelib.keybindingDialogRtidlelib.configSectionNameDialogRtidlelib.configHelpSourceEditRtidlelibRR(RRtidlelib.idle_test.htestR(((s0/usr/local/lib/python2.7/idlelib/configDialog.pyt s$ $ r