U :eg@s`dZddlZddlmZmZmZmZmZmZm 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,ddlm-Z-ddl.m/Z0ddlm1Z1ddl2m3Z3m4Z4ddl5m6Z6dd l7m8Z8dd l9m:Z:dd l;mm?Z?dd l@mAZAddlBmCZCddlDmEZEddlFmGZGddlHmIZIddl>mJZJe4ZKeAeCeEeGeIfZLGdddeZMdaNGddde"ZOGddde"ZPGddde"ZQGddde"ZRGdddZSeSZTd ZUd!d"d#d$d%d&ZVd'd(ZWGd)d*d*e"ZXeYd+kr\dd,lZm[Z[e[d-d.d/d0dd1l\m]Z]e]eMdS)2aIDLE 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)ToplevelListboxScaleCanvas StringVar BooleanVarIntVarTRUEFALSETOPBOTTOMRIGHTLEFTSOLIDGROOVENONEBOTHXYWEEWNSNSEWNW HORIZONTALVERTICALANCHORACTIVEEND) Frame LabelFrameButton CheckbuttonEntryLabel OptionMenuNotebook Radiobutton ScrollbarStyle) colorchooser) messagebox)idleConf ConfigChanges) GetKeysDialog) DynOptionMenu)macosx) SectionName HelpSource) view_text) AutoComplete) CodeContext) ParenMatch)FormatParagraph)Squeezer)ScrollableTextFramecseZdZdZd%dddddZddZd d Zd d Zd dZddZ fddZ ddZ ddZ ddZ ddZddZddZdd Zd!d"Zd#d$ZZS)& ConfigDialogzConfig dialog for IDLE. F)_htest_utestcCst||||_|ri|_|s(|||p2d|d}||sPdnd}|d|d|| |j t t d| || d|j|jjt|s|||dS) 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+heightwidthZWM_DELETE_WINDOWN)r__init__parent instance_dictZwithdrawtitleZ winfo_rootxZ winfo_rootyZgeometrycreate_widgetsZ resizabler Z transientprotocolcancelfontpagefontlistZ focus_settracersattachZgrab_setZ wm_deiconifyZ wait_window)selfrGrIr=r>xyrT9/usr/local/python38/lib/python3.8/idlelib/configdialog.pyrF0s(    zConfigDialog.__init__cCst|dd|_}|jjddt||_}t||_t||j|_t ||_ t ||_ | |_|j|jdd|j|jdd|j|j dd|j|j d d|j|jd d||jtttd |jtd d S)aCreate and place widgets for tabbed dialog. Widgets Bound to self: frame: encloses all other widgets note: Notebook highpage: HighPage fontpage: FontPage keyspage: KeysPage genpage: GenPage extpage: self.create_page_extensions Methods: create_action_buttons load_configs: Load pages except for extensions. activate_config_changes: Tell editors to reload. Z5pxpaddingZnwes)sticky Fonts/Tabstext Highlightsz Keys z General Extensionssideexpandfillr_N)r framegridr'noteHighPagehighpageFontPagerMKeysPageZkeyspageGenPageZgenpagecreate_page_extensionsZextpageaddZenable_traversalpackr r rcreate_action_buttonsr )rQrcrerTrTrUrJ_s     zConfigDialog.create_widgetscCstri}nddi}t|jdd}t|dd}i|_d|jfd|jfd|jfd|jffD]:\}}t |f||t d ||j|<|j|j t d d qZt|dd d j t d|j td|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 rW)rVZOkZApplyZCancelZHelp)r[command takefocus)r_padxr)rD borderwidthrb)r1ZisAquaTkr rcZbuttonsokapplyrLhelpr"r rmrr r )rQZ padding_argsZouterZ buttons_frameZtxtcmdrTrTrUrns(     z"ConfigDialog.create_action_buttonscCs||dS)zvApply config changes, then dismiss dialog. Methods: apply destroy: inherited N)rxdestroyrQrTrTrUrwszConfigDialog.okcCs$|t||dS)zApply config changes and leave dialog open. Methods: deactivate_current_config save_all_changed_extensions activate_config_changes N)deactivate_current_configchangessave_allsave_all_changed_extensionsactivate_config_changesr|rTrTrUrxszConfigDialog.applycCst|dS)zPDismiss config dialog. Methods: destroy: inherited N)r~clearr{r|rTrTrUrLszConfigDialog.cancelcs&|jjdda|tdS)N1.0end)rM font_samplegetfont_sample_textZ grab_releasesuperr{r| __class__rTrUr{szConfigDialog.destroycCs8|jj|jdd}t|dtt|dddS)zCreate textview for config dialog help. Attributes accessed: note Methods: view_text: Method from textview module. r[)optionzHelp for IDLE preferencesr<)rIcontentsN)reZtabselectstripr4 help_common help_pagesr)rQZpagerTrTrUryszConfigDialog.helpcCs"|jj}|D] }|qdS)zRemove current key bindings. Iterate over window instances defined in parent and remove the keybindings. N)rGrHkeysZRemoveKeybindings)rQ win_instancesinstancerTrTrUr}s z&ConfigDialog.deactivate_current_configcCs\|jj}|D]4}||||||qt D] }| qJdS)zApply configuration changes to current windows. Dynamically update the current parent window instances with some of the configuration changes. N) rGrHrZResetColorizerZ ResetFontZset_notabs_indentwidthZApplyKeybindingsZreset_help_menu_entriesZupdate_cursor_blink reloadablesreload)rQrrklassrTrTrUrs  z$ConfigDialog.activate_config_changescCsd|j}t|j}tjd|_tjd|_|t |_ | t ||_ |j ddd|jdddt||j dd|_|jd|jt||jjd }|j|j_t|d d d |_|jjddd d |jdddd |jjdddddgd|jddi|_d|_||_|j|_d}t|j D] }|!||d|d}q|j ||j"d|d|S)a7Part of the config dialog used for configuring IDLE extensions. This code is generic - it works for any and all IDLE extensions. IDLE extensions save their configuration options using idleConf. This code reads the current configuration using idleConf, supplies a GUI interface to change the configuration values, and saves the changes using idleConf. Not all changes take effect immediately - some may require restarting IDLE. This depends on each extension's implementation. All values are treated as text, and it is up to the user to supply reasonable values. The only exception to this are the 'enable*' options, which are boolean, and can be toggled with a True/False button. Methods: load_extensions: 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(). extensionsrZweightrqZbrowse)Z listvariableZ selectmodez<>rr)rErDZnwscolumnrowrXnsnsew )rrrXrurVNr<{z} )#rGr rer- defaultCfgext_defaultCfguserCfg ext_userCfgregisteris_intload_extensionsrZextension_names rowconfigurecolumnconfigurerextension_listbindextension_selectedr)yviewsetyscrollcommandr! details_framerd configure config_framecurrent_extensionZ outerframeZtabbed_page_setsortedrcreate_extension_frameZ selection_set)rQrGrcZscrollZ ext_namesext_namerTrTrUrks@           z#ConfigDialog.create_page_extensionsc CsLi|_tjddD]}g|j|<q|jD]}t|j|}dd|D}|D]}||qP||}|D]}|jj||dd}zddd|}d}WnBtk rzt |}d }Wnt k r|}d }YnXYnXz|j j|||d|d }Wnt k r|}YnXt |} | t||j|||||| d qlq(d S) zAFill self.extensions with data from the default and user configs.F)Z active_onlycSsg|]}|dr|qS)enable) startswith).0opt_namerTrTrU @s z0ConfigDialog.load_extensions..T)raw)TrueFalseboolintN)typerdefault)namerrvaluevar)rr-Z GetExtensionsrrZ GetOptionListremoveGetKeyErrorr ValueErrorrrrstrappend) rQrZopt_listZenablesrZdef_strZdef_objZopt_typerrrTrTrUr5sV      zConfigDialog.load_extensionscCs|j}|r|j|}|dks,||jkrV|jrV|jjdd|j|jd|_|r|jj|d|j|jdddd||_dS)z/Handle selection of an extension from the list.Nr<rZrrr) r curselectionrrrconfigrZ grid_forgetrd)rQeventZnewselrTrTrUrcs  zConfigDialog.extension_selectedcCst|jddd}||j|<|j}t|j|D]\}}t||dd}|j|dtd|d}|dd krt ||d d d d j|dt ddq.|ddkrt ||d|j dfddj|dt ddq.t ||ddj|dt ddq.dS)z=Create a frame holding the widgets to configure one extensionrrCrrZrrrrXrrrrr)variableonvalueoffvaluerEr)rrrXrurkey%Pr) textvariablevalidatevalidatecommandrErrEN)VerticalScrolledFramerrinterior enumeraterr%rdrr#rr$rr)rQrfZ entry_arearoptZlabelrrTrTrUrrsF   z#ConfigDialog.create_extension_framecCsX|d}|d}|dp"|}|d|||krH|j||S|j|||S)zReturn True if the configuration was added or changed. If the value is the same as the default, then remove it from user config file. rrr)rrrrZ RemoveOption SetOption)rQsectionrrrrrTrTrUset_extension_valuesz ConfigDialog.set_extension_valuecCsFd}|jD](}|j|}|D]}|||rd}qq |rB|jdS)zSave configuration changes to the user config file. Attributes accessed: extensions Methods: set_extension_value FTN)rrrZSave)rQZ has_changesroptionsrrTrTrUrs    z(ConfigDialog.save_all_changed_extensions)r<)__name__ __module__ __qualname____doc__rFrJrnrwrxrLr{ryr}rrkrrrrr __classcell__rTrTrrUr;,s"/"(     >.r;u^ AaBbCcDdEeFfGgHhIiJj 1234567890#:+=(){}[] ¢£¥§©«®¶½ĞÀÁÂÃÄÅÇÐØß ɐɕɘɞɟɤɫɮɰɷɻʁʃʆʎʞʢʫʭʯ ΑαΒβΓγΔδΕεΖζΗηΘθΙιΚκ БбДдЖжПпФфЧчЪъЭэѠѤѬӜ אבגדהוזחטיךכלםמןנסעף ابجدهوزحطي٠١٢٣٤٥٦٧٨٩ ०१२३४५६७८९अआइईउऊएऐओऔ ௦௧௨௩௪௫௬௭௮௯அஇஉஎ 〇一二三四五六七八九 汉字漢字人木火土金水 가냐더려모뵤수유즈치 あいうえおアイウエオ csVeZdZfddZddZddZddZd d Zdd d ZddZ ddZ Z S)rhcs0t||j|_|||dSN)rrFhighlight_samplecreate_page_font_tab load_font_cfg load_tab_cfg)rQmasterrgrrTrUrFs  zFontPage.__init__c Cstt||j|_tt||j|_tt||j|_tt|d|_ t |dt dd}t |dt dd}t |dt dd}t |}t |}t |tdd}t|d d td |_|jd |j|jd |j|jd|jt|}|j|jjd|jj|jdt |dd}t||jd|_t||jdddd|_t|} | j|_|jjtddd|j t!t"t |tdd} t#||j ddddd|_$|j%ddd|j&ddd|j'ddddd|j'ddd ddd!d"|j'ddddd#d$|j(t)ddt*d%|j(t)ddt*d%|j(t)t+d&|jj(tt,t*d'|j(tt-d(|j(tt+d&|jj(tt+d&|jj(tt+d)d*| j(t,t.d+| j(t)t+dd*|j$j(t)dt*d,dS)-aReturn frame of widgets for Font/Tabs 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. Tabs: Enable users to change spaces entered for indent tabs. Changing indent_scale value with the mouse sets Var space_num, which invokes the default callback to add an entry to changes. Load_tab_cfg initializes space_num to default. 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 frame_indent: LabelFrame indent_title: Label (*)indent_scale: Scale - space_num )mainIndent num-spacesrqz Shell/Editor Font rvreliefr[z Font Sample (Editable) z Indentation Width z Font Face :)Zjustifyr[rTrDrsexportselectionzzr)rzSize :rZNrrZBold)rrrr[)wraprErDzPython Standard: 4 Spaces!Z horizontal)rorientZ tickintervalZfrom_torrt)rrrupadyrpr)rrZrowspanrurrXZew)rrrurrXr_rurrar_anchorr^)r_rar?r_rru)r`ra)r_rura)/rOrlrvar_changed_font font_name font_sizer font_boldr space_numr!rr r%rrr rNron_fontlist_selectr)rrrr0sizelistr#Z bold_toggler:r[rrinsertrrrZ indent_scalerrrdrmr rrr rr) rQZ frame_fontZ frame_sampleZ frame_indentZframe_font_nameZframe_font_paramZfont_name_titleZ scroll_fontZfont_size_titleZfont_sample_frameZ indent_titlerTrTrUrs. zFontPage.create_page_font_tabc Cst|dd}|d}|d}|ddk}ttt|}|D]}|jt |qD|j |dd|D}z>| |}|j ||j ||j||j|Wntk rYnX|jd ||j||d S) 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. r EditorWindowrrrqZboldcSsg|] }|qSrT)lower)rsrTrTrUrhsz*FontPage.load_font_cfg..)789101112131416Z18Z20Z22Z25Z29Z34Z40N)r-ZGetFontr rrtkfontfamiliesrNr rrindexsee select_set select_anchorZactivaterr SetMenur set_samples) rQZconfigured_fontrrrZfontsfontZlc_fontsZcurrent_font_indexrTrTrUrWs,        zFontPage.load_font_cfgcGsZ|j}tddd||j}tddd||j}tddd||dS)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. rr rz font-sizez font-boldN)rrr~ add_optionrrrrQparamsrrTrTrUrys   zFontPage.var_changed_fontcCs0|j|jjdkrtnt}|j|dS)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. Z KeyReleaseN) rNrrrrrrrr )rQrrrTrTrUrszFontPage.on_fontlist_selectNcCsH|j}|jrtjntj}||j|f}||jd<||jd<dS)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. rN) rrrrZBOLDZNORMALrrr)rQrrZ font_weightZnew_fontrTrTrUrs   zFontPage.set_samplescCs$tjdddddd}|j|dS)zLoad current configuration settings for the tab options. Attributes updated: space_num: Set to value from idleConf. rrrrrrN)r- GetOptionrr)rQrrTrTrUrszFontPage.load_tab_cfgcGs|j}tddd|dS)z!Store change to indentation size.rrrN)rrr~r r!rTrTrUvar_changed_space_nums zFontPage.var_changed_space_num)N) rrrrFrrrrrrr&rrTrTrrUrhs p"  rhcseZdZfddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*ZZS)+rfcs4t|||_t||_||dSr)rrFwinfo_toplevelcdr*stylecreate_page_highlightload_theme_cfgrQrrrTrUrFs    zHighPage.__init__cs&ddddddddd d d d d dddd_ttj_ttj_t_ ttj _ ttj _ ttj_tdtdd}tdtdd}t|tdd}|j}_|jddddtdtd|ddd|dd dd!}|D]\}}|t||qt|d"t}td|D]0} || d#| tt |d$d%d&qHjD].} | ffd'd( } |!j| dd)| qd*|d+<j"jd,dd-d.t#|d,d/_$t#|} t%j$d0j&d1_'t(j$jd2dd3_)t*| j dd4j+d5_,t*| j dd6j+d5_-j .dt%|d7j/d1_0t1|d8d9} t*|j dj2d:d;_3t*|j dj2dj7d1_8t1|dd?_9|j:t;d@d@td@d@t?dBj$j:t>d@d@t?dB| j:t>d@ddC|j:t>d@d@ttttBd@d@dJj3j:t>tBd@dKj4j:t>tBd@ddJj5j:t>t?d@d@dIj6j:t>t?tBd@d@dLj8j:t>t?d@d@dIj9j:t>t?d@dMd2S)NaReturn frame of widgets for Highlighting 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 )normalZ00)contextZ01)keywordZ02) definitionZ03)builtinZ04)commentZ05)stringZ06)hiliteZ07)hitZ08)cursorZ09)breakr)consoler)errorr)stdoutr)stderrr) linenumberr)zNormal Code or Textz Code ContextzPython KeywordszPython DefinitionszPython BuiltinszPython CommentszPython Stringsz Selected Textz Found TextCursorzEditor Breakpointz Shell Promptz Error TextzShell User OutputzShell User Exceptionz Line Numberrqz Custom Highlighting rz Highlighting Theme r)rrv)Zcourier r<Zhand2r)rr6rErDrshighlightthicknessrzcSsdSNr7rTerTrTrUZz0HighPage.create_page_highlight..z cSsdSr@rTrArTrTrUrC[rD)")z# Click selects item.r2 r-)zcode context sectionr.rE)z| cursorr6rE)defr/) r-)funcr0)z (param): r-)z"Return None."r3)z var0 = r-)z'string'r3)z var1 = r-)z 'selected'r4)z var2 = r-)z'found'r5)z var3 = r-)listr1)(r-)Noner/)z) r-)z breakpoint("line")r7)z r-z>>>r8)z 3.14**2 r-)z9.8596r:rErM)z pri r-)nr9)zt( r-) SyntaxErrorr;rErz.0drHr<csj|dSr)highlight_targetr)relemr|rTrUtemvsz+HighPage.create_page_highlight..temzdisabledstateframe_color_set.TFrameZsolid)rvr)r)zChoose Color for :r[rrN)r?Z Foreground)rrr[rrZ BackgroundzSave as New Custom Themez Select : rZza Built-in Themerrrrr[za Custom ThemerzDelete Custom Themervrtr_rurr`rarr_rurrr#)r_r`rarurrprr_rarurr_rrurr)r_rarrur)r_rar)Dtheme_elementsrOrlrvar_changed_builtin_name builtin_namevar_changed_custom_name custom_namer fg_bg_togglevar_changed_colorcolorvar_changed_theme_source theme_sourcevar_changed_highlight_targetrQr!rr:rr[rrr rrr rlenr splitlinesrangerZtag_bindr)r frame_color_setr" get_colorZbutton_set_colorr0 targetlistr(set_color_sample_bindingfg_onbg_onrsave_as_new_themeZbutton_save_customr%set_theme_typeZbuiltin_theme_oncustom_theme_on builtinlist customlist delete_custombutton_delete_custom theme_messagermrr rr rrr rr )rQ frame_customZ frame_themeZ sample_framer[Z string_tagsr3tagZn_lineslinenoelementrSZframe_fg_bg_toggleZtheme_type_titlerTr|rUr*sTv         zHighPage.create_page_highlightc s.jtjddddddt}jrtdd}|j ||tdd}||sj d j d qވj ||d nHtdd}|j ||tdd}|j ||d tj}|jfd d dj ||d dS)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 rThemerrrrr highlightuserrT- no custom themes -rcsj|dS)Nr)r^)rRr|rTrUrCrDz)HighPage.load_theme_cfg..)rN)rgrr-r%Z CurrentThemerGetSectionListsortrurrtrUrbrvrsrJr^rrnpaint_theme_sampleset_highlight_target)rQcurrent_option item_listZ theme_namesrTr|rUr+s<       zHighPage.load_theme_cfgcGsd}|j}||krXtddd|kr.rrzUse a Built-in Key SetrXzUse a Custom Key SetNrzDelete Custom Key SetrWzSave as New Custom Key SetrYrtrZrr\r)rrZ columnspanrXr)rrrXrurT)r_rar`rur_rar`)r_rar`r)8rOrlrr_r`rarbrvar_changed_keyset_source keyset_sourcevar_changed_keybinding keybindingr!rr r%r)rrr bindingslistron_bindingslist_selectrZxviewrr" get_new_keysbutton_new_keysrkr( set_keys_typeZbuiltin_keyset_oncustom_keyset_onr0rurvdelete_custom_keysbutton_delete_custom_keyssave_as_new_key_setZbutton_save_custom_keys keys_messagermr r rrrrrrdrrrrr )rQrzZ frame_targetZ target_titleZscroll_target_yZscroll_target_xZframesrTrrUrKsR       zKeysPage.create_page_keysc Cs|jtjddddddt}|jrtdd}||j ||tdd}||s|j d |j d q|j ||d nHtdd}||j ||tdd}||j |t|t}||d S) z?Load current configuration settings for the keybinding options.rKeysrrrrrrr- no custom keys -rN)rrr-r%Z CurrentKeysrrrrurrrUrbrv default_keysrload_keys_list)rQrr keyset_namerTrTrUrs6       zKeysPage.load_key_cfgcGsd}|j}||krXtddd|kr                  zKeysPage.get_new_keyscCs,tddtdd}t|d||j}|S)z)Return new key set name from query popup.rrrzNew Custom Key Setr)rQrrrrTrTrUrrs  zKeysPage.get_new_keys_namecCs|d}|r||dS)z@Prompt for name of new key set and save changes using that name.zNew Key Set Name:N)rr)rQZ new_keys_namerTrTrUrzs zKeysPage.save_as_new_key_setcCs|jddS)z6Activate button to assign new keys to selected action.rN)rrUrQrrTrTrUrszKeysPage.on_bindingslist_selectc Cs|jr|j}n |j}t|}i}|D]&}|dd}d||}|||<q2|tdkrtd|}|D]}||||<qv|||t dd} | |j | ||j d|dS)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. rqrHrrrN)rrr`rbr-Z GetCoreKeysjoinr~save_new_key_setrrrvrrr) rQZnew_key_set_nameZprev_key_set_nameZ prev_keysrrZ event_namerrZcustom_key_listrTrTrUrs&           zKeysPage.create_new_key_setcCsd}|jrd}|jt}t|}t|}||j dt |D]`}d ||}|dd}|t dkr|t d|krt d||}|j t |d|qN|r|j||j||j|d S) 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. FTrrHrqrrrN)rrrrr-Z GetKeySetrJrrrrrr~r rrr)rQrZreselectrkeysetZ bind_namesrrrTrTrUrs&        zKeysPage.load_keys_listcCs:tjd||D] }||}tjd|||qdS)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 rNr)rrrrrTrTrUrs zKeysPage.save_new_key_setcOs tj||SrrrrTrTrUrszKeysPage.askyesnocCs|j}d}|jd|||ds&dS|jtd|tdd}| |sp|j d|j |dn|j ||d |jtjd d d |jtjd d d ptt|j|j|dS)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 SetrNrrrrrrrrr)rbrrr(r}r~rr-rrrrUrvrrrrrr`rrrrr)rQrrrrTrTrUrs6       zKeysPage.delete_custom_keys)rrrrFrrr_rarrrrrrrrr staticmethodrrrrrTrTrrUriCs& !   , ricsdeZdZfddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ Z S)rjcs(t||||dSr)rrFinit_validatorscreate_page_generalload_general_cfgr,rrTrUrFs zGenPage.__init__cs*tdfdd}||df|_dS)Nz[0-9]*cs|dk S)z+Return 's is blank or contains only digits'N) fullmatchr Zdigits_or_empty_rerTrUis_digits_or_emptysz3GenPage.init_validators..is_digits_or_emptyr)recompiler digits_only)rQrrTrrUrs  zGenPage.init_validatorsc Cstt|d|_tt|d|_tt|d|_tt|d|_tt|d|_ tt|d|_ tt|d|_ tt|d|_ tt|d |_ tt|d |_tt|d |_tt|d |_tt|d |_t|dtdd}t|dtdd}t|dtdd}t|dtdd}t|dd}t|dd}t||jddd|_t||jddd|_t|dd}t|dd}t|dd} t||jd|jdd |_t|d!d} t||jd|jdd |_t|dd} t| d"d} t| |jdd#|_t|dd} t| d$d}t| d%|j |jdd&|_t|dd}t|d'd}t ||j d(d)d*d(|_!t|dd}t|d+d}t||j d%d,|_"t|d-|j d.|_#t|dd}t|d/d}t||jdd0d|_$t||jdd1d|_%t|dd}t|d2d}t||jd3|jdd |_&t|dd}t|d4d}t||jdd#|_'t|dd}t|d5d}t||jd|jdd |_(t|dd}t|d6d}t|d3|j |jdd&|_)t|}t|}t*|d7d8t+d9|_,t-|}|j,j.|d:<|j/|j,d;<|j,0d<|j1t2|d=d>d?|j3d@|_4t2|dAd?|j5dB|_6t2|dCd>d?|j7d@|_8|j9t:d7d7t;tt?d7d7dF|jj9t@t?d7d7dF|jj9t@t?d7d7dF|j9t:d7dt=dE|j9t>t?d7d7dF|jj9t@tAdGd7dF| j9t@tAd7dH|jj9t@tAdGd7dF| j9t@tAd7dH| j9t:d7dt=dE| j9t>t?d7d7dF|jj9t>d7d7dI| j9t:d7dt=dE|j9t>t?d7d7dF|jj9t:dGd7dI|j9t:d7dt=dE|j9t>t?d7d7dF|j!j9t:dGd7dI|j9t:d7dt=dE|j9t>t?d7dJ|j#j9t@tAdKd7dF|j"j9t:t?dKd7dF|j9t:d7dt=dE|j9t>t?d7d7dF|j%j9t@t?d7d7dF|j$j9t@t?d7d7dF|j9t:d7dt=dE|j9t>t?d7d7dF|j&j9t:dGd7dI|j9t:d7dt=dE|j9t>t?d7d7dF|j'j9t>d7d7dI|j9t:d7dt=dE|j9t>t?d7d7dF|j(j9t:d7d7dI|j9t:d7dt=dE|j9t>t?d7d7dF|j)j9t:d7d7dI|j9t@d7d7tBdE|j9t:d7d7t;ttAt;t.default_callbackrT)rrrrTrrUrszVarTrace.make_callbackcCs6|jr2|j\}}|d||j||fqdS)z0Attach callback to all vars that are not traced.writeN)r popZ trace_addr rrrTrTrUrPs zVarTrace.attachcCsB|jr>|j\}}|d|dd|j||fqdS)z!Remove callback from traced vars.rrrN)r rZ trace_removeZ trace_infor rrrTrTrUdetachszVarTrace.detachN) rrrrrFrrlrrrPrrTrTrTrUr s  r a7When 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. )rYr\rrr]cCs2|sdSzt|WdStk r,YdSXdS)z(Return 's is blank or represents an int'TFN)rrrrTrTrUr src@seZdZdZddZdS)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 cstj||f||t|td}|jtttdt|dd|j ddjt t t d|j jdddt|_jddtdfd d }d |fd d }d |dS)Nr)rar_r`r)rvr?rrErr)Zwindowrcs$f}jd|ddS)Nz 0 0 %s %s)Z scrollregion)winfo_reqwidthZwinfo_reqheightr)rr)canvasrrTrU_configure_interiorB sz;VerticalScrolledFrame.__init__.._configure_interiorz cs&kr"jddS)N)rE)rZ winfo_widthZ itemconfigure)rrrZ interior_idrTrU_configure_canvasH sz9VerticalScrolledFrame.__init__.._configure_canvas)r rFr)rrmrr r rrrrr rrZ xview_movetoZ yview_movetorZ create_windowrr)rQrGrkwZ vscrollbarrrrTrrUrF- s$     zVerticalScrolledFrame.__init__N)rrrrrFrTrTrTrUr& sr__main__)rz#idlelib.idle_test.test_configdialogrqF) verbosityexit)run)^rrtkinterrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrZ tkinter.ttkr r!r"r#r$r%r&r'r(r)r*r+Z tkinter.fontrrr,Zidlelib.configr-r.Zidlelib.config_keyr/Zidlelib.dynoptionr0Zidlelibr1Z idlelib.queryr2r3Zidlelib.textviewr4Zidlelib.autocompleter5Zidlelib.codecontextr6Zidlelib.parenmatchr7Zidlelib.formatr8Zidlelib.squeezerr9r:r~rr;rrhrfrirjr rOrrrrrZunittestrZidlelib.idle_test.htestr rTrTrTrUsx 4             S3'=> +