B ÄΜ}ýŽã@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,ddl-m.Z/ddl0m1Z2ddlm3Z3ddl4m5Z5m6Z6ddl7m8Z8ddl9m:Z:dd l;mZ>m?Z?dd l@mAZAdd lBmCZCdd lDmEZEddlFmGZGddlHmIZIddlJmKZKddl@mLZLe6ƒZMeCeEeGeIeKfZNGdd„deƒZOdaPGdd„de"ƒZQGdd„de"ƒZRGdd„de"ƒZSGdd„de"ƒZTGdd„dƒZUeUƒZVdZWd d!d"d#d$œZXd%d&„ZYGd'd(„d(e"ƒZZe[d)krZdd*l\m]Z]e]d+d,d-d.dd/l^m_Z_e_eOƒdS)0aèIDLE 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)ÚToplevelÚListboxÚScaleÚCanvasÚ StringVarÚ BooleanVarÚIntVarÚTRUEÚFALSEÚTOPÚBOTTOMÚRIGHTÚLEFTÚSOLIDÚGROOVEÚNONEÚBOTHÚXÚYÚWÚEÚEWÚNSÚNSEWÚNWÚ HORIZONTALÚVERTICALÚANCHORÚACTIVEÚEND) ÚFrameÚ LabelFrameÚButtonÚ CheckbuttonÚEntryÚLabelÚ OptionMenuÚNotebookÚ RadiobuttonÚ ScrollbarÚStyle)Ú messagebox)ÚidleConfÚ ConfigChanges)Ú GetKeysDialog)Ú DynOptionMenu)Úmacosx)Ú SectionNameÚ HelpSource)Ú view_text)Ú AutoComplete)Ú CodeContext)Ú ParenMatch)ÚFormatParagraph)ÚSqueezer)ÚScrollableTextFramecs¢eZdZdZd%dddœdd„Zdd„Zd d „Zd d „Zd d„Zdd„Z ‡fdd„Z dd„Z dd„Z dd„Z dd„Zdd„Zdd„Zdd „Zd!d"„Zd#d$„Z‡ZS)&Ú ConfigDialogzConfig dialog for IDLE. ÚF)Ú_htestÚ_utestcCsÚt ||¡||_|ri|_|s(| ¡|jdd| |p>d¡| ¡d}| ¡|s\dnd}|  d|›d|›¡|  ¡|j t t d|  |¡| d |j¡|jj ¡t ¡|sÖ| ¡| ¡| ¡d S) aËShow 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. é)Ú borderwidthzIDLE Preferencesééé–ú+)ÚheightÚwidthZWM_DELETE_WINDOWN)rÚ__init__ÚparentÚ instance_dictZwithdrawÚ configureÚtitleZ winfo_rootxZ winfo_rootyZgeometryÚcreate_widgetsZ resizabler Z transientZprotocolÚcancelÚfontpageÚfontlistZ focus_setÚtracersÚattachZgrab_setZ wm_deiconifyZ wait_window)ÚselfrGrJr<r=ÚxÚy©rTú9/opt/alt/python37/lib64/python3.7/idlelib/configdialog.pyrF0s*     zConfigDialog.__init__cCsÀt|ƒ|_}t|ƒ|_t||jƒ|_t|ƒ|_t|ƒ|_ |  ¡|_ |j |jdd|j |jdd|j |jdd|j |j dd|j |j dd|  ¡|jtttd| ¡jtdd S) aÇCreate and place widgets for tabbed dialog. Widgets Bound to self: 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. z Fonts/Tabs)ÚtextÚ Highlightsz Keys z General Z Extensions)ÚsideÚexpandÚfill)rXN)r'ÚnoteÚHighPageÚhighpageÚFontPagerMÚKeysPageZkeyspageÚGenPageZgenpageÚcreate_page_extensionsZextpageÚaddZenable_traversalÚpackr r rÚcreate_action_buttonsr )rQr[rTrTrUrK`s    zConfigDialog.create_widgetscCs¾t ¡ri}nddi}t|dd}t|dd}i|_xbd|jfd|jfd|jfd|jffD]:\}}t|f||t d œ|—Ž|j|<|j|j t d d qZWt|dd d j t d|j t d|S)aÑReturn 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 Úpadding)ééé)reZOkZApplyZCancelZHelp)rVÚcommandÚ takefocusr>)rXÚpadxr)rDr?)rX)r0ZisAquaTkr ZbuttonsÚokÚapplyrLÚhelpr"r rcrr r )rQZ padding_argsZouterZ buttons_frameZtxtÚcmdrTrTrUrds"    z"ConfigDialog.create_action_buttonscCs| ¡| ¡dS)zvApply config changes, then dismiss dialog. Methods: apply destroy: inherited N)rmÚdestroy)rQrTrTrUrl§szConfigDialog.okcCs$| ¡t ¡| ¡| ¡dS)z¸Apply config changes and leave dialog open. Methods: deactivate_current_config save_all_changed_extensions activate_config_changes N)Údeactivate_current_configÚchangesÚsave_allÚsave_all_changed_extensionsÚactivate_config_changes)rQrTrTrUrm±szConfigDialog.applycCst ¡| ¡dS)zPDismiss config dialog. Methods: destroy: inherited N)rrÚclearrp)rQrTrTrUrL¾szConfigDialog.cancelcs&|jj dd¡a| ¡tƒ ¡dS)Nz1.0Úend)rMÚ font_sampleÚgetÚfont_sample_textZ grab_releaseÚsuperrp)rQ)Ú __class__rTrUrpÇszConfigDialog.destroycCs8|jj|j ¡dd ¡}t|dtt |d¡ddS)z¤Create textview for config dialog help. Attributes accessed: note Methods: view_text: Method from textview module. rV)ZoptionzHelp for IDLE preferencesr;)rJÚcontentsN)r[ZtabZselectÚstripr3Ú help_commonÚ help_pagesry)rQZpagerTrTrUrnÍszConfigDialog.helpcCs&|jj ¡}x|D] }| ¡qWdS)zRemove current key bindings. Iterate over window instances defined in parent and remove the keybindings. N)rGrHÚkeysZRemoveKeybindings)rQÚ win_instancesÚinstancerTrTrUrqÙs  z&ConfigDialog.deactivate_current_configcCsd|jj ¡}x<|D]4}| ¡| ¡| ¡| ¡| ¡| ¡qWxt D] }|  ¡qPWdS)z¨Apply 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Ú reloadablesÚreload)rQr‚rƒÚklassrTrTrUruäs    z$ConfigDialog.activate_config_changescCsh|j}t|jƒ}tjd|_tjd|_| t ¡|_ |  ¡t |ƒ|_ |j ddd|jdddt||j dd|_|j d|j¡t||jjd }|j|j_t|d d d |_|jjddd d |jdddd |jjdddddgd|jddi|_d|_||_|j|_d}x.t|j ƒD] }| !|¡|d|d}qW|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(). Ú extensionsré)ÚweightrhZbrowse)Z listvariableZ selectmodez<>)riéú)rErDZnws)ÚcolumnÚrowÚstickyÚnsÚnsewé )r‹rŒrrk)reNr;Ú{z} )#rGr r[r,Ú defaultCfgÚext_defaultCfgÚuserCfgÚ ext_userCfgÚregisterÚis_intÚload_extensionsrZextension_namesÚ rowconfigureÚcolumnconfigurerÚextension_listÚbindÚextension_selectedr)ÚyviewÚsetÚyscrollcommandr!Ú details_frameÚgridrIÚ config_frameÚcurrent_extensionZ outerframeZtabbed_page_setÚsortedr‡Úcreate_extension_frameZ selection_set)rQrGÚframeZscrollZ ext_namesÚext_namerTrTrUraõs>            z#ConfigDialog.create_page_extensionsc Cs^i|_xtjddD]}g|j|<qWx0|jD]$}t|j |¡ƒ}dd„|Dƒ}x|D]}| |¡qZW||}xà|D]Ø}|jj||dd}ydddœ|}d}WnBtk rèyt |ƒ}d }Wnt k râ|}d }YnXYnXy|j j|||d|d }Wnt k r|}YnXt |ƒ} |   t|ƒ¡|j| ||||| d œ¡qzWq0Wd S) zAFill self.extensions with data from the default and user configs.F)Z active_onlycSsg|]}| d¡r|‘qS)Zenable)Ú startswith)Ú.0Úopt_namerTrTrUú >sz0ConfigDialog.load_extensions..T)Úraw)ÚTrueÚFalseÚboolÚintN)Útyper­Údefault)Únamer²r³ÚvalueÚvar)r‡r,Z GetExtensionsr¥r“Z GetOptionListÚremoveÚGetÚKeyErrorr±Ú ValueErrorr•rrŸÚstrÚappend) rQr¨Zopt_listZenablesr«Zdef_strZdef_objZopt_typerµr¶rTrTrUr˜3sF      zConfigDialog.load_extensionscCsˆ|j ¡}|r|j |¡}|dks,||jkrV|jrV|jjdd|j|j ¡d|_|r„|jj|d|j|jdddd||_dS)z/Handle selection of an extension from the list.Nr;)rVrr)r‹rŒr) r›Ú curselectionryr¤r¡Úconfigr£Z grid_forgetr¢)rQÚeventZnewselrTrTrUras  zConfigDialog.extension_selectedcCsæt|jddd}||j|<|j}xÀt|j|ƒD]®\}}t||dd}|j|dtd|d}|dd krŽt ||d d d d j|dt ddq0|ddkrÂt ||d|j dfddj|dt ddq0t ||ddj|dt ddq0WdS)z=Create a frame holding the widgets to configure one extensionrŠ)rDrEr´)rVr)rŒr‹rr¶r²r°r®r¯é)ÚvariableÚonvalueÚoffvaluerErˆé)rŒr‹rrkr±Úkeyz%Pr)Ú textvariableÚvalidateÚvalidatecommandrEé)rÆrEN)ÚVerticalScrolledFramer¡r£ÚinteriorÚ enumerater‡r%r¢rr#rr$r—r)rQr¨ÚfZ entry_arearŒÚoptZlabelr¶rTrTrUr¦ps$    z#ConfigDialog.create_extension_framecCsX|d}|d}|d ¡ ¡p"|}|d |¡||krH|j ||¡S|j |||¡S)zŸReturn True if the configuration was added or changed. If the value is the same as the default, then remove it from user config file. r´r³r¶)ryr~rŸr•Z RemoveOptionÚ SetOption)rQZsectionrÎr´r³rµrTrTrUÚset_extension_valueŠsz ConfigDialog.set_extension_valuecCsNd}x6|jD],}|j|}x|D]}| ||¡r d}q Wq W|rJ|j ¡dS)z£Save configuration changes to the user config file. Attributes accessed: extensions Methods: set_extension_value FTN)r‡rÐr•ZSave)rQZ has_changesr¨ZoptionsrÎrTrTrUrt›s      z(ConfigDialog.save_all_changed_extensions)r;)Ú__name__Ú __module__Ú __qualname__Ú__doc__rFrKrdrlrmrLrprnrqrurar˜rr¦rÐrtÚ __classcell__rTrT)r|rUr:,s"0(     >.r:u^ AaBbCcDdEeFfGgHhIiJj 1234567890#:+=(){}[] ¢£¥§©«®¶½ĞÀÃÂÃÄÅÇÃØß ÉɕɘɞɟɤɫɮɰɷɻÊʃʆʎʞʢʫʭʯ ΑαΒβΓγΔδΕεΖζΗηΘθΙιΚκ БбДдЖжПпФфЧчЪъЭÑѠѤѬӜ ×בגדהוזחטיךכל×מןנסעף ابجدهوزحطي٠١٢٣٤٥٦٧٨٩ ०१२३४५६७८९अआइईउऊà¤à¤à¤“औ ௦௧௨௩௪௫௬௭௮௯அஇஉஎ ã€‡ä¸€äºŒä¸‰å››äº”å…­ä¸ƒå…«ä¹ æ±‰å­—æ¼¢å­—äººæœ¨ç«åœŸé‡‘æ°´ ê°€ëƒë”려모뵤수유즈치 ã‚ã„ã†ãˆãŠã‚¢ã‚¤ã‚¦ã‚¨ã‚ª csVeZdZ‡fdd„Zdd„Zdd„Zdd„Zd d „Zdd d „Zdd„Z dd„Z ‡Z S)r^cs0tƒ |¡|j|_| ¡| ¡| ¡dS)N)r{rFÚhighlight_sampleÚcreate_page_font_tabÚ load_font_cfgÚ load_tab_cfg)rQÚmasterr])r|rTrUrFÞs  zFontPage.__init__c Csœt t|ƒ|j¡|_t t|ƒ|j¡|_t t|ƒ|j¡|_t t|ƒd¡|_ t |dt dd}t |dt dd}t |dt dd}t |ƒ}t |ƒ}t |tdd}t|d d td |_|j d |j¡|j d |j¡|j d|j¡t|ƒ}|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)-açReturn 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 )ÚmainÚIndentz num-spacesrhz Shell/Editor Font )r?ÚreliefrVz Font Sample (Editable) z Indentation Width z Font Face :)ZjustifyrVrÉT)rDrjÚexportselectionzzz)ri)r zSize :)rVNrˆrZBold)rÁrÂrÃrV)ÚwraprErDzPython Standard: 4 Spaces!Z horizontalé)rÁÚorientZ tickintervalZfrom_Úto)r‰r>)rŒr‹rkÚpadyrgr)rŒr‹ZrowspanrkrãrZew)rŒr‹rkrãr)rXrkrãrZ)rXÚanchor)rXrYrZ)rXrZr@)rXrärk)rYrZ)rXrkrZ)/rOrbrÚvar_changed_fontÚ font_nameÚ font_sizerÚ font_boldrÚ space_numr!rr r%rrr rNrœÚon_fontlist_selectr)r¾ržrŸr/Úsizelistr#Z bold_toggler9rVrxrÚinsertrrzrZ indent_scaleršr™r¢rcr rrr rr) rQZ frame_fontZ frame_sampleZ frame_indentZframe_font_nameZframe_font_paramZfont_name_titleZ scroll_fontZfont_size_titleZfont_sample_frameZ indent_titlerTrTrUr×åsn.   zFontPage.create_page_font_tabc Csðt |dd¡}|d ¡}|d}|ddk}ttt |¡ƒƒ}x|D]}|j t |¡qFW|j  |¡dd„|Dƒ}y>|  |¡}|j  |¡|j  |¡|j |¡|j |¡Wntk rÈYnX|j d |¡|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ÛÚ EditorWindowrrˆrhZboldcSsg|] }| ¡‘qSrT)Úlower)rªÚsrTrTrUr¬fsz*FontPage.load_font_cfg..)Ú7Ú8Ú9Ú10Ú11Ú12Ú13Ú14Ú16Z18Z20Z22Z25Z29Z34Z40N)r,ZGetFontrîr¥rŸÚtkFontZfamiliesrNrìrræÚindexÚseeÚ select_setÚ select_anchorZactivaterºrëÚSetMenurèÚ set_samples) rQZconfigured_fontrærçrèZfontsÚfontZlc_fontsZcurrent_font_indexrTrTrUrØUs*         zFontPage.load_font_cfgcGsZ|j ¡}t ddd|¡|j ¡}t ddd|¡|j ¡}t ddd|¡| ¡dS)zùStore 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. rÛrírz font-sizez font-boldN)ræryrrÚ add_optionrçrèrÿ)rQÚparamsrµrTrTrUråws   zFontPage.var_changed_fontcCs0|j |jjdkrtnt¡}|j | ¡¡dS)z­Handle 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) rNryr²r´rrrærŸrî)rQr¿rrTrTrUrê†szFontPage.on_fontlist_selectNcCsH|j ¡}|j ¡rtjntj}||j ¡|f}||jd<||jd<dS)zýUpdate 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) ræryrèrùZBOLDZNORMALrçrxrÖ)rQr¿ræZ font_weightZnew_fontrTrTrUrÿs   zFontPage.set_samplescCs$tjdddddd}|j |¡dS)z‘Load current configuration settings for the tab options. Attributes updated: space_num: Set to value from idleConf. rÛrÜz num-spacesér±)r³r²N)r,Ú GetOptionrérŸ)rQrérTrTrUrÙszFontPage.load_tab_cfgcGs|j ¡}t ddd|¡dS)z!Store change to indentation size.rÛrÜz num-spacesN)réryrrr)rQrrµrTrTrUÚvar_changed_space_num¨s zFontPage.var_changed_space_num)N) rÑrÒrÓrFr×rØrårêrÿrÙrrÕrTrT)r|rUr^Üs p"  r^cs¼eZdZ‡fdd„Zdd„Zdd„Zdd„Zd d „Zd d „Zd d„Z dd„Z dd„Z dd„Z dd„Z dd„Zdd„Zdd„Zdd„Zdd „Zd!d"„Zd#d$„Zd%d&„Zd'd(„Zd)d*„Z‡ZS)+r\cs2tƒ |¡|j|_t|ƒ|_| ¡| ¡dS)N)r{rFrÚÚcdr*ÚstyleÚcreate_page_highlightÚload_theme_cfg)rQrÚ)r|rTrUrF°s   zHighPage.__init__cs2ddddddddd d d d d ddddœˆ_t tˆƒˆj¡ˆ_t tˆƒˆj¡ˆ_tˆƒˆ_ t tˆƒˆj ¡ˆ_ t tˆƒˆj ¡ˆ_ t tˆƒˆj¡ˆ_tˆdtdd}tˆdtdd}t|tdd}|j}ˆ_|jddddtdtd| ddd„¡| dd d„¡d!}x |D]\}}| t||¡qWt| d"t¡ ¡ƒ}x>td|ƒD]0} | | ›d#| tt |ƒƒ›d$›d%d&¡qNWx8ˆjD].} | f‡fd'd(„ } | !ˆj| dd)| ¡qŠWd*|d+<ˆj"jd,dd-d.t#|d,d/ˆ_$t#|ƒ} t%ˆj$d0ˆj&d1ˆ_'t(ˆj$ˆjd2dd3ˆ_)t*| ˆj dd4ˆj+d5ˆ_,t*| ˆj dd6ˆj+d5ˆ_-ˆj  .d¡t%|d7ˆj/d1ˆ_0t1|d8d9} t*|ˆj dˆj2d:d;ˆ_3t*|ˆj dˆj2dˆj7d1ˆ_8t1|dd?ˆ_9|j:t;d@d@td@d@t?dBˆj$j:t>d@d@t?dB| j:t>d@ddC|j:t>d@d@ttttBd@d@dJˆj3j:t>tBd@dKˆj4j:t>tBd@ddJˆj5j:t>t?d@d@dIˆj6j:t>t?tBd@d@dLˆj8j:t>t?d@d@dIˆj9j:t>t?d@dMd2S)NaíReturn 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 TextÚCursorzEditor Breakpointz Shell Promptz Error TextzShell User OutputzShell User Exceptionz Line Numberrhz Custom Highlighting )r?rÝrVz Highlighting Theme rˆ)rÝr?)Zcourieré r;Zhand2r)rrrErDrjÚhighlightthicknessrßzcSsdS)NrrT)ÚerTrTrUÚXóz0HighPage.create_page_highlight..z cSsdS)NrrT)rrTrTrUrYr)")z# Click selects item.r)Ú r )zcode context sectionr )r r )z| cursorr)r r )Údefr )ú r )Úfuncr )z (param): r )z"Return None."r)z var0 = r )z'string'r)z var1 = r )z 'selected'r)z var2 = r )z'found'r)z var3 = r )Úlistr)ú(r )ÚNoner )z) r )z breakpoint("line")r)z r )z>>>r)z 3.14**2 r )z9.8596r)r r )z>>>r)z pri r )Únr)zt( r )Ú SyntaxErrorr)r r z1.0z.0Údr"rcsˆj |¡dS)N)Úhighlight_targetrŸ)r¿Úelem)rQrTrUÚtemtsz+HighPage.create_page_highlight..temzÚdisabledÚstatezframe_color_set.TFrameZsolid)r?rÝ)rzChoose Color for :)rVriN)rZ Foreground)rÁrµrVriZ BackgroundzSave as New Custom Themez Select : )rVza Built-in Theme)rÁrµrirVza Custom Theme)rizDelete Custom Theme)r?r>)rXrkrãrYrZ)rXrkrãrZ)rXrkrãrÀr)rXrYrZrkrãrg)rXrä)rXrZrkrã)rXrärkrã)rXrärk)rXrZrärkrã)rXrZrã)DÚtheme_elementsrOrbrÚvar_changed_builtin_nameÚ builtin_nameÚvar_changed_custom_nameÚ custom_namerÚ fg_bg_toggleÚvar_changed_colorÚcolorÚvar_changed_theme_sourceÚ theme_sourceÚvar_changed_highlight_targetr*r!rr9rrVrÖrIr rrœrìrÚlenryÚ splitlinesÚranger»Ztag_bindrr Úframe_color_setr"Ú get_colorZbutton_set_colorr/Ú targetlistr(Úset_color_sample_bindingÚfg_onÚbg_onrŸÚsave_as_new_themeZbutton_save_customr%Úset_theme_typeZbuiltin_theme_onÚcustom_theme_onÚ builtinlistÚ customlistÚ delete_customÚbutton_delete_customÚ theme_messagercrr rr rrr rr )rQÚ frame_customZ frame_themeZ sample_framerVZ string_tagsrÚtagZn_linesÚlinenoÚelementr,Zframe_fg_bg_toggleZtheme_type_titlerT)rQrUr·sÒv                zHighPage.create_page_highlightc s.ˆj tjdddddd¡t ¡}ˆj ¡r–t dd¡}| ¡ˆj  ||¡t dd¡}| ¡|s‚ˆj   d ¡ˆj  d ¡qÞˆj   ||d ¡nHt dd¡}| ¡ˆj   ||¡t dd¡}| ¡ˆj  ||d ¡ˆ ¡tˆj ¡ƒ}|j‡fd d „dˆj  ||d ¡ˆ ¡ˆ ¡dS)aêLoad 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 rÛÚThemer³r°rˆ)r²r³Ú highlightÚuser)r-z- no custom themes -rcsˆj|dS)Nrˆ)r/)rR)rQrTrUrärz)HighPage.load_theme_cfg..)rÅN)r8rŸr,rZ CurrentThemeryÚGetSectionListÚsortrFrþrEr.r3rGrDr$r/rr?Úpaint_theme_sampleÚset_highlight_target)rQÚcurrent_optionÚ item_listZ theme_namesrT)rQrUr µs2       zHighPage.load_theme_cfgcGsŽd}|j ¡}||krXt ddd¡|kr8s      zHighPage.get_colorcCs~|j ¡}|jjd|d|j ¡r(dnd}|j|j ¡d}|jj|f||iŽ|j  ¡}|d|}t   d|||¡dS) z4Display sample of new color selection on the dialog.zframe_color_set.TFrame)rZÚ foregroundrZrú-rPN) r6ryrrIr4r/r*rÖÚ tag_configr3rrr)rQZ new_colorÚplaneZsample_elementÚthemeZ theme_elementrTrTrUrY^s   zHighPage.on_new_color_setcCs,t dd¡t dd¡}t|d||ƒj}|S)z*Return name of new theme from query popup.rQrPr³zNew Custom Theme)r,rRr1Úresult)rQr`Ú used_namesrarTrTrUr]is  zHighPage.get_new_theme_namecCs| d¡}|r| |¡dS)z€Prompt for new theme name and create the theme. Methods: get_new_theme_name create_new zNew Theme Name:N)r]r^)rQÚnew_theme_namerTrTrUrCqs zHighPage.save_as_new_themecCs¬|j ¡rd}|j ¡}nd}|j ¡}t ||¡}|tdkrftd|}x|D]}||||<qRW| ||¡t dd¡}|  ¡|j   ||¡|j  d¡|  ¡dS)a¹Create a new custom theme with the given name. Create the new theme based on the previously active theme with the current changes applied. Once it is saved, then activate the new theme. Attributes accessed: builtin_name custom_name Attributes updated: customlist theme_source Method: save_new set_theme_type r³rQrPrN)r8ryr1r3r,Z GetThemeDictrrÚsave_newrRrSrGrþrŸrD)rQriZ theme_typeÚ theme_nameraZ theme_changesrNZcustom_theme_listrTrTrUr^|s           zHighPage.create_newcCsd|j ¡dkr4|j d¡|j d¡|j d¡n$|j d¡|j d¡|j d¡| ¡dS)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 r)r-rˆ)z !disabledN)r*ryrAr.rBr4rŸÚset_color_sample)rQrTrTrUrU¤s     zHighPage.set_highlight_targetcGs | ¡dS)zrChange color sample based on foreground/background toggle. Methods: set_color_sample N)rl)rQÚargsrTrTrUr@Àsz!HighPage.set_color_sample_bindingcCsH|j|j ¡d}|j ¡r"dnd}|j ||¡}|jjd|ddS)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 rrbrZzframe_color_set.TFrame)rZN)r/r*ryr4rÖZtag_cgetrrI)rQrLrer6rTrTrUrlÈs zHighPage.set_color_samplecCsÒ|j ¡r|j ¡}n |j ¡}x¤|jD]š}|j|d}t ||¡}|dkrbt |d¡d|d<|tdkr²td|}|d|kr–||d|d<|d|kr²||d|d<|jj |f|Žq(W|  ¡d S) aÚApply 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 rrr rZrPz -foregroundrbz -backgroundN) r8ryr1r3r/r,Z GetHighlightrrrÖrdrl)rQrfZ element_titlerNZcolorsZ theme_dictrTrTrUrTÚs"         zHighPage.paint_theme_samplecCs>tjd |¡x(|D] }||}tjd |||¡qWdS)zœSave a newly created theme to idleConf. theme_name - string, the name of the new theme theme - dictionary containing the new theme rPN)r,r”Ú AddSectionrÏ)rQrkrfrNrµrTrTrUrjs zHighPage.save_newcOs tj||ŽS)N)r+Úaskyesno)rQrmÚkwargsrTrTrUro szHighPage.askyesnocCsÞ|j ¡}d}|jd|||ds&dS|j ¡t d|¡t dd¡}|  ¡|sp|j   d¡|j   |d¡n|j   ||d ¡|j tjd  d d ¡¡|j tjd  d d ¡¡t ¡|j ¡|j ¡| ¡dS)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 Theme)rGNrPrQ)r-z- no custom themes -rrÛrOr³r´)r3ryrorrqrrÚdelete_sectionr,rRrSrEr.rGrþr8rŸr’r¸r1rsrtrurD)rQrkÚdelmsgrWrTrTrUrHs&       zHighPage.delete_custom)rÑrÒrÓrFrr r0r2r7r5r9rDr>rYr]rCr^rUr@rlrTrjrorHrÕrTrT)r|rUr\®s. 4  &  (( r\cs eZdZ‡fdd„Zdd„Zdd„Zdd„Zd d „Zd d „Zd d„Z dd„Z dd„Z dd„Z dd„Z dd„Zdd„Zdd„Zedd„ƒZdd „Zd!d"„Z‡ZS)#r_cs(tƒ |¡|j|_| ¡| ¡dS)N)r{rFrÚrÚcreate_page_keysÚ load_key_cfg)rQrÚ)r|rTrUrFCs zKeysPage.__init__cs"t t|ƒ|j¡|_t t|ƒ|j¡|_t t|ƒ|j¡|_ t t|ƒ|j ¡|_ t |dt dd}t |dt dd‰t|ƒ}t|dd}t|ƒ}t|td}t|ttd|_|j d |j¡|jj|d <|jj|d <|j|jd <|j|jd <t|d |jdd|_‡fdd„tdƒDƒ}t|d|j d|jdd|_ t|d|j d|jdd|_!t"|d|jddd|_#t"|d|jddd|_$t|dd|j%d|_&t|dd|j'd|_(t|ddd|_)|j*t+ddt,t-dˆj*t+ddt-d|jj*t+t.ddd |j*t/ddt,t-d|j0ddd!|j1ddd!|j2dddt3d"|jj2ddt4d#|j2ddt5d#|j2ddt6d#|j j2ddt3t5d#|j!j2ddt3t5d#|j#j2ddt4d#|j$j2ddt4d#|j)j2ddt4ddd$|j&j*t/t.d%dd&|j(j*t/t.d%dd&|dj*t7t-d%d'|dj*t7t.d%dd(dS))aíReturn 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 rhz Custom Key Bindings )r?rÝrVz Key Set zAction - Key(s))rV)rá)rjrÞzrir ZxscrollcommandzGet New Keys for Selectionr-)rVrir.csg|]}tˆddd‘qS)rhr)rer?)r )rªÚi)Úframe_key_setsrTrUr¬¼sz-KeysPage.create_page_keys..rrˆzUse a Built-in Key Set)rÁrµrirVzUse a Custom Key SetN)rizDelete Custom Key Set)rVrizSave as New Custom Key Set)r?r>)rXrkrãrYrZ)rXrkrãrZ)rXrZrkrã)r‰)rŒr‹Z columnspanr)rŒr‹r)rŒr‹rrkrãT)rXrZrYrk)rXrZrY)rXrZrYrã)8rOrbrr0r1r2r3rÚvar_changed_keyset_sourceÚ keyset_sourceÚvar_changed_keybindingÚ keybindingr!rr r%r)rrr Ú bindingslistrœÚon_bindingslist_selectržZxviewrŸr"Ú get_new_keysÚbutton_new_keysr<r(Ú set_keys_typeZbuiltin_keyset_onÚcustom_keyset_onr/rFrGÚdelete_custom_keysÚbutton_delete_custom_keysÚsave_as_new_key_setZbutton_save_custom_keysÚ keys_messagercr r rrrršr™r¢rrrrr )rQrKZ frame_targetZ target_titleZscroll_target_yZscroll_target_xZframesrT)rvrUrsIs„R            zKeysPage.create_page_keysc Csü|j tjdddddd¡t ¡}|j ¡r–t dd¡}| ¡|j  ||¡t dd¡}| ¡|s‚|j   d ¡|j  d ¡qÞ|j   ||d ¡nHt dd¡}| ¡|j   ||¡t dd¡}| ¡|j  |t ¡¡| ¡t ¡}| |¡d S) z?Load current configuration settings for the keybinding options.rÛÚKeysr³r°rˆ)r²r³rrQ)r-z- no custom keys -rN)rxrŸr,rZ CurrentKeysryrRrSrFrþr€r.r3rGÚ default_keysrÚload_keys_list)rQrVrWÚ keyset_namerTrTrUrtés,       zKeysPage.load_key_cfgcGsd}|j ¡}||krXt ddd¡|krtjd |¡x(|D] }||}tjd |||¡qWdS)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 rN)r,r”rnrÏ)rˆr—r¿rµrTrTrUr–ºs  zKeysPage.save_new_key_setcOs tj||ŽS)N)r+ro)rQrmrprTrTrUroÊszKeysPage.askyesnocCsæ|j ¡}d}|jd|||ds&dS|j ¡t d|¡t dd¡}|  ¡|sp|j   d¡|j   |d¡n|j   ||d ¡|j tjd  d d ¡¡|j tjd  d d ¡pºt ¡¡t ¡|j ¡|j ¡| ¡dS)záHandle 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 Set)rGNrrQ)r-z- no custom keys -rrÛr…r³r´)r3ryrorrqrrrqr,rRrSr€r.rGrþrxrŸr’r¸r1r†rsrtrur)rQrˆrrrWrTrTrUrÎs*         zKeysPage.delete_custom_keys)rÑrÒrÓrFrsrtr0r2rwryrr}r‹rƒr|rŒr‡Ú staticmethodr–rorrÕrTrT)r|rUr_As$ !   , r_csdeZdZ‡fdd„Zdd„Zdd„Zdd„Zd d „Zd d „Zd d„Z dd„Z dd„Z dd„Z ‡Z S)r`cs(tƒ |¡| ¡| ¡| ¡dS)N)r{rFÚinit_validatorsÚcreate_page_generalÚload_general_cfg)rQrÚ)r|rTrUrFós zGenPage.__init__cs*t d¡‰‡fdd„}| |¡df|_dS)Nz[0-9]*csˆ |¡dk S)z+Return 's is blank or contains only digits'N)Ú fullmatch)rï)Údigits_or_empty_rerTrUÚis_digits_or_emptyüsz3GenPage.init_validators..is_digits_or_emptyz%P)ÚreÚcompiler–Ú digits_only)rQržrT)rrUr™ús  zGenPage.init_validatorsc Cs´t t|ƒd¡|_t t|ƒd¡|_t t|ƒd¡|_t t|ƒd¡|_t t|ƒd¡|_ t t|ƒd¡|_ t t|ƒd¡|_ t t|ƒd¡|_ t t|ƒd ¡|_ t t|ƒd ¡|_t t|ƒd ¡|_t t|ƒd ¡|_t t|ƒ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<|j1¡t2|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;tT)rDrjrÞrir zZEditr-rÀ)rVr.rEriZAdd)rVrEriZRemove)rXrkrãrYrZ)rXrkrãrZ)rXrärkrãr)rXrärã)rXrkrã)rXrärkrÉ)rXrärZ)rXrärYrZ)rXräN)CrOrbrÚ startup_editrÚ win_widthÚ win_heightrÚ cursor_blinkÚautocomplete_waitÚ paren_styleÚ flash_delayÚ paren_bellÚauto_squeeze_min_linesr¦Ú format_widthÚline_numbers_defaultÚ context_linesr!rr r%r(Zstartup_editor_onZstartup_shell_onr$r¡Z win_width_intZwin_height_intr#Zcursor_blink_boolZ auto_wait_intr&Zparen_style_typeZparen_flash_timeZbell_onZ save_ask_onZ save_auto_onZformat_width_intZline_numbers_default_boolZ context_intZauto_squeeze_min_lines_intrr Úhelplistr)ržrŸrœÚhelp_source_selectedr"Úhelplist_item_editÚbutton_helplist_editÚhelplist_item_addZbutton_helplist_addÚhelplist_item_removeÚbutton_helplist_removercr r rrrrr rr) rQZ frame_windowZ frame_editorZ frame_shellZ frame_helpZ frame_runZ startup_titleZframe_win_sizeZwin_size_titleZwin_width_titleZwin_height_titleZframe_cursor_blinkZcursor_blink_titleZframe_autocompleteZauto_wait_titleZ frame_paren1Zparen_style_titleZ frame_paren2Zparen_time_titleZ frame_saveZrun_save_titleZ frame_formatZformat_width_titleZframe_line_numbers_defaultZline_numbers_default_titleZ frame_contextZ context_titleZframe_auto_squeeze_min_linesZauto_squeeze_min_lines_titleZframe_helplistZframe_helplist_buttonsZscroll_helplistrTrTrUršsdH                               zGenPage.create_page_generalc Cs”|j tjddddd¡|j tjddddd¡|j tjddd dd¡|j tjddd dd¡|j tjd d d dd¡|j t d dd¡¡|j  tjd dddd¡|j  t d dd¡¡|j  tjdddddd¡|j  tjd dddd¡|j  tjddddd¡|j tjd dddd¡|j tjddddd¡t ¡|_|j dd¡x"|jD]}|j t|d¡qlW| ¡dS)z                 zGenPage.load_general_cfgcCs | ¡dS)z+Handle event for selecting additional help.N)r½)rQr¿rTrTrUr¶PszGenPage.help_source_selectedcCsh|j ¡dkr(|j d¡|j d¡n<|j ¡rL|j d¡|j d¡n|j d¡|j d¡dS)zAToggle the state for the help list buttons based on list entries.rˆ)r-)z !disabledN)rµÚsizer¸r.r»r½)rQrTrTrUr½Ts    zGenPage.set_add_delete_statecCs:t|dƒj}|r6|j |¡|j t|d¡| ¡dS)zˆHandle add button for the help list. Query for name and location of new help sources and add them to the list. zNew Help SourcerN)r2rgr¼r¼rµrìrÚupdate_help_changes)rQÚ help_sourcerTrTrUr¹as   zGenPage.helplist_item_addcCsx|j t¡}|j|}t|d|d|ddj}|rt||krt||j|<|j |¡|j ||d¡| ¡|  ¡dS)z˜Handle edit button for the help list. Query with existing help source information and update config if the values are changed. zEdit Help Sourcerrˆ)ZmenuitemÚfilepathN) rµrúrr¼r2rgrrìr¿r½)rQÚ item_indexrÀZnew_help_sourcerTrTrUr·ms     zGenPage.helplist_item_editcCs4|j t¡}|j|=|j |¡| ¡| ¡dS)z`Handle remove button for the help list. Delete the help list item from config. N)rµrúrr¼rr¿r½)rQrÂrTrTrUrºs   zGenPage.helplist_item_removec CsZitdd<xHtdt|jƒdƒD]0}t ddt|ƒd |j|ddd…¡¡q"WdS)z2Clear and rebuild the HelpFiles section in changesrÛZ HelpFilesrˆú;Nrh)rrr<r:r¼rr»r•)rQZnumrTrTrUr¿Œs   zGenPage.update_help_changes)rÑrÒrÓrFr™ršr›r¶r½r¹r·rºr¿rÕrTrT)r|rUr`ñs ()   r`c@sDeZdZdZdd„Zdd„Zdd„Zedd „ƒZd d „Z d d „Z dS)ÚVarTracez"Maintain Tk variables trace state.cCsg|_g|_dS)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)ÚuntracedÚtraced)rQrTrTrUrF˜s zVarTrace.__init__cCs|j ¡|j ¡dS)zClear lists (for tests).N)rÅrvrÆ)rQrTrTrUrv¤s zVarTrace.clearcCs*t|tƒr| ||¡}|j ||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. )Ú isinstanceÚtupleÚ make_callbackrÅr¼)rQr¶ÚcallbackrTrTrUrbªs  z VarTrace.addcs‡‡fdd„}|S)zCReturn default callback function to add values to changes instance.cstjˆˆ ¡fžŽdS)z&Add config values to changes instance.N)rrrry)r)r¾r¶rTrUÚdefault_callback¾sz0VarTrace.make_callback..default_callbackrT)r¶r¾rËrT)r¾r¶rUrÉ»szVarTrace.make_callbackcCs:x4|jr4|j ¡\}}| d|¡|j ||f¡qWdS)z0Attach callback to all vars that are not traced.ÚwriteN)rÅÚpopZ trace_addrÆr¼)rQr¶rÊrTrTrUrPÃs zVarTrace.attachcCsFx@|jr@|j ¡\}}| d| ¡dd¡|j ||f¡qWdS)z!Remove callback from traced vars.rÌrrˆN)rÆrÍZ trace_removeZ trace_inforÅr¼)rQr¶rÊrTrTrUÚdetachÊszVarTrace.detachN) rÑrÒrÓrÔrFrvrbr˜rÉrPrÎrTrTrTrUrÄ•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". )z Fonts/TabsrWr…r¢cCs.|sdSy t|ƒdStk r(dSXdS)z(Return 's is blank or represents an int'TFN)r±rº)rïrTrTrUr— sr—c@seZdZdZdd„ZdS)rÊzÞA 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 csÐtj||f|ž|Žt|td}|jtttdt|dd|j dd‰ˆjt t t d|j ˆjdˆ d¡ˆ d¡tˆƒ|_‰ˆjddˆtd‰‡‡fd d „}ˆ d |¡‡‡‡fd d „}ˆ d |¡dS)N)rá)rZrXrYréð)r?rr rE)rXrZrY)ri)Zwindowräcs$ˆ ¡ˆ ¡f}ˆjd|ddS)Nz 0 0 %s %s)Z scrollregion)Úwinfo_reqwidthZwinfo_reqheightr¾)r¿r¾)ÚcanvasrËrTrUÚ_configure_interior8 sz;VerticalScrolledFrame.__init__.._configure_interiorz cs&ˆ ¡ˆ ¡kr"ˆjˆˆ ¡ddS)N)rE)rÐZ winfo_widthZ itemconfigure)r¿)rÑrËÚ interior_idrTrUÚ_configure_canvas> sz9VerticalScrolledFrame.__init__.._configure_canvas)r rFr)rrcrr r rrŸrrr r¾ržZ xview_movetoZ yview_movetorËZ create_windowrrœ)rQrGrmÚkwZ vscrollbarrÒrÔrT)rÑrËrÓrUrF# s       zVerticalScrolledFrame.__init__N)rÑrÒrÓrÔrFrTrTrTrUrÊ srÊÚ__main__)rÛz#idlelib.idle_test.test_configdialogrhF)Ú verbosityÚexit)Úrun)`rÔrŸZtkinterrrrrrrrr r r r r rrrrrrrrrrrrrrrrrrZ tkinter.ttkr r!r"r#r$r%r&r'r(r)r*Ztkinter.colorchooserZ colorchooserr\Z tkinter.fontrrùr+Zidlelib.configr,r-Zidlelib.config_keyr.Zidlelib.dynoptionr/Zidlelibr0Z idlelib.queryr1r2Zidlelib.textviewr3Zidlelib.autocompleter4Zidlelib.codecontextr5Zidlelib.parenmatchr6Zidlelib.formatr7Zidlelib.squeezerr8r9rrr„r:rzr^r\r_r`rÄrOrr€r—rÊrÑZunittestrÛZidlelib.idle_test.htestrÙrTrTrTrUÚ sp€4             S3'= +