;3l3dZddlZddlmZmZmZmZmZmZm Z m Z m Z m Z m Z mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZm Z ddl!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.ddlm/Z/ddl0m1Z2ddlm3Z3ddl4m5Z5m6Z6ddl7m8Z8dd l9m:Z:dd l;mZ>m?Z?dd l@mAZAdd lBmCZCddlDmEZEddlFmGZGddlHmIZIddlJmKZKddl@mLZLe6ZMeCeEeGeIeKfZNGddeZOdaPGdde"ZQGdde"ZRGdde"ZSGdde"ZTGdde"ZUGd d!e"ZVGd"d#e#ZWGd$d%ZXeXZYd&ZZd'd(d)d*d+d,Z[d-Z\Gd.d/e"Z]e^d0k(r dd1l_m`Z`e`d2d3d45dd6lambZbebeOyy)7aIDLE 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)ToplevelListboxCanvas StringVar BooleanVarIntVarTRUEFALSETOPBOTTOMRIGHTLEFTSOLIDGROOVENONEBOTHXYWEEWNSNSEWNW HORIZONTALVERTICALANCHORACTIVEENDTclError) Frame LabelFrameButton CheckbuttonEntryLabel OptionMenuNotebook Radiobutton ScrollbarStyleSpinboxCombobox) colorchooser) messagebox)idleConf ConfigChanges) GetKeysWindow) DynOptionMenu)macosx) SectionName HelpSource) view_text) AutoComplete) CodeContext) ParenMatch)FormatParagraph)Squeezer)ScrollableTextFramecbeZdZdZdddddZdZdZdZdZd Z fd Z d Z d Z d Z xZS) ConfigDialogzConfig dialog for IDLE. F)_htest_utestctj||||_|ri|_|s|j |j |xsd|j dz}|j|sdndz}|jd|d||j|jtt|j||jd|j|jj j#t$j'|s1|j)|j+|j-yy) aShow the tabbed dialog for user configuration. Args: parent - parent of this dialog title - string which is the title of this popup dialog _htest - bool, change box location when running htest _utest - bool, don't wait_window when running unittest Note: Focus set on font page fontlist. Methods: create_widgets cancel: Bound to DELETE_WINDOW protocol. zIDLE Preferences+heightwidthWM_DELETE_WINDOWN)r__init__parent instance_dictwithdrawtitle winfo_rootx winfo_rootygeometrycreate_widgets resizabler transientprotocolcancelfontpagefontlist focus_settracersattachgrab_set wm_deiconify wait_window)selfrLrOr@rAxys ;/opt/alt/python312/lib64/python3.12/idlelib/configdialog.pyrKzConfigDialog.__init__1s $' #%F  MMO 5../    2 %    fB# > !AaSk"  e51 v ($++6 ((*  MMO        ct|dx|_}|jjdt|x|_}t ||_t||j |_t||j|_ t||j |_ t||_t||_|j#|jd|j#|jd|j#|jd|j#|jd |j#|j d |j#|j d |j%|j't(t*t, |j/j't0 y)aCreate and place widgets for tabbed dialog. Widgets Bound to self: frame: encloses all other widgets note: Notebook highpage: HighPage fontpage: FontPage keyspage: KeysPage winpage: WinPage shedpage: ShedPage extpage: ExtPage Methods: create_action_buttons load_configs: Load pages except for extensions. activate_config_changes: Tell editors to reload. paddingnwes)stickyz Fonts text Highlightsz Keys z Windows z Shell/Ed ExtensionssideexpandfillrpN)r!framegridr(noteExtPageextpageHighPagehighpageFontPagerXKeysPagekeyspageWinPagewinpageShedPageshedpageaddenable_traversalpackr r rcreate_action_buttonsr )r`rtrvs rcrSzConfigDialog.create_widgets`s@$#433 U v&#E?* Dt}  t||4  t}}5  t||4 t}    Y/ \2 X. K0 \2 L1  s4d 3 ""$))v)6rdctjri}nddi}t|jd}t|d}i|_d|j fd|j fd|jfd|jffD]J\}}t|f||td ||j|<|j|jtd Lt|dd jt|jt|S)aReturn frame of action buttons for dialog. Methods: ok apply cancel help Widget Structure: outer: Frame buttons: Frame (no assignment): Button (ok) (no assignment): Button (apply) (no assignment): Button (cancel) (no assignment): Button (help) (no assignment): Frame rh)rgOkApplyCancelHelp)rlcommand takefocusrf)rppadxr)rH borderwidthrs)r4isAquaTkr!rtbuttonsokapplyrWhelpr#r rrr r )r` padding_argsouter buttons_frametxtcmds rcrz"ConfigDialog.create_action_buttonss$ ?? L%v.Ldjj!,eQ/  477O djj ! t{{ # TYY  !HC !'}!83!&!8*6!8DLL  LL  " "1 " 5! eA1-222<' rdcD|j|jy)z*Apply config changes, then dismiss dialog.N)rdestroyr`s rcrzConfigDialog.oks  rdc|jtj|jj |j y)z+Apply config changes and leave dialog open.N)deactivate_current_configchangessave_allrxsave_all_changed_extensionsactivate_config_changesrs rcrzConfigDialog.applys6 &&( 002 $$&rdcLtj|jy)zPDismiss config dialog. Methods: destroy: inherited N)rclearrrs rcrWzConfigDialog.cancels   rdc|jjjdda|j t |y)N1.0end)rX font_samplegetfont_sample_text grab_releasesuperr)r` __class__s rcrzConfigDialog.destroys6==4488F  rdc |jj|jjdj}t |dt t j|dzy)zCreate textview for config dialog help. Attributes accessed: note Methods: view_text: Method from textview module. rl)optionzHelp for IDLE preferences)rOcontentsN)rvtabselectstripr7 help_common help_pagesr)r`pages rcrzConfigDialog.helpsQyy}}TYY--/}?EEG$9&z~~dB'?? ArdcZ|jjD]}|jy)z/Remove current key bindings in current windows.N)rLrMRemoveKeybindings)r`instances rcrz&ConfigDialog.deactivate_current_configs" 11H  & & (2rdc0|jjD]b}|j|j|j |j |j |jdtD]}|jy)zApply configuration changes to current windows. Dynamically update the current parent window instances with some of the configuration changes. N) rLrMResetColorizer ResetFontset_notabs_indentwidthApplyKeybindingsreset_help_menu_entriesupdate_cursor_blink reloadablesreload)r`rklasss rcrz$ConfigDialog.activate_config_changessu  11H  # # %     + + -  % % '  , , .  ( ( * 2!E LLN!rd)r)__name__ __module__ __qualname____doc__rKrSrrrrWrrrr __classcell__rs@rcr?r?-sG-5-^$7L&P ' A) rdr?u^ AaBbCcDdEeFfGgHhIiJj 1234567890#:+=(){}[] ¢£¥§©«®¶½ĞÀÁÂÃÄÅÇÐØß ɐɕɘɞɟɤɫɮɰɷɻʁʃʆʎʞʢʫʭʯ ΑαΒβΓγΔδΕεΖζΗηΘθΙιΚκ БбДдЖжПпФфЧчЪъЭэѠѤѬӜ אבגדהוזחטיךכלםמןנסעף ابجدهوزحطي٠١٢٣٤٥٦٧٨٩ ०१२३४५६७८९अआइईउऊएऐओऔ ௦௧௨௩௪௫௬௭௮௯அஇஉஎ 〇一二三四五六七八九 汉字漢字人木火土金水 가냐더려모뵤수유즈치 あいうえおアイウエオ c>eZdZfdZdZdZdZdZddZxZ S)r{ct|||j|_|j|j yN)rrKhighlight_samplecreate_page_font load_font_cfg)r`masterrzrs rcrKzFontPage.__init__s6  ( 9 9  rdctjt||j|_tjt||j|_tjt ||j|_t|dtd}t|dtd}t|}t|}t|td}t|ddt |_|jj!d |j"|jj!d |j"|jj!d |j"t%|}|j'|jj( |jj'|j*t|d}t-||j d|_t1||jddd|_t5|}|j6|_|j8j't:dd|j8j=t>t@|jCdd|jEdd|jGdddd|jGdddddd|jItJddtL|jItJddtL|jItJtN|jjIttPtL|jIttR |jIttN|j.jIttN|j2jIttNd!"|jItPtT#y)$aRReturn frame of widgets for Font tab. Fonts: Enable users to provisionally change font face, size, or boldness and to see the consequence of proposed choices. Each action set 3 options in changes structuree and changes the corresponding aspect of the font sample on this page and highlight sample on highlight page. Function load_font_cfg initializes font vars and widgets from idleConf entries and tk. Fontlist: mouse button 1 click or up or down key invoke on_fontlist_select(), which sets var font_name. Sizelist: clicking the menubutton opens the dropdown menu. A mouse button 1 click or return key sets var font_size. Bold_toggle: clicking the box toggles var font_bold. Changing any of the font vars invokes var_changed_font, which adds all 3 font options to changes and calls set_samples. Set_samples applies a new font constructed from the font vars to font_sample and to highlight_sample on the highlight page. Widgets for FontPage(Frame): (*) widgets bound to self frame_font: LabelFrame frame_font_name: Frame font_name_title: Label (*)fontlist: ListBox - font_name scroll_font: Scrollbar frame_font_param: Frame font_size_title: Label (*)sizelist: DynOptionMenu - font_size (*)bold_toggle: Checkbutton - font_bold frame_sample: LabelFrame (*)font_sample: Label rz Shell/Editor Font rreliefrlz Font Sample (Editable) z Font Face :)justifyrlTrHrexportselectionzzr)yscrollcommandzSize :rkNrBold)variableonvalueoffvaluerl)wraprIrHweightrf)rowcolumnrpadyrnsew)rrrowspanrrrjrprrrrrpanchorro)rprrrCrprr)rqrr)+r[rrvar_changed_font font_name font_sizer font_boldr"rr!r&rrr rYbindon_fontlist_selectr*configyviewsetr3sizelistr$ bold_toggler=rlrrinsertrrcolumnconfigure rowconfigurerurr rrr rr) r` frame_font frame_sampleframe_font_nameframe_font_paramfont_name_title scroll_fontfont_size_titlefont_sample_frames rcrzFontPage.create_page_font!sL!Yt_d6K6KL Yt_d6K6KL Z%5t7L7LM !F%:< !$Af'AC  + ,MC*.G  .0G0GH ,d.E.EF .0G0GH0 4==#6#67 KOO< 0x@%&6M & 4>>AF40 =,11 T1= %56 Qq) !A&Aaaa8a111!'  ) #AAA>3QQQ?#a0 T:d+$q1 Q/ 4;d6rdc0tj|dd}|dj}|d}|ddk(}tt t j |}|D]"}|jjt|$|jj ||Dcgc]}|j}} |j|} |jj| |jj| |jj| |jj| |j"j%d||j&j ||j)ycc}w#t $rYXwxYw) aLoad current configuration settings for the font options. Retrieve current font with idleConf.GetFont and font families from tk. Setup fontlist and set font_name. Setup sizelist, which sets font_size. Set font_bold. Call set_samples. main EditorWindowrrrbold)78910111213141618202225293440N)r0GetFontlowersortedrtkfontfamiliesrYrrrindexsee select_set select_anchoractivate ValueErrorrSetMenur set_samples) r`configured_fontrrrfontsfontslc_fontscurrent_font_indexs rcrzFontPage.load_font_cfgzs^#**4H#A&,,. #A& $Q'/ s6??4012D MM d + 9%',-u!AGGIu- !) !:  MM  0 1 MM $ $%7 8 MM ' '(: ; MM " "#5 6 O' ) 9% .   s%F?A=F FFcP|jj}tjddd||jj}tjddd||j j}tjddd||j y)zStore changes to font attributes. When 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. rrr(z font-sizez font-boldN)rrr add_optionrrr%r`paramsvalues rcrzFontPage.var_changed_fonts""$6>65A""$6>;F""$6>;F rdc|jj|jjdk(rtnt }|j j|jy)zHandle selecting a font from the list. Event can result from either mouse click or Up or Down key. Set font_name and example displays to selection. KeyReleaseN) rYrtypenamerrrrr)r`eventr(s rcrzFontPage.on_fontlist_selectsE }}  **//\9vG 4::<(rdc"|jj}|jjrtjntj }||j j|f}||jd<||jd<y)zUpdate update both screen samples with the font settings. Called on font initialization and change events. Accesses font_name, font_size, and font_bold Variables. Updates font_sample and highlight page highlight_sample. r(N) rrrrBOLDNORMALrrr)r`r5r font_weightnew_fonts rcr%zFontPage.set_samplessmNN&&( %)^^%7%7%9fkkv}} t~~113[A#+ (0f%rdr) rrrrKrrrrr%rrs@rcr{r{s$ W7r D ) 1rdr{ceZdZfdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZxZS)ryct||||_|j|_t ||_|j|jyr) rrKrxwinfo_toplevelcdr+stylecreate_page_highlightload_theme_cfgr`rrxrs rcrKzHighPage.__init__sJ   '')6]  ""$ rdc  iddddddddd d d d d ddddddddddddddddddd _tjtj_tjtj _t_ tjtj_ tjtj_ tjtj_t!d!t"d"#}t!d!t"d$#}t%|t&d%&}|j(x}_|j-d'd(d%d%t.d)t0*|j3d+d,|j3d-d.d/}|D]\}}|j5t6||t9|j;d0t6j=}t?d%|D]1} |j5| d1| t9tA|d2d3d 3jD])} | ffd4 } |jCj| d5| +d6|d7<jDj-d8d%d9:tG|d8;_$tG|} tKjHd<jL=_'tQjHjd>d)?_)tU| jd%d@jVA_,tU| jd)dBjVA_-jj]d%tK|dCj^=_0tc|dDE} tU|jd%jddFG_3tU|jd)jddHG_4tQ|j d>d>I_5tQ|jd>d>I_6tK|dJjn=_8tc|d!K_9|jutvdLdLtxtzM|jut|dLdLt~NjHjut|dLdLt~N| jut|dLd)O|jut|dLdLtxtzMjNjut|txt~dPdQRjRjut|txt~dPdSRjXjutvtTjZjuttTj`jutt~dLdLU| jut|tdLdLVjfjut|tdLWjhjut|tdLd!Vjjjut|t~dLdLUjljut|t~tdLdLXjpjut|t~dLdLUjrjut|t~dLYy>)ZaReturn frame of widgets for Highlights tab. Enable users to provisionally change foreground and background colors applied to textual tags. Color mappings are stored in complete listings called themes. Built-in themes in idlelib/config-highlight.def are fixed as far as the dialog is concerned. Any theme can be used as the base for a new custom theme, stored in .idlerc/config-highlight.cfg. Function load_theme_cfg() initializes tk variables and theme lists and calls paint_theme_sample() and set_highlight_target() for the current theme. Radiobuttons builtin_theme_on and custom_theme_on toggle var theme_source, which controls if the current set of colors are from a builtin or custom theme. DynOptionMenus builtinlist and customlist contain lists of the builtin and custom themes, respectively, and the current item from each list is stored in vars builtin_name and custom_name. Function paint_theme_sample() applies the colors from the theme to the tags in text widget highlight_sample and then invokes set_color_sample(). Function set_highlight_target() sets the state of the radiobuttons fg_on and bg_on based on the tag and it also invokes set_color_sample(). Function set_color_sample() sets the background color for the frame holding the color selector. This provides a larger visual of the color for the current tag and plane (foreground/background). Note: set_color_sample() is called from many places and is often called more than once when a change is made. It is invoked when foreground or background is selected (radiobuttons), from paint_theme_sample() (theme is changed or load_cfg is called), and from set_highlight_target() (target tag is changed or load_cfg called). Button delete_custom invokes delete_custom() to delete a custom theme from idleConf.userCfg['highlight'] and changes. Button save_custom invokes save_as_new_theme() which calls get_new_theme_name() and create_new() to save a custom theme and its colors to idleConf.userCfg['highlight']. Radiobuttons fg_on and bg_on toggle var fg_bg_toggle to control if the current selected color for a tag is for the foreground or background. DynOptionMenu targetlist contains a readable description of the tags applied to Python source within IDLE. Selecting one of the tags from this list populates highlight_target, which has a callback function set_highlight_target(). Text widget highlight_sample displays a block of text (which is mock Python code) in which is embedded the defined tags and reflects the color attributes of the current theme and changes for those tags. Mouse button 1 allows for selection of a tag and updates highlight_target with that tag value. Note: The font in highlight_sample is set through the config in the fonts tab. In other words, a tag can be selected either from targetlist or by clicking on the sample text within highlight_sample. The plane (foreground/background) is selected via the radiobutton. Together, these two (tag and plane) control what color is shown in set_color_sample() for the current theme. Button set_color invokes get_color() which displays a ColorChooser to change the color for the selected tag/plane. If a new color is picked, it will be saved to changes and the highlight_sample and frame background will be updated. Tk Variables: color: Color of selected target. builtin_name: Menu variable for built-in theme. custom_name: Menu variable for custom theme. fg_bg_toggle: Toggle for foreground/background color. Note: this has no callback. theme_source: Selector for built-in or custom theme. highlight_target: Menu variable for the highlight tag target. Instance Data Attributes: theme_elements: Dictionary of tags for text highlighting. The key is the display name and the value is a tuple of (tag name, display sort order). Methods [attachment]: load_theme_cfg: Load current highlight colors. get_color: Invoke colorchooser [button_set_color]. set_color_sample_binding: Call set_color_sample [fg_bg_toggle]. set_highlight_target: set fg_bg_toggle, set_color_sample(). set_color_sample: Set frame background to target. on_new_color_set: Set new color and add option. paint_theme_sample: Recolor sample. get_new_theme_name: Get from popup. create_new: Combine theme with changes and save. save_as_new_theme: Save [button_save_custom]. set_theme_type: Command for [theme_source]. delete_custom: Activate default [button_delete_custom]. save_new: Save to userCfg['theme'] (is function). Widgets of highlights page frame: (*) widgets bound to self frame_custom: LabelFrame (*)highlight_sample: Text (*)frame_color_set: Frame (*)button_set_color: Button (*)targetlist: DynOptionMenu - highlight_target frame_fg_bg_toggle: Frame (*)fg_on: Radiobutton - fg_bg_toggle (*)bg_on: Radiobutton - fg_bg_toggle (*)button_save_custom: Button frame_theme: LabelFrame theme_type_title: Label (*)builtin_theme_on: Radiobutton - theme_source (*)custom_theme_on: Radiobutton - theme_source (*)builtinlist: DynOptionMenu - builtin_name (*)customlist: DynOptionMenu - custom_name (*)button_delete_custom: Button (*)theme_message: Label zNormal Code or Textnormalz Code ContextcontextzPython KeywordskeywordzPython Definitions definitionzPython BuiltinsbuiltinzPython CommentscommentzPython Stringsstringz Selected Texthilitez Found TexthitCursorcursorzEditor Breakpointbreakz Shell Promptconsolez Error TexterrorzShell User OutputstdoutzShell User Exceptionstderrz Line Number linenumberrz Custom Highlighting rz Highlighting Theme r)rr)courier rhand2r)r(rNrIrHrhighlightthicknessrzcyNrOes rcz0HighPage.create_page_highlight..osrdz cyrZr[r\s rcr^z0HighPage.create_page_highlight..ps7rd)")z# Click selects item.rI rD)zcode context sectionrEr`)z| cursorrNr`)defrF) rD)funcrG)z (param): rD)z"Return None."rJ)z var0 = rD)z'string'rJ)z var1 = rD)z 'selected'rK)z var2 = rD)z'found'rL)z var3 = rD)listrH)(rD)NonerF)z) rD)z breakpoint("line")rO)z rDz>>>rP)z 3.14**2 rD)z9.8596rRr`rh)z pri rD)nrQ)zt( rD) SyntaxErrorrSr`rz.0drcc<jj|yr)highlight_targetr)r5elemr`s rctemz+HighPage.create_page_highlight..tems%%))$/rdzdisabledstateframe_color_set.TFramesolid)rr)r?zChoose Color for :rlrN)rX Foreground)rr0rlr BackgroundzSave as New Custom Themez Select : rkza Built-in Themerr0rrlza Custom ThemerzDelete Custom Themerrfrprrrqrrrrprr)rprqrrrrrrrprrrrrprrrr)rprrrrr)rprrr)Dtheme_elementsr[rrvar_changed_builtin_name builtin_namevar_changed_custom_name custom_namer fg_bg_togglevar_changed_colorcolorvar_changed_theme_source theme_sourcevar_changed_highlight_targetrmr"rr=rrlr configurer rrrrlenr splitlinesrangestrtag_bindr?r!frame_color_setr# get_colorbutton_set_colorr3 targetlistr)set_color_sample_bindingfg_onbg_onrsave_as_new_themebutton_save_customr&set_theme_typebuiltin_theme_oncustom_theme_on builtinlist customlist delete_custombutton_delete_custom theme_messagerrr rr rrr rr )r` frame_custom frame_theme sample_framerl string_tagsrJtagn_lineslinenoelementroframe_fg_bg_toggletheme_type_titles` rcr@zHighPage.create_page_highlightslj !8 I y  !,  y  y h X % h  I '  #H!" <#&$KK$!>!>@";;$!=!=?&t,[[$!7!79 #KK4 $"?"?A ' $!B!B!D "$Af'>@  1V&<> +U; '3'8'88t$ (!AD  B %'89 -!239 $'KFC KKVS )'dhhuc*5578Aw'F KK6(" !3s7|#4"5Q!67q9$ &(**G ' 0 MM''02CS J + #W  51$+  -$\9QR"<0 &$$+?!(($$d&;&;T#$&!"T->->a!4+H+HJ !"T->->a!4+H+HJ  a "(#=..#0!;? +d&7&7q++2D!F +d&7&7q++2B D)T..dD'T--tTC$*"7**%,!#;A> t!!DtLc: !!s!CSqq9qqD  B ""Dqqq"Q #dK T!, U1- $$&qqq$I3qqqA ""AA"> !!s111!E 3QQQ? #AaaaH !!&&Caaa&H Sqq9rdc |jjtjdddddtj}|jj rtj dd}|j|jj||tj dd}|j|s7|jjd |jjd n|jj||d ntj dd}|j|jj||tj dd}|j|jj||d |jt|j }|j"j||d |j%|j'y ) aLoad current configuration settings for the theme options. Based on the theme_source toggle, the theme is set as either builtin or custom and the initial widget values reflect the current settings from idleConf. Attributes updated: theme_source: Set from idleConf. builtinlist: List of default themes from idleConf. customlist: List of custom themes from idleConf. custom_theme_on: Disabled if there are no custom themes. custom_theme: Message with additional information. targetlist: Create menu from self.theme_elements. Methods: set_theme_type paint_theme_sample set_highlight_target rThemedefaultboolrr3r highlightuserrp- no custom themes -rN)rrr0 GetOption CurrentThemerGetSectionListsortrr$rrqrrrrerrpaint_theme_sampleset_highlight_target)r`current_option item_list theme_namess rcrAzHighPage.load_theme_cfgs* h00D E"..0    " // ;GI NN     $ $Y ? // DI NN $$**=9  $$%;<'' 9Q<@ // DI NN  OO # #I~ > // ;GI NN     $ $Y ! = 4../   [^< ! !!#rdcd}|jj}||vr\tjddd|vrtj ddd|dtj ddd|d|j d<n?tj ddd|tj dddd d |j d<|jy ) zProcess new builtin theme selection. Add the changed theme's name to the changed_items and recreate the sample with the values from the selected theme. )z IDLE ClassiczIDLE Newrrr4rname2zNew theme, see HelprlrN)rrr0rrr-rr)r`r/ old_themesr0s rcrz!HighPage.var_changed_builtin_names 2 !!%%'  "!!&'6:*L""67FJqMJ   vw ?)>D  v &   vw >   vw <)+D  v & !rdc|jj}|dk7r)tjddd||j yy)zProcess new custom theme selection. If a new custom theme is selected, add the name to the changed_items and apply the theme to the sample. rrrr4N)rrrr-rr.s rcrz HighPage.var_changed_custom_namesF   $$& * *   vw >  # # % +rdc|jj}tjddd||r|j y|j y)zProcess toggle between builtin and custom theme. Update the default toggle value and apply the newly selected theme type. rrrN)rrrr-rrr.s rcrz!HighPage.var_changed_theme_sourcesG !!%%'67Iu=   ) ) +  ( ( *rdc$|jy)zProcess change to color choice.N)on_new_color_setr`r/s rcrzHighPage.var_changed_color*s rdc$|jy)z5Process selection of new target tag for highlighting.N)rrs rcrz%HighPage.var_changed_highlight_target. !!#rdcT|jjr:d|jd<d|jd<|jj dyd|jd<|j j dd|jd<|jj dy)aSet available screen options based on builtin or custom theme. Attributes accessed: theme_source Attributes updated: builtinlist customlist button_delete_custom custom_theme_on Called from: handler for builtin_theme_on and custom_theme_on delete_custom create_new load_theme_cfg rDrqrprz !disabledN)rrrrrrqrrs rcrzHighPage.set_theme_type2s$    "(0D  W %'1DOOG $  % % + +M :(2D  W %  & &~ 6'/DOOG $  % % + +N ;rdc|jj}|jj|jdd}t j |d|z|\}}|r||k7ry|jjrCd}|j|}|sy|j||jj|y|jj|yyy)aHandle button to select a new color for the target tag. If a new color is selected while using a builtin theme, a name must be supplied to create a custom theme. Attributes accessed: highlight_target frame_color_set theme_source Attributes updated: color Methods: get_new_theme_name create_new r? backgroundzPick new color for : )rLrO initialcolorz_Your changes will be saved as a new Custom Theme. Enter a name for your new Custom Theme below.N) rmrr?lookuprr.askcolorrget_new_theme_name create_newrr)r`target prev_color rgbTuplet color_stringmessage new_themes rcrzHighPage.get_colorNs$&&**,ZZ&&t';';G'D'35 "."7"7#:6#A'#) < \Z7  $$&K 33G<  OOI.JJNN<0 |,8B a  rdc|jjdk(rR|jjd|jjd|j j dnQ|jjd|jjd|j j d|jy)ahSet fg/bg toggle and color based on highlight tag target. Instance variables accessed: highlight_target Attributes updated: fg_on bg_on fg_bg_toggle Methods: set_color_sample Called from: var_changed_highlight_target load_theme_cfg rMrrrN)rmrrrqrrrset_color_samplers rcrzHighPage.set_highlight_targets$  $ $ &( 2 JJ  ] + JJ  ] +    ! !! $ JJ  ^ , JJ  ^ ,    ! !! $ rdc$|jy)zrChange color sample based on foreground/background toggle. Methods: set_color_sample N)r)r`argss rcrz!HighPage.set_color_sample_bindings rdc|j|jj}|jjrdnd}|jj ||}|j jd|y)aSet the color of the frame background to reflect the selected target. Instance variables accessed: theme_elements highlight_target fg_bg_toggle highlight_sample Attributes updated: frame_color_set rrrrrN)rrmrrrtag_cgetr?r)r`rrrs rcrzHighPage.set_color_samplesk!!$"7"7";";"=> $ 1 1 5 5 7 \%%..sE: 5%Hrdc |jjr|jj}n|jj}|jD]}|j|}t j ||}|dk(rt j |dd|d<|tdvr0td|}|dz|vr ||dz|d<|dz|vr ||dz|d<|jj|fi||jy) aApply the theme colors to each element tag in the sample text. Instance attributes accessed: theme_elements theme_source builtin_name custom_name Attributes updated: highlight_sample: Set the tag elements to the theme. Methods: set_color_sample Called from: var_changed_builtin_name var_changed_custom_name load_theme_cfg rNrDrrz -foregroundrz -backgroundN) rrrrrr0 GetHighlightrrrr)r`r element_titlercolors theme_dicts rcrzHighPage.paint_theme_samples#(    "%%))+E$$((*E!00M))-8G**5':F("'/'<'<x())5(7|$ ,,$[1%8 ]*j8+5g 6M+NF<(]*j8+5g 6M+NF<( ,D ! ! , ,W ? ?1 rdctjdj||D]+}||}tjdj|||-y)zSave a newly created theme to idleConf. theme_name - string, the name of the new theme theme - dictionary containing the new theme rNr0userCfg AddSection SetOption)r`rrrr0s rcrzHighPage.save_newsM %00<G'NE   [ ) 3 3J Ordc,tj|i|Srr/askyesnor`rkwargss rcrzHighPage.askyesno#""D3F33rdcj|jj}d}|jd||z|sy|jj t j d|tjdd}|j|s8|jjd|jj|dn|jj||d |jjtj d j#d d |j$jtj d j#d d t j'|j(j+|jj-|j/y)a!Handle event to delete custom theme. The current theme is deactivated and the default theme is activated. The custom theme is permanently removed from the config file. Attributes accessed: custom_name Attributes updated: custom_theme_on customlist theme_source builtin_name Methods: deactivate_current_config save_all_changed_extensions activate_config_changes set_theme_type z.Are you sure you wish to delete the theme %r ?z Delete ThemerLNrrrrrrrrr4)rrrr>rrdelete_sectionr0rrrrqrr$rr defaultCfgGetrrrxrrr)r`rdelmsgrs rcrzHighPage.delete_custom'sN,%%))+ A}}*!4TC  ))+{J7++FK@   & &} 5 OO # #I/E F OO # #Iy| < h11&9==gyQR h11&9==gvNO 002 '') rd)rrrrKr@rArrrrrrrrrrrrrrrrrrrrs@rcryrysu}:~1$f"& & + $<8$-L I ,&P 8 I$& P P4-rdryceZdZfdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZedZdZdZxZS)r|ct||||_|j|_|j |j yr)rrKrxr=r>create_page_keys load_key_cfgrBs rcrKzKeysPage.__init__Ys?   '')  rdc tjt||j|_tjt||j |_tjt||j|_ tjt||j|_ t|dtd}t|dtd}t|}t|d}t!|}t!|t"}t%|t&t&|_|j(j+d |j,|j(j.|d <|j(j0|d <|j2|j(d <|j2|j(d <t5|d |j6d|_t;dDcgc]}t|dd}}t=|d|jd|j>d|_ t=|d|jd|j>d|_!tE|d|jdd|_#tE|d|j dd|_$t5|dd|jJ|_&t5|dd|jN|_(t|dd|_)|jUtVddtXtZ|jUtVddtZ|j8jUtVt\dd|jUt^ddtXtZ|jadd |jcdd |jedddtf!|j(jeddth"|jeddtj"|jeddtl"|j@jeddtftjz"|jBjeddtftjz"|jFjeddth"|jHjeddth"|jRjeddthdd#|jLjUt^t\d$d%|jPjUt^t\d$d%|djUtntZd$&|djUtnt\d$d'ycc}w)(aReturn frame of widgets for Keys tab. Enable users to provisionally change both individual and sets of keybindings (shortcut keys). Except for features implemented as extensions, keybindings are stored in complete sets called keysets. Built-in keysets in idlelib/config-keys.def are fixed as far as the dialog is concerned. Any keyset can be used as the base for a new custom keyset, stored in .idlerc/config-keys.cfg. Function load_key_cfg() initializes tk variables and keyset lists and calls load_keys_list for the current keyset. Radiobuttons builtin_keyset_on and custom_keyset_on toggle var keyset_source, which controls if the current set of keybindings are from a builtin or custom keyset. DynOptionMenus builtinlist and customlist contain lists of the builtin and custom keysets, respectively, and the current item from each list is stored in vars builtin_name and custom_name. Button delete_custom_keys invokes delete_custom_keys() to delete a custom keyset from idleConf.userCfg['keys'] and changes. Button save_custom_keys invokes save_as_new_key_set() which calls get_new_keys_name() and create_new_key_set() to save a custom keyset and its keybindings to idleConf.userCfg['keys']. Listbox bindingslist contains all of the keybindings for the selected keyset. The keybindings are loaded in load_keys_list() and are pairs of (event, [keys]) where keys can be a list of one or more key combinations to bind to the same event. Mouse button 1 click invokes on_bindingslist_select(), which allows button_new_keys to be clicked. So, an item is selected in listbindings, which activates button_new_keys, and clicking button_new_keys calls function get_new_keys(). Function get_new_keys() gets the key mappings from the current keyset for the binding event item that was selected. The function then displays another dialog, GetKeysDialog, with the selected binding event and current keys and allows new key sequences to be entered for that binding event. If the keys aren't changed, nothing happens. If the keys are changed and the keyset is a builtin, function get_new_keys_name() will be called for input of a custom keyset name. If no name is given, then the change to the keybinding will abort and no updates will be made. If a custom name is entered in the prompt or if the current keyset was already custom (and thus didn't require a prompt), then idleConf.userCfg['keys'] is updated in function create_new_key_set() with the change to the event binding. The item listing in bindingslist is updated with the new keys. Var keybinding is also set which invokes the callback function, var_changed_keybinding, to add the change to the 'keys' or 'extensions' changes tracker based on the binding type. Tk Variables: keybinding: Action/key bindings. Methods: load_keys_list: Reload active set. create_new_key_set: Combine active keyset and changes. set_keys_type: Command for keyset_source. save_new_key_set: Save to idleConf.userCfg['keys'] (is function). deactivate_current_config: Remove keys bindings in editors. Widgets for KeysPage(frame): (*) widgets bound to self frame_key_sets: LabelFrame frames[0]: Frame (*)builtin_keyset_on: Radiobutton - var keyset_source (*)custom_keyset_on: Radiobutton - var keyset_source (*)builtinlist: DynOptionMenu - var builtin_name, func keybinding_selected (*)customlist: DynOptionMenu - var custom_name, func keybinding_selected (*)keys_message: Label frames[1]: Frame (*)button_delete_custom_keys: Button - delete_custom_keys (*)button_save_custom_keys: Button - save_as_new_key_set frame_custom: LabelFrame frame_target: Frame target_title: Label scroll_target_y: Scrollbar scroll_target_x: Scrollbar (*)bindingslist: ListBox - on_bindingslist_select (*)button_new_keys: Button - get_new_keys & ..._name rz Custom Key Bindings rz Key Set zAction - Key(s)rkorient)rrrrrxscrollcommandzGet New Keys for Selectionrp)rlrrqr)rhrrzUse a Built-in Key SetrwzUse a Custom Key SetNrzDelete Custom Key SetrtzSave as New Custom Key Setrxrfryrr}r)rr columnspanrjrrrj)rrrjrrT)rprrrqrrprrrq)rprrrqr)8r[rrrrrrrvar_changed_keyset_source keyset_sourcevar_changed_keybinding keybindingr"rr!r&r*rrr bindingslistron_bindingslist_selectrxviewrr# get_new_keysbutton_new_keysrr) set_keys_typebuiltin_keyset_oncustom_keyset_onr3rrdelete_custom_keysbutton_delete_custom_keyssave_as_new_key_setbutton_save_custom_keys keys_messagerr r rrrrrrurrrrr ) r`rframe_key_sets frame_target target_titlescroll_target_yscroll_target_xiframess rcr zKeysPage.create_page_keys`sd$KK$!>!>@";;$!=!=?$[[4 $"@"@B!++$! "!F,. $!FF\* \0AB #L1#LD#uF 2#:: <%)%6%6%<%< "%)%6%6%<%< ".=.A.A*+.=.A.A*+%#?)) = !8%#aqA# %!,q D$6$6a**1I"K!,q D$6$6a**1G!I)q 4,,dDB'q 4++T4A)/q 7//*1&(.q <00(2$"&); vAAdNaadC !!vAAA!Ft!!DtL$$Qq$1!!!A!.aaB 1Qt<1R81R8 ##!AbD#A ""q1R4"@ !Ad; 1T: 1Qt!!L &&++AdQR+S $$))t!Dq)Qq Cd48q Ca1=W%s#U c |jjtjdddddtj}|jj rtj dd}|j|jj||tj dd}|j|s7|jjd |jjd n|jj||d ntj dd}|j|jj||tj dd}|j|jj|tj|jtj}|j!|y ) z?Load current configuration settings for the keybinding options.rKeysrrrrkeysrr- no custom keys -rN)rrr0r CurrentKeysrrrrr$rrqrr default_keysrload_keys_list)r`rr keyset_names rcr zKeysPage.load_key_cfgsy x11  C D"--/    ! ! # // 6BI NN     $ $Y ? //?I NN %%++M:  $$%9:'' 9Q<@ //?I NN  OO # #I~ > // 6BI NN     $ $Y0E0E0G H **,  K(rdcd}|jj}||vr\tjddd|vrtj ddd|dtj ddd|d|j d<n?tj ddd|tj dddd d |j d<|j|y ) z%Process selection of builtin key set.)zIDLE Classic WindowszIDLE Classic UnixzIDLE Classic MaczIDLE Classic OSXrr-r4rrzNew key set, see HelprlrN)rrr0rrr-r$r2)r`r/old_keysr0s rcrz!KeysPage.var_changed_builtin_names  !!%%'  !!&&&9I""6668A;G   vvw >(?D  f %   vvvu =   vvw ;(*D  f % E"rdc|jj}|dk7r*tjddd||j |yy)z$Process selection of custom key set.r/rr-r4N)rrrr-r2r.s rcrz KeysPage.var_changed_custom_name3sF  $$& ( (   vvvu =    & )rdc|jj}tjddd||r|j y|j y)z:Process toggle between builtin key set and custom key set.rr-rN)rrrr-rrr.s rcrz"KeysPage.var_changed_keyset_source:sE""&&(669e<   ) ) +  ( ( *rdc|jj}|jj}|jjtj d}t j|rtjd|||yt j|}|dz}tjd|||y)zStore change to a keybinding.rr. _cfgBindings extensionsN) rrrrrsplitr0 IsCoreBindingrr-GetExtnNameForEvent)r`r/r0key_setr5ext_nameext_keybind_sections rcrzKeysPage.var_changed_keybindingCs##%""&&(!!%%f-335a8  ! !% (   vwu =33E:H"*^";    |-@% OrdcT|jjr:d|jd<d|jd<|jj dyd|jd<|j j dd|jd<|jj dy)z@Set available screen options based on builtin or custom key set.rDrqrprrN)rrrrr!rqrrs rcrzKeysPage.set_keys_typeOs    ! ! #(0D  W %'1DOOG $  * * 0 0 ?(2D  W %  ! ! ' ' 7'/DOOG $  * * 0 0 @rdc|jjt}|jj|}|j d}|j jr|j j}n|jj}tj}|tdvr)td|}|D]}||j ||<t|j}t|d||j} | r|j jr]d} |j| } | s7|jj!||jj#|y|j%| |jj'||jj)||dz| z|jj!||jj#||j*j-| y|jj!||jj#|y)a^Handle event to change key binding for selected line. A selection of a key/binding in the list of current bindings pops up a dialog to enter a new binding. If the current key set is builtin and a binding has changed, then a name for a custom key set needs to be entered for the change to be applied. rr.z Get New KeyszcYour changes will be saved as a new Custom Key Set. Enter a name for your new Custom Key Set below.N - )rrrrr;rrrr0GetCurrentKeySetrrevaluesr2rget_new_keys_namer r!create_new_key_setdeleterrr) r` list_indexbinding bind_namecurrent_key_set_namecurrent_bindingskey_set_changesr5current_key_sequencesnew_keysr new_keysets rcrzKeysPage.get_new_keys[s&&,,V4 ##'' 3MMOA&    ! ! ##'#4#4#8#8#: #'#3#3#7#7#9 #446 76? 2%fo.BCO(*9%*@*F*F*H ') $%5%<%<%> ? ~y%''-v  !!%%'N!33G< !%%00<%%33J?++J7    $ $Z 0    $ $Z51I J    ( ( 4    + +J 7 OO   )    ( ( 4    + +J 7rdctjddtjddz}t|d||j}|S)z)Return new key set name from query popup.rr.rzNew Custom Key Setr)r`rrrQs rcrFzKeysPage.get_new_keys_namesL--ff='' 6:;  *GZAAG rdcN|jd}|r|j|yy)z@Prompt for name of new key set and save changes using that name.zNew Key Set Name:N)rFrG)r` new_keys_names rcr"zKeysPage.save_as_new_key_sets)../BC   # #M 2 rdc:|jjdy)z6Activate button to assign new keys to selected action.rN)rrqr`r5s rcrzKeysPage.on_bindingslist_selects "">2rdcd|jjr|jj}n|jj}t j |}i}|D] }|dd}dj ||}|||<"|tdvrtd|}|D] }||||< |j||t jdd} | j|jj| ||jjd|jy)zCreate a new custom key set with the given name. Copy the bindings/keys from the previously active keyset to the new keyset and activate the new custom keyset. rrcr.rrN)rrrrr0 GetCoreKeysjoinrsave_new_key_setrrrr$rr) r`new_key_set_nameprev_key_set_name prev_keysrPr5 event_namerJrNcustom_key_lists rcrGzKeysPage.create_new_key_sets#    ! ! # $ 1 1 5 5 7  $ 0 0 4 4 6 (():; EqJhhy/0G#*HZ   /%fo.?@O("1%"8) .9"11&&A 1AB q! rdcd}|jjr!d}|jjt}t j |}t |}|j|jjdt|D]i}dj||}|dd}|tdvr|td|vrtd||}|jjt|dz|zk|rR|jj|jj||jj|y y ) zReload the list of action/key binding pairs for the active key set. An action/key binding can be selected to change the key binding. FTrrcrrXr.rCN)r curselectionrrr0 GetKeySetrerrHrrZrrrr r!)r`r3reselectrIkeyset bind_namesrKkeys rcr2zKeysPage.load_keys_lists,     ) ) +H**008J##K0&\    C(#I((6),-C!!BIgfo- <<!&/+6yAC    $ $S)E/#*= >$     ! !* -    ( ( 4    + +J 7 rdctjdj||D]+}||}tjdj|||-y)aQSave a newly created core key set. Add keyset to idleConf.userCfg['keys'], not to disk. If the keyset doesn't exist, it is created. The binding/keys are taken from the keyset argument. keyset_name - string, the name of the new key set keyset - dictionary containing the new keybindings r.Nr)r3rer5r0s rcr[zKeysPage.save_new_key_setsM  ++K8E5ME   V $ . .{E5 Irdc,tj|i|Srrrs rcrzKeysPage.askyesnorrdc|jj}d}|jd||z|sy|jj t j d|tjdd}|j|s8|jjd|jj|dn|jj||d |jjtj d j#d d |j$jtj d j#d d xstj&t j)|j*j-|jj/|j1y)zHandle event to delete a custom key set. Applying the delete deactivates the current configuration and reverts to the default. The custom key set is permanently deleted from the config file. z0Are you sure you wish to delete the key set %r ?zDelete Key SetrNr.rrr/rrr-rr4)rrrr>rrrr0rrrrqrr$rrrrrr1rrxrrr)r`r3rrs rcr zKeysPage.delete_custom_keyssd&&**, C}} 6K#7F  ))+v{3++FF;   ! ! ' ' 6 OO # #I/C D OO # #Iy| < x226: #FI 6 8 h11&9==ffM9!)!6!6!8 :  002 '') rd)rrrrKr r rrrrrrrFr"rrGr2 staticmethodr[rr rrs@rcr|r|Wsn^>@)>#('+ P A*8X3 3<86 J J4 rdr|c0eZdZfdZdZdZdZxZS)r~ct|||j|j|j yr)rrKinit_validatorscreate_page_windowsload_windows_cfgr`rrs rcrKzWinPage.__init__ s4      " rdcjtjdfd}|j|df|_y)N[0-9]*c*j|duSz+Return 's is blank or contains only digits'N fullmatchr)digits_or_empty_res rcis_digits_or_emptyz3WinPage.init_validators..is_digits_or_empty%//2$> >rd%Precompileregister digits_onlyr`rzrys @rcrnzWinPage.init_validators0ZZ 2 ?!MM*<=tErdc jtjt|d|_tjt |d|_tjt |d|_tjt |d|_tjt|d|_ tjt |d|_ tjt |d|_ tjt |d|_ tjt|d |_ tjt |d |_t|d t d }t#|d}t%|d}t'||jdd|_t'||jdd|_t#|d}t%|d}t%|d}t-||j d|j.d|_t%|d}t-||j d|j.d|_t#|d}t%|d} t5||jddd |j.d|_t%|d"} tA|d#|j$|_!t#|d} t%| d%} t-| |jd&|j.d|_"t#|d} t%| d'}tG| |jd(d)d*d(|_$t#|d}t%|d+}t-||jd&|j.d|_%tA|d,|j$|_&t#|d}t%|d-}t-||jd.|j.d|_'|jQtRd/d/tTtV0|jQtRd/dtX1|jQtZt\d/d/2|j*jQt^t\d/d/2|j(jQt^t\d/d/2|jQtRd/dtX1|jQtZt\d/d/2|j2jQt^t`dd/2|jQt^t`d/3|j0jQt^t`dd/2|jQt^t`d/3|jQtRd/dtX1| jQtZt\d/4|j6jQtZt\d4|jBjQt^t`d5d/2| jQtRd/dtX1| jQtZt\d/d/2|jDjQtRdd/6| jQtRd/dtX1|jQtZt\d/d/2|jHjQtRdd/6|jQtRd/dtX1|jQtZt\d/4|jLjQt^t`d5d/2|jJjQtRt\d5d/2|jQtRd/dtX1|jQtZt\d/d/2|jNjQtRdd/6y7#t8$r6t;||jdt=t?dd d!|_YwxYw)8a1Return frame of widgets for Windows tab. Enable users to provisionally change general window options. Function load_windows_cfg initializes tk variable idleConf. Radiobuttons startup_shell_on and startup_editor_on set var startup_edit. Entry boxes win_width_int and win_height_int set var win_width and win_height. Setting var_name invokes the default callback that adds option to changes. Widgets for WinPage(Frame): > vars, bound to self frame_window: LabelFrame frame_run: Frame startup_title: Label startup_editor_on: Radiobutton > startup_edit startup_shell_on: Radiobutton > startup_edit frame_win_size: Frame win_size_title: Label win_width_title: Label win_width_int: Entry > win_width win_height_title: Label win_height_int: Entry > win_height frame_cursor: Frame indent_title: Label indent_chooser: Spinbox > indent_spaces blink_on: Checkbutton > cursor_blink frame_autocomplete: Frame auto_wait_title: Label auto_wait_int: Entry > autocomplete_wait frame_paren1: Frame paren_style_title: Label paren_style_type: OptionMenu > paren_style frame_paren2: Frame paren_time_title: Label paren_flash_time: Entry > flash_delay bell_on: Checkbutton > paren_bell frame_format: Frame format_width_title: Label format_width_int: Entry > format_width )rGeneraleditor-on-startup)rrrI)rrrH)rIndent num-spaces)rr cursor-blink)r:r8 popupwait)r:r:r?)r:r: flash-delay)r:r:bell)r:r; max-widthrz Window Preferencesrrrxz At StartuprkrzOpen Edit Windowrr0rlzOpen Shell Windowz$Initial Window Size (in characters)Widthrrg textvariablerIvalidatecommandvalidateHeightzIndent spaces (4 is standard) )rfrom_torIrrreadonly )rrqrErIz Cursor Blinkz Cursor blink)rlrz%Completions Popup Wait (milliseconds)rzParen Match Style expressionopenerparensz;Time Match Displayed (milliseconds) (0 is until next input)zBell on MismatchzFormat Paragraph Max Widthr|rfryrr~rprrrrrzN)1r[rr startup_editr win_width win_height indent_spacesr cursor_blinkautocomplete_wait paren_style flash_delay paren_bell format_widthr"rr!r&r)startup_editor_onstartup_shell_onr%r win_width_intwin_height_intr,indent_chooserr r-rerr$cursor_blink_bool auto_wait_intr'paren_style_typeparen_flash_timebell_onformat_width_intrr r rrrrr r)r` frame_window frame_run startup_titleframe_win_sizewin_size_titlewin_width_titlewin_height_title frame_cursor indent_titlecursor_blink_titleframe_autocompleteauto_wait_title frame_paren1paren_style_title frame_paren2paren_time_title frame_formatformat_width_titles rcrozWinPage.create_page_windowssR$KKt FH $!BD!++$!CE$[[$!AC#KK4 "JL!($!L"N";;$!FH";;$!LN!++4 "FH#KK$!OQ"$Af'<> ,A6 il; !,D$5$5Q'")!,D$5$5Q(!*|;%KMW="T^^1 $ 0 05 !h?#T__A $ 0 05  \q9 \"AC  I") t/A/A!$($4$4u#FD # ##qr#JSqqqA$qqqA Sr:s;DC """1"=s;4: uQRa@ ""ABQ"Gs;T!!!D """1"=O I"* t/A/A$T%"+->a#ID  Is3+]33;^21^2c|jjtjdddd|jjtjdddd|j jtjddd d|j jtjdd d d|jjtjddd d|jjtjd ddd|jjtjd dd|jjtjd ddd|jjtjd dd|jjtjd dddy)Nrrrrr3rrIintrHrrrr:r8rr:r?rrr;r) rrr0rrrrrrrrrrrs rcrpzWinPage.load_windows_cfgs h00 #6VE F 8--e= > H..u> ? x11,U < = h00VE F ""8#5#5nk$G H X//lG5 6 X//lMG H H..lF4 5 h00/5J Krd)rrrrKrnrorprrs@rcr~r~ s Fh>TKrdr~c0eZdZfdZdZdZdZxZS)rct|||j|j|j yr)rrKrncreate_page_shedload_shelled_cfgrqs rcrKzShedPage.__init__s4     rdcjtjdfd}|j|df|_y)Nrsc*j|duSrurvrxs rcrzz4ShedPage.init_validators..is_digits_or_emptyr{rdr|r}rs @rcrnzShedPage.init_validatorsrrdcttjt|d|_tjt |d|_tjt |d|_tjt|d|_t|dtd}t|dtd}t|d }t|d }t|d |j|jd|_t|d }t|d }t!||j d d|_t!||j dd|_t|d }t|d }t'||jd|_t|d } t| d } t| |jd|jd|_|j-t.ddt0t|j-|j-t.ddt0|j-t.dd t2|j-t4t6dd|jj-t.dd|j-t.dd t2|j-t4t6dd|j$j-t8t6dd|j"j-t8t6dd|j-t.dd t2|j-t4t6dd|j(j-t4dd| j-t.dd t2| j-t4t6dd|j*j-t.ddy)acReturn frame of widgets for Shell/Ed tab. Enable users to provisionally change shell and editor options. Function load_shed_cfg initializes tk variables using idleConf. Entry box auto_squeeze_min_lines_int sets auto_squeeze_min_lines_int. Setting var_name invokes the default callback that adds option to changes. Widgets for ShedPage(Frame): (*) widgets bound to self frame_shell: LabelFrame frame_auto_squeeze_min_lines: Frame auto_squeeze_min_lines_title: Label (*)auto_squeeze_min_lines_int: Entry - auto_squeeze_min_lines frame_editor: LabelFrame frame_save: Frame run_save_title: Label (*)save_ask_on: Radiobutton - autosave (*)save_auto_on: Radiobutton - autosave frame_format: Frame format_width_title: Label (*)format_width_int: Entry - format_width frame_line_numbers_default: Frame line_numbers_default_title: Label (*)line_numbers_default_bool: Checkbutton - line_numbers_default frame_context: Frame context_title: Label (*)context_int: Entry - context_lines )rPyShellauto-squeeze-min-lines)rrautosave)rrline-numbers-default)r:r9maxlinesrz Shell Preferencesrz Editor PreferencesrrxzAuto-Squeeze Min. Lines:rkr|rg)rIrrrzAt Start of Run (F5) zPrompt to Saverrz No Promptz Show line numbers in new windows)rrIzMax Context Lines :rrrfrr~rzN)r[rrauto_squeeze_min_linesrrrline_numbers_default context_linesr"rr!r&r%rauto_squeeze_min_lines_intr) save_ask_on save_auto_onr$line_numbers_default_bool context_intrr rrrrr ) r` frame_shell frame_editorframe_auto_squeeze_min_linesauto_squeeze_min_lines_title frame_saverun_save_titleframe_line_numbers_defaultline_numbers_default_title frame_context context_titles rcrzShedPage.create_page_sheds6>'.kk$!N'P# t =? $+KK4 @%B!%[[$!JL!1V&:< !$Af'<> (-[a'H$',-I2L(N$*/,A!88 $ 0 05+ ' ,>a $ 0 05  c= d s>$))s)K$))tAAA)N '',,#AA,FSqqq9aaa@ E!!!D 5C"''Sqqq'I"''T!!!'L &&++AA+F!!!<QQQ? 3QQ7rdc |jjtjdddd|jjtjddddd |j jtjdd d d |j jtjd dddy)Nrrrrrrrrr)rr3rrr:r9r)rrr0rrrrrs rcrzShedPage.load_shelled_cfgSs ##''(:(: #;%)I J (,, :qvG H !!%%h&8&8(>V'M N x11mZe E Frd)rrrrKrnrrrrs@rcrrs Ff8P FrdrcBeZdZfdZdZdZdZdZdZdZ xZ S)rwct||tjd|_tj d|_|jt|_|j|jy)Nr:) rrKr0rext_defaultCfgr ext_userCfgris_intload_extensionscreate_page_extensionsrqs rcrKzExtPage.__init__as^  &11,?#++L9mmF+   ##%rdct||_t|dtd}t |dtd|_|j dd|jddt||jd |_ |jjd |jt||jj }|j|j_t|d d |_|jj#ddd|j#ddd|j j#dddddg|j%di|_d|_||_|j|_d}t/|j0D]}|j3||dz|zdz} |jj||jj5d|jd|j#dddt7|j#dd|j j#dddy)aConfigure IDLE feature extensions and help menu extensions. List the feature extensions and a configuration box for the selected extension. Help menu extensions are in a HelpFrame. This code reads the current configuration using idleConf, supplies a GUI interface to change the configuration values, and saves the changes using idleConf. Some changes 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. Methods: extension_selected: Handle selection from list. create_extension_frame: Hold widgets for one extension. set_extension_value: Set in userCfg['extensions']. save_all_changed_extensions: Call extension page Save(). rz Feature Extensions rz Help Menu Extensions rrrbrowse) listvariable selectmodez<>r)rIrHnwsrrrjnsrr)rrrjrrgNr{z} r)rrsew)rextension_namesr"r HelpFrame frame_helprrrextension_listrextension_selectedr*rrr details_framerur config_framecurrent_extension outerframetabbed_page_setrr:create_extension_frame selection_setr&)r` frame_extscroll ext_namesr?s rcrzExtPage.create_page_extensionsis 0 )t6$:< #Da$<> q+!!!A!.%id>R>R19;   !4d6M6MN9d.A.A.G.GH+1::*' SI   q ? 1!D 1 qab!WMB'!%#22 t/H  ' ' 1!C(2T9I0   + ))!, % 1Qv6 d Qq) 1U;rdc  i|_tjdD]}g|j|<|jD]}t|jj |}|Dcgc]}|j dr|}}|D]}|j|||z}|D]}|jj||d} ddd|}d} |jj|||d| }t|} | jt||j|j!||||| d y cc}w#t$r% t|}d}n#t$r|}d }YnwxYwYwxYw#t$r|}YwxYw) zAFill self.extensions with data from the default and user configs.F) active_onlyenableT)raw)TrueFalserrN)r3r r)r4r3rr0var)r:r0 GetExtensionsrr GetOptionList startswithremoverKeyErrorrr#rrrrappend) r`r?opt_listopt_nameenablesdef_strdef_objopt_typer0r s rcrzExtPage.load_extensionss ..5AH(*DOOH %BHd11??IJH199H"--h7 G9#)$)H$--11 (26 (&*E:7CG%H$ ,,00$hX4$+1-E  oE #)00(:B=D;@9< 234-%(9 (("%g,#(%(")#'( ("$#E$sN)D? E E5 E2 EE2 E, )E2+E, ,E21E25 FFc|jj}|r|jj|}|||jk7rV|jrJ|jj d|j |jjd|_|rE|jj ||j |jddd||_yy)z/Handle selection of an extension from the list.Nrrkrrr) rrbrrrrr grid_forgetru)r`r5newsels rcrzExtPage.extension_selecteds$$113 ((,,V4F >Vt'='==%%""))r)2!!$"8"89EEG)-&     % %6 % 2   f % * *!6 * J%+D " rdc&t|jdd}||j|<|j}t |j |D]\}}t ||d}|j|dt|d}|dd k(r(t||d d d j|dtdc|ddk(r4t||d|jdfdj|dtdt||dj|dtdy)z=Create a frame holding the widgets to configure one extensionrrGr4rkrrr r3rr r r{)rrrrIr)rrrjrrrgr|r)rrrrIr)rrIN)VerticalScrolledFramerrinterior enumerater:r&rurr$rr%rr)r`r?f entry_arearoptlabelr s rcrzExtPage.create_extension_frames !$"4"4S L&'(#ZZ !$//("; !!&&C&B   %%3q%9 ##((c!!(Drdc$|jy)z+Handle event for selecting additional help.N)set_add_delete_staterVs rcr8zHelpFrame.help_source_selected\rrdc|jjdkr7|jjd|jjdy|jj r7|jjd|jjdy|jjd|jjdy)zAToggle the state for the help list buttons based on list entries.rrrN)r7sizer:rqr>rbrs rcrCzHelpFrame.set_add_delete_state`s ==   ! #  % % + +M :  ' ' - -m <}}))+))//?++11.A))// >++11-@rdct|dj}|rO|jj||jj t |d|jyy)zHandle add button for the help list. Query for name and location of new help sources and add them to the list. zNew Help SourcerN)r6r user_helplistrr7rrupdate_help_changes)r` help_sources rcr;zHelpFrame.helplist_item_addmsW !'89@@     % %k 2 MM k!n 5  $ $ & rdc|jjt}|j|}t |d|d|dj }|rp||k7rj||j|<|jj ||jj||d|j|jyyy)zHandle edit button for the help list. Query with existing help source information and update config if the values are changed. zEdit Help Sourcerr)menuitemfilepathN) r7rrrGr6rrHrrHrC)r` item_indexrInew_help_sources rcr9zHelpFrame.helplist_item_editys ]]((0 ((4 $($Q$Q&  +=-?rdc|jjt}|j|=|jj ||j |j y)z`Handle remove button for the help list. Delete the help list item from config. N)r7rrrGrHrHrC)r`rMs rcr=zHelpFrame.helplist_item_removesP ]]((0   z * Z(   " !!#rdc itdd<tdt|jdzD]E}tj ddt |dj |j|dz ddGy)z2Clear and rebuild the HelpFiles section in changesr HelpFilesr;Nr)rrrrGr-rrZ)r`nums rcrHzHelpFrame.update_help_changessl') $C 2 23a78C   KSHHT//A6r:; =9rdctj|_|jj dd|jD]%}|jj t |d'|jy)Nrr)r0GetAllExtraHelpSourcesListrGr7rHrrrC)r` help_items rcr1zHelpFrame.load_helplists[%@@B Q&++I MM il 3, !!#rd) rrrrKr0r8rCr;r9r=rHr1rrs@rcrr#s3 0Ed$ A '(( $=$rdrc>eZdZdZdZdZdZedZdZ dZ y) VarTracez"Maintain Tk variables trace state.c g|_g|_y)aStore Tk variables and callbacks. untraced: List of tuples (var, callback) that do not have the callback attached to the Tk var. traced: List of tuples (var, callback) where that callback has been attached to the var. N)untracedtracedrs rcrKzVarTrace.__init__s  rdcl|jj|jjy)zClear lists (for tests).N)rZrr[rs rcrzVarTrace.clears$  rdct|tr|j||}|jj ||f|S)a_Add (var, callback) tuple to untraced list. Args: var: Tk variable instance. callback: Either function name to be used as a callback or a tuple with IdleConf config-type, section, and option names used in the default callback. Return: Tk variable instance. ) isinstancetuple make_callbackrZrr`r callbacks rcrz VarTrace.adds; h &))#x8H c8_- rdcfd}|S)zCReturn default callback function to add values to changes instance.cPtjgjy)z&Add config values to changes instance.N)rr-r)r/rr s rcdefault_callbackz0VarTrace.make_callback..default_callbacks    2 2 2rdr[)r rres`` rcr`zVarTrace.make_callbacks 3 rdc|jrZ|jj\}}|jd||jj ||f|jrYyy)z0Attach callback to all vars that are not traced.writeN)rZpop trace_addr[rras rcr\zVarTrace.attachsLmm MM--/MC MM'8 , KK  X /mmrdc|jrn|jj\}}|jd|jdd|jj ||f|jrmyy)z!Remove callback from traced vars.rgrrN)r[rh trace_remove trace_inforZrras rcdetachzVarTrace.detachs]kk KKOO-MC   Wcnn&6q&9!&< = MM #x 1kkrdN) rrrrrKrrrkr`r\rmr[rdrcrXrXs2,  "  02rdrXa7When 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. [Cancel] only cancels changes made since the last save. u Font sample: This shows what a selection of Basic Multilingual Plane unicode characters look like for the current font selection. If the selected font does not define a character, Tk attempts to find another font that does. Substitute glyphs depend on what is available on a particular system and will not necessarily have the same size as the font selected. Line contains 20 characters up to Devanagari, 14 for Tamil, and 10 for East Asia. Hebrew and Arabic letters should display right to left, starting with alef, א and ا. Arabic digits display left to right. The Devanagari and Tamil lines start with digits. The East Asian lines are Chinese digits, Chinese Hanzi, Korean Hangul, and Japanese Hiragana and Katakana. You can edit the font sample. Changes remain until IDLE is closed. z 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. z Keys: The IDLE Modern Unix key set is new in June 2016. It can only be used with older IDLE releases if it is saved as a custom key set, with a different name. a_ General: AutoComplete: Popupwait is milliseconds to wait after key char, without cursor movement, before popping up completion box. Key char is '.' after identifier or a '/' (or '\' on Windows) within a string. FormatParagraph: Max-width is max chars in lines after re-formatting. Use with paragraphs in both strings and comment blocks. ParenMatch: Style indicates what is highlighted when closer is entered: 'opener' - opener '({[' corresponding to closer; 'parens' - both chars; 'expression' (default) - also everything in between. Flash-delay is how long to highlight if cursor is not moved (0 means forever). CodeContext: Maxlines is the maximum number of code context lines to display when Code Context is turned on for an editor window. Shell Preferences: Auto-Squeeze Min. Lines is the minimum number of lines of output to automatically "squeeze". a ZzDummy: This extension is provided as an example for how to create and use an extension. Enable indicates whether the extension is active or not; likewise enable_editor and enable_shell indicate which windows it will be active on. For this extension, z-text is the text that will be inserted at or removed from the beginning of the lines of selected text, or the current line if no selection. )z Fonts/Tabsrmr-rrnc@|sy t|y#t$rYywxYw)z(Return 's is blank or represents an int'TF)rr#)r)s rcrr- s)  A s  ceZdZdZdZy)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 cH tj||g|i|t|t}|j t t tt|dd|jdj ttt|jjjdj!dtx|_j%ddt& fd }j)d | fd }j)d |y) Nr)rrrprqr)rrXrrIrr)windowrcpjjf}jd|zy)Nz 0 0 %s %s) scrollregion)winfo_reqwidthwinfo_reqheightr)r5rEcanvasr s rc_configure_interiorz;VerticalScrolledFrame.__init__.._configure_interiorT s2++-x/G/G/IJD MM{T'9M :rdz cjjk7r"jjyy)N)rI)ru winfo_width itemconfigure)r5rwr  interior_ids rc_configure_canvasz9VerticalScrolledFrame.__init__.._configure_canvasZ s?&&(F,>,>,@@$$[8J8J8L$MArd)r!rKr*rrrr r rrrrr rr xview_moveto yview_movetor  create_windowrr) r`rLrkw vscrollbarrxr}rwr r|s @@@rcrKzVerticalScrolledFrame.__init__? s tV1d1b1tH5 QU59!'1~~SB D 6&,,/ AA$)=0 **1a*L  ;  m%89 N  M#45rdN)rrrrrKr[rdrcrr8 s  !rdr__main__)rz#idlelib.idle_test.test_configdialogrF) verbosityexit)run)crr~tkinterrrrrrrr r r r r rrrrrrrrrrrrrrrrrrr tkinter.ttkr!r"r#r$r%r&r'r(r)r*r+r,r-r. tkinter.fontr(rr/idlelib.configr0r1idlelib.config_keyr2idlelib.dynoptionr3idlelibr4 idlelib.queryr5r6idlelib.textviewr7idlelib.autocompleter8idlelib.codecontextr9idlelib.parenmatchr:idlelib.formatr;idlelib.squeezerr<r=rrr?rr{ryr|r~rrwrrXr[rrrrrunittestridlelib.idle_test.htestrr[rdrcrs  JJJJJJJJ ,,,,!2,+1&-+)*%0 /[*o {8{^E