Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/idlelib/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/idlelib/__pycache__/configdialog.cpython-312.pyc

�

%Μg^�����dZddlZddlmZmZmZmZmZmZm	Z	m
Z
mZm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;m<Z<ddl=m>Z>m?Z?ddl@mAZAdd
lBmCZCddlDmEZEddlFmGZGddlHmIZIddlJmKZKddl@mLZLe6�ZMeCeEeGeIeKfZNGd�de�ZOdaPGd�de"�ZQGd�de"�ZRGd�de"�ZSGd�de"�ZTGd�de"�ZUGd �d!e"�ZVGd"�d#e#�ZWGd$�d%�ZXeX�ZYd&ZZd'd(d)d*d+d,�Z[d-�Z\Gd.�d/e"�Z]e^d0k(r dd1l_m`Z`e`d2d3d4�5�dd6lambZbebeO�yy)7a�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�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�TclError)
�Frame�
LabelFrame�Button�Checkbutton�Entry�Label�
OptionMenu�Notebook�Radiobutton�	Scrollbar�Style�Spinbox�Combobox)�colorchooser)�
messagebox)�idleConf�
ConfigChanges)�
GetKeysWindow)�
DynOptionMenu)�macosx)�SectionName�
HelpSource)�	view_text)�AutoComplete)�CodeContext)�
ParenMatch)�FormatParagraph)�Squeezer)�ScrollableTextFramec�b��eZdZdZdddd�d�Zd�Zd�Zd�Zd�Zd	�Z	�fd
�Z
d�Zd�Zd
�Z
�xZS)�ConfigDialogzConfig dialog for IDLE.
    F)�_htest�_utestc��tj||�||_|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)	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.
        zIDLE Preferences����+��height�width�WM_DELETE_WINDOWN)r�__init__�parent�
instance_dict�withdraw�title�winfo_rootx�winfo_rooty�geometry�create_widgets�	resizabler
�	transient�protocol�cancel�fontpage�fontlist�	focus_set�tracers�attach�grab_set�wm_deiconify�wait_window)�selfrLrOr@rA�x�ys       �1/usr/local/lib/python3.12/idlelib/configdialog.pyrKzConfigDialog.__init__1s��	���$��'�����#%�F� ���M�M�O��
�
�5�.�.�/���� �2�%����� �f�B�#�>���
�
��!��A�a�S�k�"�	
�������e�5��1����v���
�
�(�$�+�+�6��
�
���(�(�*�	������M�M�O����������c��t|d��x|_}|jjd��t|�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.
        ���padding�nwes)�stickyz Fonts ��text�
Highlightsz Keys z	 Windows z
 Shell/Ed �
Extensions��side�expand�fill�rpN)r!�frame�gridr(�note�ExtPage�extpage�HighPage�highpage�FontPagerX�KeysPage�keyspage�WinPage�winpage�ShedPage�shedpage�add�enable_traversal�packrr	r�create_action_buttonsr)r`rtrvs   rcrSzConfigDialog.create_widgets`s@��$#�4��3�3��
�U��
�
���v��&�#�E�?�*��	�D��t�}��� ��t�|�|�4��
� ��t�}�}�5��
� ��t�|�|�4��
��t�}��� ����
�������Y��/�������\��2�������X��.�������K��0�������\��2�������L��1������	�	�s�4�d�	�3��"�"�$�)�)�v�)�6rdc��tj�ri}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)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
        rh)���rg�Ok�Apply�Cancel�Help)rl�command�	takefocusrf)rp�padxr)rH�borderwidthrs)r4�isAquaTkr!rt�buttons�ok�applyrW�helpr#r
r�rrr)r`�padding_args�outer�
buttons_frame�txt�cmds      rcr�z"ConfigDialog.create_action_buttons�s���$�?�?���L�%�v�.�L��d�j�j�!�,���e�Q�/�
����
�4�7�7�O�
�d�j�j�!�
�t�{�{�#�
�T�Y�Y��	!�H�C��
!'�}�!8�3��!&�!8�*6�!8�D�L�L����L�L���"�"��1�"�5�!�	�e�A�1�-�2�2��2�<������'��rdc�D�|j�|j�y)z*Apply config changes, then dismiss dialog.N)r��destroy�r`s rcr�zConfigDialog.ok�s���
�
�����rdc��|j�tj�|jj	�|j�y)z+Apply config changes and leave dialog open.N)�deactivate_current_config�changes�save_allrx�save_all_changed_extensions�activate_config_changesr�s rcr�zConfigDialog.apply�s6���&�&�(��������0�0�2��$�$�&rdc�L�tj�|j�y)zPDismiss config dialog.

        Methods:
            destroy: inherited
        N)r��clearr�r�s rcrWzConfigDialog.cancel�s��	�
�
�����rdc���|jjjdd�a|j	�t
�|��y)N�1.0�end)rX�font_sample�get�font_sample_text�grab_release�superr�)r`�	__class__s �rcr�zConfigDialog.destroy�s6����=�=�4�4�8�8���F������
���rdc	���|jj|jj�d��j�}t	|dt
tj|d�z��y)z�Create textview for config dialog help.

        Attributes accessed:
            note
        Methods:
            view_text: Method from textview module.
        rl)�optionzHelp for IDLE preferences�)rO�contentsN)rv�tab�select�stripr7�help_common�
help_pagesr�)r`�pages  rcr�zConfigDialog.help�sQ���y�y�}�}�T�Y�Y�-�-�/��}�?�E�E�G���$�9�&�z�~�~�d�B�'?�?�	Ardc�Z�|jjD]}|j��y)z/Remove current key bindings in current windows.N)rLrM�RemoveKeybindings)r`�instances  rcr�z&ConfigDialog.deactivate_current_config�s"�����1�1�H��&�&�(�2rdc�0�|jjD]b}|j�|j�|j	�|j�|j
�|j��dtD]}|j��y)z�Apply configuration changes to current windows.

        Dynamically update the current parent window instances
        with some of the configuration changes.
        N)
rLrM�ResetColorizer�	ResetFont�set_notabs_indentwidth�ApplyKeybindings�reset_help_menu_entries�update_cursor_blink�reloadables�reload)r`r��klasss   rcr�z$ConfigDialog.activate_config_changes�su�����1�1�H��#�#�%���� ��+�+�-��%�%�'��,�,�.��(�(�*�
2�!�E��L�L�N�!rd)r�)�__name__�
__module__�__qualname__�__doc__rKrSr�r�r�rWr�r�r�r��
__classcell__�r�s@rcr?r?-sG����-�5��-�^$7�L&�P�
'���
A�)�
rdr?u^<ASCII/Latin1>
AaBbCcDdEeFfGgHhIiJj
1234567890#:+=(){}[]
¢£¥§©«®¶½ĞÀÁÂÃÄÅÇÐØß

<IPA,Greek,Cyrillic>
ɐɕɘɞɟɤɫɮɰɷɻʁʃʆʎʞʢʫʭʯ
ΑαΒβΓγΔδΕεΖζΗηΘθΙιΚκ
БбДдЖжПпФфЧчЪъЭэѠѤѬӜ

<Hebrew, Arabic>
אבגדהוזחטיךכלםמןנסעף
ابجدهوزحطي٠١٢٣٤٥٦٧٨٩

<Devanagari, Tamil>
०१२३४५६७८९अआइईउऊएऐओऔ
௦௧௨௩௪௫௬௭௮௯அஇஉஎ

<East Asian>
〇一二三四五六七八九
汉字漢字人木火土金水
가냐더려모뵤수유즈치
あいうえおアイウエオ
c�>��eZdZ�fd�Zd�Zd�Zd�Zd�Zdd�Z�xZ	S)r{c���t�|�|�|j|_|j�|j	�y�N)r�rK�highlight_sample�create_page_font�
load_font_cfg)r`�masterrzr�s   �rcrKzFontPage.__init__s6���
���� � (� 9� 9����������rdc��tjt|�|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
        r�z Shell/Editor Font �r��reliefrlz Font Sample (Editable) zFont Face :)�justifyrl�T�rHr��exportselection�<ButtonRelease-1>z<KeyRelease-Up>z<KeyRelease-Down>�r�)�yscrollcommandzSize :rkN�r�Bold)�variable�onvalue�offvaluerl)�wraprIrH��weightrf)�row�columnr��padyr��nsew)r�r��rowspanr�r�rj�rpr�r�rr�rp�anchorro)rprrrC�rpr�r�)rqrr)+r[r�r�var_changed_font�	font_name�	font_sizer�	font_boldr"rr!r&rrr
rY�bind�on_fontlist_selectr*�config�yview�setr3�sizelistr$�bold_toggler=rlr�r�insertrr��columnconfigure�rowconfigurerur�rrrr	rr)	r`�
frame_font�frame_sample�frame_font_name�frame_font_param�font_name_title�scroll_font�font_size_title�font_sample_frames	         rcr�zFontPage.create_page_font!s��L!���Y�t�_�d�6K�6K�L��� ���Y�t�_�d�6K�6K�L��� ���Z��%5�t�7L�7L�M��� ��!�F�%:�<�
�!�$�A�f�'A�C�� �
�+�� ��,�����M�C�����*.��G��
��
�
���.��0G�0G�H��
�
���,�d�.E�.E�F��
�
���.��0G�0G�H���0�����4�=�=�#6�#6��7��
�
���K�O�O��<�� 0�x�@��%�&6�����M��
�&� �4�>�>��A�F�4���0��=��,�1�1��������T��1��=�������%5�6�	
���Q�q��)����!�A��&����A�a�a�a��8����a��1�1�1�!'�	�	)�	���#�A�A�A��>����3�Q�Q�Q��?����#�a��0��
�
����T���:����d���+����$�q��1��
�
����Q��/������4����;����d���6rdc�0�tj|dd�}|dj�}|d}|ddk(}tt	tj|���}|D]"}|jjt|��$|jj	|�|D�cgc]}|j���}}	|j|�}	|jj|	�|jj|	�|jj|	�|jj|	�|j"j%d|�|j&j	|�|j)�ycc}w#t $rY�XwxYw)	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�EditorWindowrr�r��bold)�7�8�9�10�11�12�13�14�16�18�20�22�25�29�34�40N)r0�GetFont�lower�sortedr��tkfont�familiesrYr�rr��index�see�
select_set�
select_anchor�activate�
ValueErrorr��SetMenur��set_samples)
r`�configured_fontr�r�r��fonts�font�s�lc_fonts�current_font_indexs
          rcr�zFontPage.load_font_cfgzs^��#�*�*�4���H��#�A�&�,�,�.�	�#�A�&�	�$�Q�'��/�	��s�6�?�?�4�0�1�2���D��M�M� � ��d�+�������9�%�',�-�u�!�A�G�G�I�u��-�	�!)���	�!:���M�M���0�1��M�M�$�$�%7�8��M�M�'�'�(:�;��M�M�"�"�#5�6�	
�
�
���O�'�	)�	
�����9�%������.���	��	�s�%F�?A=F	�		F�Fc�P�|jj�}tjddd|�|jj�}tjddd|�|j
j�}tjddd|�|j
�y)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.
        rrr(z	font-sizez	font-boldN)r�r�r��
add_optionr�r�r%�r`�params�values   rcr�zFontPage.var_changed_font�s������"�"�$�����6�>�6�5�A����"�"�$�����6�>�;��F����"�"�$�����6�>�;��F����rdc���|jj|jjdk(rtnt
�}|jj|j��y)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.
        �
KeyReleaseN)	rYr��type�namerrr�r�r)r`�eventr(s   rcr�zFontPage.on_fontlist_select�sE���}�}� � ��*�*�/�/�\�9��v�G�������4�:�:�<�(rdc�"�|jj�}|jj�rtjntj
}||jj�|f}||jd<||jd<y)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.
        r(N)	r�r�r�r�BOLD�NORMALr�r�r�)r`r5r��font_weight�new_fonts     rcr%zFontPage.set_samples�sm���N�N�&�&�(�	�%)�^�^�%7�%7�%9�f�k�k�v�}�}���t�~�~�1�1�3�[�A��#+����� �(0����f�%rdr�)
r�r�r�rKr�r�r�r�r%r�r�s@rcr{r{s$����W7�r �D
�)�1rdr{c���eZdZ�fd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z�xZS)ryc���t�|�|�||_|j�|_t|�|_|j�|j�yr�)	r�rKrx�winfo_toplevel�cdr+�style�create_page_highlight�load_theme_cfg�r`r�rxr�s   �rcrKzHighPage.__init__�sJ���
���� �����'�'�)����6�]��
��"�"�$����rdc
�
��idd�dd�dd�dd�d	d
�dd�d
d�dd�dd�dd�dd�dd�dd�dd�dd�dd ��_tjt���j��_tjt���j��_t���_	tjt���j��_tjt���j��_
tjt���j��_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;d0t6�j=��}t?d%|�D]1}	|j5|	�d1�|	t9tA|���d2��d3�d ��3�jD])}
|
f�fd4�	}|jC�j|
d5|��+d6|d7<�jDj-d8d%d9�:�tG|d8�;��_$tG|�}tK�jHd<�jL�=��_'tQ�jH�jd>d)�?��_)tU|�jd%d@�jV�A��_,tU|�jd)dB�jV�A��_-�jj]d%�tK|dC�j^�=��_0tc|dD�E�}
tU|�jd%�jddF�G��_3tU|�jd)�jddH�G��_4tQ|�j
d>d>�I��_5tQ|�jd>d>�I��_6tK|dJ�jn�=��_8tc|d!�K��_9|jutvdLdLtxtz�M�|jut|dLdLt~�N��jHjut|dLdLt~�N�|jut|dLd)�O�|jut|dLdLtxtz�M��jNjut|txt~dPdQ�R��jRjut|txt~dPdS�R��jXjutvt��T��jZjut�t��T��j`jut�t~dLdL�U�|
jut|t�dLdL�V��jfjut|t�dL�W��jhjut|t�dLd!�V��jjjut|t~dLdL�U��jljut|t~t�dLdL�X��jpjut|t~dLdL�U��jrjut|t~dL�Y�y>)Za�Return 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 Text�normalzCode Context�contextzPython Keywords�keywordzPython Definitions�
definitionzPython Builtins�builtinzPython Comments�commentzPython Strings�stringz
Selected Text�hilitez
Found Text�hit�Cursor�cursorzEditor Breakpoint�breakzShell Prompt�consolez
Error Text�errorzShell User Output�stdoutzShell User Exception�stderrzLine Number�
linenumberr�z Custom Highlighting r�z Highlighting Theme r�)r�r�)�courier�r��hand2r)r(rNrIrHr��highlightthicknessr�z<Double-Button-1>c��y�NrO���es rc�<lambda>z0HighPage.create_page_highlight.<locals>.<lambda>os��rdz<B1-Motion>c��yrZr[r\s rcr^z0HighPage.create_page_highlight.<locals>.<lambda>ps��7rd)")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

rD�z>>>rP)z	 3.14**2
rD)z9.8596rRr`rh)z pri rD)�nrQ)zt(
rD)�SyntaxErrorrSr`r�z.0�drcc�<���jj|�yr�)�highlight_targetr�)r5�elemr`s  �rc�temz+HighPage.create_page_highlight.<locals>.tem�s����%�%�)�)�$�/rdz<ButtonPress-1>�disabled�state�frame_color_set.TFrame�solid)r�r�)r?zChoose Color for :�rlr�N)rX�
Foreground)r�r0rlr��
BackgroundzSave as New Custom Themez	Select : rkza Built-in Theme�r�r0r�rlza Custom Themer�zDelete Custom Theme�r�rf�rpr�r�rqrrr��rpr�r���)rprqrrr�r�r�r��rprrr�r��rpr�r�r�r�)rprrr�r�r�)rprrr�)D�theme_elementsr[r�r�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_targetrmr"rr=rrlr��	configurer
rr�r�r�lenr��
splitlines�range�str�tag_bindr?r!�frame_color_setr#�	get_color�button_set_colorr3�
targetlistr)�set_color_sample_binding�fg_on�bg_onr��save_as_new_theme�button_save_customr&�set_theme_type�builtin_theme_on�custom_theme_on�builtinlist�
customlist�
delete_custom�button_delete_custom�
theme_messager�rr	rrrrr
rr)r`�frame_custom�frame_theme�sample_framerl�string_tagsrJ�tag�n_lines�lineno�elementro�frame_fg_bg_toggle�theme_type_titles`             rcr@zHighPage.create_page_highlight�sl���j�!�8��
�I��
�y�	�

!�,��
�y�
�
�y��
�h��
�X��
�%��
�h��
 ���
�I��
�'��
 ��� 
#�H�!�"
�<�#���&$�K�K��$���!>�!>�@���"�;�;��$���!=�!=�?���&�t�,����[�[��$���!7�!7�9��
�#�K�K��4� �$�"?�"?�A��� '����$���!B�!B�!D���
"�$�A�f�'>�@�� ��1�V�&<�>��+��U��;��'3�'8�'8�8��t�$����(���!��A�D�	�	B�	
�	�	�%�'8�9��	�	�-�!2�3�9��$'�K�F�C��K�K��V�S�)�'��d�h�h�u�c�*�5�5�7�8���A�w�'�F��K�K�6�(�"�
�!�3�s�7�|�#4�"5�Q�!6�7�q�9�$�
&�(��*�*�G� '�
0�
�M�M��'�'��0�2C�S�
J�	+�#��W�
��
�
���5�1�$+�	�	-�$�\�9Q�R���"�<�0�� &��$�$�+?����!(���(��$�$�d�&;�&;�T�#$�&���!�"�T�->�->�a�!�4�+H�+H�J��
�!�"�T�->�->�a�!�4�+H�+H�J��
�	
�����a� �"(��#=��.�.�#0���!��;�?�� +��d�&7�&7�q��+�+�2D�!F��� +��d�&7�&7�q��+�+�2B� D���)��T�.�.��d�D���'��T�-�-�t�T�C���$*��"7��*�*�%,��!�#�;�A�>���	���t�!�!�D�t��L����c�����:����!�!�s����!�C����S�q�q��9�����q�q��D�	�	B����"�"��D�q�q�q�"�Q������#�d�����K��
�
���T�!��,��
�
���U�1��-����$�$�&�q�q�q�$�I����3�q�q�q��A����"�"��A�A�"�>����!�!�s�1�1�1�!�E������3�Q�Q�Q��?������#�A�a�a�a��H��!�!�&�&�C�a�a�a�&�H������S�q�q��9rdc	��|jjtjddddd���tj�}|jj�r�tjdd�}|j�|jj||�tjdd�}|j�|s7|jjd	�|jjd
�n�|jj||d�n�tjdd�}|j�|jj||�tjdd�}|j�|jj||d�|j�t|j �}|j"j||d�|j%�|j'�y)
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�Theme�default�boolr��r3r��	highlight�user�rp�- no custom themes -rN)r�r�r0�	GetOption�CurrentThemer��GetSectionList�sortr�r$r�rqr�r�r�rerr��paint_theme_sample�set_highlight_target)r`�current_option�	item_list�theme_namess    rcrAzHighPage.load_theme_cfg�s���*	
�����h�0�0������D�	E�"�.�.�0����� � �"� �/�/�	�;�G�I��N�N�����$�$�Y��?� �/�/���D�I��N�N����$�$�*�*�=�9�� � �$�$�%;�<����'�'�	�9�Q�<�@� �/�/���D�I��N�N���O�O�#�#�I�~�>� �/�/�	�;�G�I��N�N�����$�$�Y�	�!��=������4�.�.�/��������[��^�<����!��!�!�#rdc��d}|jj�}||vr\tjddd�|vrtjddd|d�tjddd|�d|jd<n?tjddd|�tjdddd	�d	|jd<|j�y
)z�Process 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 Newrr�r4r�name2zNew theme, see Helprlr�N)r�r�r0r�r�r-r�r�)r`r/�
old_themesr0s    rcr�z!HighPage.var_changed_builtin_name�s���2�
��!�!�%�%�'���
�"��!�!�&�'�6�:�*�L��"�"�6�7�F�J�q�M�J����v�w���?�)>�D���v�&����v�w���>����v�w���<�)+�D���v�&����!rdc��|jj�}|dk7r)tjddd|�|j	�yy)z�Process 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.
        r�rr�r4N)r�r�r�r-r�r.s   rcr�z HighPage.var_changed_custom_namesF��� � �$�$�&���*�*����v�w���>��#�#�%�+rdc��|jj�}tjddd|�|r|j	�y|j�y)z�Process toggle between builtin and custom theme.

        Update the default toggle value and apply the newly
        selected theme type.
        rr�r�N)r�r�r�r-r�r�r.s   rcr�z!HighPage.var_changed_theme_sourcesG���!�!�%�%�'�����6�7�I�u�=���)�)�+��(�(�*rdc�$�|j�y)zProcess change to color choice.N)�on_new_color_set�r`r/s  rcr�zHighPage.var_changed_color*s�����rdc�$�|j�y)z5Process selection of new target tag for highlighting.N)r�r�s  rcr�z%HighPage.var_changed_highlight_target.����!�!�#rdc�T�|jj�r:d|jd<d|jd<|jjd�yd|jd<|jjd�d|jd<|jjd�y)a�Set 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
        rDrqrpr��z	!disabledN)r�r�r�r�r�rqr�r�s rcr�zHighPage.set_theme_type2s���$��� � �"�(0�D���W�%�'1�D�O�O�G�$��%�%�+�+�M�:�(2�D���W�%�� � �&�&�~�6�'/�D�O�O�G�$��%�%�+�+�N�;rdc���|jj�}|jj|jdd�}tj|d|z|��\}}|r||k7ry|jj�rCd}|j|�}|sy|j|�|jj|�y|jj|�yyy)a�Handle 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)rmr�r?�lookupr�r.�askcolorr��get_new_theme_name�
create_newr�r�)r`�target�
prev_color�	rgbTuplet�color_string�message�	new_themes       rcr�zHighPage.get_colorNs���$�&�&�*�*�,���Z�Z�&�&�t�';�';�G�'D�'3�5�
�".�"7�"7��#:�6�#A�'�#)��	�<��\�Z�7�� � �$�$�&�K�� �3�3�G�<�	� ���O�O�I�.��J�J�N�N�<�0��
�
���|�,�8�<rdc��|jj�}|jjd|��|jj�rdnd}|j
|jj�}|jj|fi||i��|jj�}|dz|z}tjd|||�y)z4Display sample of new color selection on the dialog.rr�r��
foregroundr��-r�N)r�r�r?r�r�rrmr��
tag_configr�r�r-)r`�	new_color�plane�sample_element�theme�
theme_elements      rcr�zHighPage.on_new_color_setts����J�J�N�N�$�	��
�
���5�)��L� $� 1� 1� 5� 5� 7��\���,�,�T�-B�-B�-F�-F�-H�I��(����(�(��N�E�9�;M�N�� � �$�$�&��&��,�u�4�
����;��}�i�Hrdc��tjdd�tjdd�z}t|d||�j}|S)z*Return name of new theme from query popup.r�r�r�zNew Custom Theme�r0r�r5�result)r`r��
used_namesr�s    rcr�zHighPage.get_new_theme_namesL���-�-�f�k�B��'�'�	�;�?�@�
���(�'�:�?�?E�v�	��rdc�N�|jd�}|r|j|�yy)z�Prompt for new theme name and create the theme.

        Methods:
            get_new_theme_name
            create_new
        zNew Theme Name:N)r�r�)r`�new_theme_names  rcr�zHighPage.save_as_new_theme�s)���0�0�1B�C����O�O�N�+�rdc� �|jj�rd}|jj�}nd}|jj�}t	j
||�}|tdvrtd|}|D]
}||||<�|j||�t	jdd�}|j�|jj||�|jjd�|j�y)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�r�r�rN)r�r�r�r�r0�GetThemeDictr��save_newr�r�r�r$r�r�)r`r��
theme_type�
theme_namer��
theme_changesr��custom_theme_lists        rcr�zHighPage.create_new�s���&��� � �"�"�J��*�*�.�.�0�J��J��)�)�-�-�/�J��)�)�*�j�A�	����-�-�#�K�0��<�M�(��%2�7�%;�	�'�"�)�	
�
�
�n�i�0�$�3�3�F�K�H����� ������ 1�>�B������a� ����rdc��|jj�dk(rR|jjd�|jjd�|j
j
d�nQ|jjd�|jjd�|j
j
d�|j�y)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
        rMr�r�r�N)rmr�r�rqr�r�r��set_color_sampler�s rcr�zHighPage.set_highlight_target�s���$� � �$�$�&�(�2��J�J���]�+��J�J���]�+����!�!�!�$��J�J���^�,��J�J���^�,����!�!�!�$����rdc�$�|j�y)zrChange color sample based on foreground/background toggle.

        Methods:
            set_color_sample
        N)r�)r`�argss  rcr�z!HighPage.set_color_sample_binding�s��	
���rdc��|j|jj�}|jj�rdnd}|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
        r�r�rrr�N)rrmr�r�r��tag_cgetr?r�)r`r�r�r�s    rcr�zHighPage.set_color_sample�sk���!�!�$�"7�"7�";�";�"=�>�� $� 1� 1� 5� 5� 7��\���%�%�.�.�s�E�:���
�
���5�%��Hrdc� �|jj�r|jj�}n|jj�}|jD]�}|j|}tj||�}|dk(rtj|d�d|d<|tdvr0td|}|dz|vr||dz|d<|dz|vr||dz|d<|jj|fi|����|j�y)	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
        rNrDr�r�z-foregroundr�z-backgroundN)r�r�r�r�rr0�GetHighlightr�r�r�r�)r`r��
element_titler��colors�
theme_dicts      rcr�zHighPage.paint_theme_sample�s#��(��� � �"��%�%�)�)�+�E��$�$�(�(�*�E�!�0�0�M��)�)�-�8�G��*�*�5�'�:�F��(�"�'/�'<�'<��x�()�)5�(7��|�$����,�,�$�[�1�%�8�
��]�*�j�8�+5�g�
�6M�+N�F�<�(��]�*�j�8�+5�g�
�6M�+N�F�<�(�,�D�!�!�,�,�W�?��?�1�	
���rdc��tjdj|�|D]+}||}tjdj|||��-y)z�Save a newly created theme to idleConf.

        theme_name - string, the name of the new theme
        theme - dictionary containing the new theme
        r�N�r0�userCfg�
AddSection�	SetOption)r`r�r�r�r0s     rcr�zHighPage.save_newsM��	����%�0�0��<��G��'�N�E����[�)�3�3�J���O�rdc�,�tj|i|��Sr��r/�askyesno�r`r��kwargss   rcr�zHighPage.askyesno#����"�"�D�3�F�3�3rdc�j�|jj�}d}|jd||z|��sy|jj	�t
j
d|�tjdd�}|j�|s8|jjd�|jj|d�n|jj||d	�|jjtj d
j#dd��|j$jtj d
j#dd
��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 Theme�rLNr�r�r�r�rrr�r�r4)r�r�r�r>r�r��delete_sectionr0r�r�r�rqr�r$r�r��
defaultCfg�Getr�r�rxr�r�r�)r`r��delmsgr�s    rcr�zHighPage.delete_custom'sN��,�%�%�)�)�+�
�A���}�}���*�!4�T��C�����)�)�+����{�J�7��+�+�F�K�@�	������� � �&�&�}�5��O�O�#�#�I�/E�F��O�O�#�#�I�y��|�<������h�1�1�&�9�=�=�g�y�Q�R������h�1�1�&�9�=�=�g�v�N�O��������0�0�2����'�'�)����rd)r�r�r�rKr@rAr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�s@rcryry�su����}:�~1$�f"�&	&�+� �$�<�8$-�L	I��	,�&�P �8 �I�$& �P	P�4�-rdryc���eZdZ�fd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zed��Zd�Zd�Z�xZS)r|c���t�|�|�||_|j�|_|j�|j
�yr�)r�rKrxr=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;d�D�cgc]}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)(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
        r�z Custom Key Bindings r�z	 Key Set zAction - Key(s)rk��orient)r�r�r�r�r��xscrollcommandzGet New Keys for Selectionrp)rlr�rqr)rhr�r�zUse a Built-in Key SetrwzUse a Custom Key SetNr�zDelete Custom Key SetrtzSave as New Custom Key Setrxrfryr�r}r�)r�r��
columnspanrj�r�r�rj)r�r�rjr�r�T)rprrrqr��rprrrq)rprrrqr�)8r[r�rr�r�r�r�r�var_changed_keyset_source�
keyset_source�var_changed_keybinding�
keybindingr"rr!r&r*rrr
�bindingslistr��on_bindingslist_selectr��xviewr�r#�get_new_keys�button_new_keysr�r)�
set_keys_type�builtin_keyset_on�custom_keyset_onr3r�r��delete_custom_keys�button_delete_custom_keys�save_as_new_key_set�button_save_custom_keys�keys_messager�rr	rrrr�r�rurrrrr)	r`r��frame_key_sets�frame_target�target_title�scroll_target_y�scroll_target_x�i�framess	         rcrzKeysPage.create_page_keys`s���d$�K�K��$���!>�!>�@���"�;�;��$���!=�!=�?���$�[�[��4� �$�"@�"@�B���!�+�+��$���!<�!<�>���
"��!�F�,�.��$��!�F��F���\�*���\�0A�B��#�L�1��#�L��D��#���u�F��������2�#�:�:�	<�%)�%6�%6�%<�%<��	�"�%)�%6�%6�%<�%<��	�"�.=�.A�.A����*�+�.=�.A�.A����*�+�%��#?��)�)�� =���
!��8�%�#�a����q�A�#�	�%�!,��q�	�D�$6�$6�a��*�*�1I�"K���!,��q�	�D�$6�$6�a��*�*�1G�!I���)��q�	�4�,�,�d�D�B���'��q�	�4�+�+�T�4�A���)/��q�	� 7��/�/�*1��&�(.��q�	� <��0�0�(2��$�"�&��)��;���	���v�A�A�d���N�����a�a�d��C����!�!�v�A�A�A�!�F����t�!�!�D�t��L��$�$�Q�q�$�1��!�!�!�A�!�.����a��a���B������1�Q�t��<�����1�R��8�����1�R��8����#�#��!�A�b�D�#�A����"�"�q��1�R�4�"�@������!�A�d��;�������1�T��:������1�Q�t�!�!��L��&�&�+�+��A�d�QR�+�S��$�$�)�)�t�!�D�q�)�Q��q�	���C�d�4��8��q�	���C�a��1��=��W%s�#U
c	���|jjtjddddd���tj�}|jj�r�tjdd�}|j�|jj||�tjdd�}|j�|s7|jjd	�|jjd
�n�|jj||d�n�tjdd�}|j�|jj||�tjdd�}|j�|jj|tj��|j�tj�}|j!|�y)
z?Load current configuration settings for the keybinding options.r�Keysr�r�r�r��keysr�r��- no custom keys -rN)rr�r0r��CurrentKeysr�r�r�r�r$rrqr�r��default_keysr�load_keys_list)r`r�r��keyset_names    rcrzKeysPage.load_key_cfgsy��	
�����x�1�1���	��� C�	D�"�-�-�/�����!�!�#� �/�/�	�6�B�I��N�N�����$�$�Y��?� �/�/���?�I��N�N����%�%�+�+�M�:�� � �$�$�%9�:����'�'�	�9�Q�<�@� �/�/���?�I��N�N���O�O�#�#�I�~�>� �/�/�	�6�B�I��N�N�����$�$�Y��0E�0E�0G�H������*�*�,�����K�(rdc��d}|jj�}||vr\tjddd�|vrtjddd|d�tjddd|�d|jd<n?tjddd|�tjdddd	�d	|jd<|j|�y
)z%Process selection of builtin key set.)zIDLE Classic WindowszIDLE Classic UnixzIDLE Classic MaczIDLE Classic OSXrr-r4rr�zNew key set, see Helprlr�N)r�r�r0r�r�r-r$r2)r`r/�old_keysr0s    rcr�z!KeysPage.var_changed_builtin_names���
���!�!�%�%�'���� ��!�!�&�&�&�9��I��"�"�6�6�6�8�A�;�G����v�v�w��>�(?�D���f�%����v�v�v�u�=����v�v�w��;�(*�D���f�%����E�"rdc��|jj�}|dk7r*tjddd|�|j	|�yy)z$Process selection of custom key set.r/rr-r4N)r�r�r�r-r2r.s   rcr�z KeysPage.var_changed_custom_name3sF��� � �$�$�&���(�(����v�v�v�u�=�����&�)rdc��|jj�}tjddd|�|r|j	�y|j�y)z:Process toggle between builtin key set and custom key set.rr-r�N)rr�r�r-r�r�r.s   rcrz"KeysPage.var_changed_keyset_source:sE���"�"�&�&�(�����6�6�9�e�<���)�)�+��(�(�*rdc��|jj�}|jj�}|jjt�j�d}t
j|�rtjd|||�yt
j|�}|dz}tjd|||�y)zStore change to a keybinding.rr.�_cfgBindings�
extensionsN)rr�r�rr�splitr0�
IsCoreBindingr�r-�GetExtnNameForEvent)r`r/r0�key_setr5�ext_name�ext_keybind_sections       rcrzKeysPage.var_changed_keybindingCs������#�#�%���"�"�&�&�(���!�!�%�%�f�-�3�3�5�a�8���!�!�%�(����v�w��u�=��3�3�E�:�H�"*�^�";�����|�-@�%��Ordc�T�|jj�r:d|jd<d|jd<|jjd�yd|jd<|jjd�d|jd<|jjd�y)z@Set available screen options based on builtin or custom key set.rDrqrpr�r�N)rr�r�r�r!rqrr�s rcrzKeysPage.set_keys_typeOs������!�!�#�(0�D���W�%�'1�D�O�O�G�$��*�*�0�0��?�(2�D���W�%��!�!�'�'��7�'/�D�O�O�G�$��*�*�0�0��@rdc��|jjt�}|jj|�}|j	�d}|j
j�r|jj�}n|jj�}tj�}|tdvr)td|}|D]}||j	�||<�t|j��}t|d||�j}	|	�r|j
j�r]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� - )rrrr�r;rr�r�r0�GetCurrentKeySetr�re�valuesr2r��get_new_keys_namer r!�create_new_key_set�deleter�rr�)r`�
list_index�binding�	bind_name�current_key_set_name�current_bindings�key_set_changesr5�current_key_sequences�new_keysr��
new_keysets            rcrzKeysPage.get_new_keys[s����&�&�,�,�V�4�
��#�#�'�'�
�3���M�M�O�A�&�	����!�!�#�#'�#4�#4�#8�#8�#:� �#'�#3�#3�#7�#7�#9� �#�4�4�6���7�6�?�2�%�f�o�.B�C�O�(��*9�%�*@�*F�*F�*H� ��'�)� $�%5�%<�%<�%>� ?�� ��~�y�%�'�'-�v�	���!�!�%�%�'�N��!�3�3�G�<�
�!��%�%�0�0��<��%�%�3�3�J�?���+�+�J�7����$�$�Z�0����$�$�Z��5���1I�J����(�(��4����+�+�J�7��O�O����)����(�(��4����+�+�J�7rdc��tjdd�tjdd�z}t|d||�j}|S)z)Return new key set name from query popup.r�r.r�zNew Custom Key Setr�)r`r�r�rQs    rcrFzKeysPage.get_new_keys_name�sL���-�-�f�f�=��'�'�	�6�:�;�
� ��*�G�Z�A�AG��	��rdc�N�|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_set�s)���.�.�/B�C�
���#�#�M�2�rdc�:�|jjd�y)z6Activate button to assign new keys to selected action.r�N)rrq�r`r5s  rcrzKeysPage.on_bindingslist_select�s�����"�"�>�2rdc�d�|jj�r|jj�}n|jj�}t	j
|�}i}|D] }|dd}dj
||�}|||<�"|tdvrtd|}|D]
}||||<�|j||�t	jdd�}	|	j�|jj|	|�|jjd�|j�y)z�Create 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.
        r����rcr.r�rN)rr�r�r�r0�GetCoreKeys�joinr��save_new_key_setr�r�r�r$r�r)
r`�new_key_set_name�prev_key_set_name�	prev_keysrPr5�
event_namerJrN�custom_key_lists
          rcrGzKeysPage.create_new_key_set�s#�����!�!�#� $� 1� 1� 5� 5� 7�� $� 0� 0� 4� 4� 6���(�(�):�;�	����E��q���J��h�h�y��/�0�G�#*�H�Z� ��
����/�%�f�o�.?�@�O�(��"1�%�"8����)�	
���.��9�"�1�1�&�&�A������������1A�B������q�!����rdc��d}|jj�r!d}|jjt�}t	j
|�}t
|�}|j�|jjdt�|D]i}dj||�}|dd}|tdvr|td|vrtd||}|jjt|dz|z��k|rR|jj�|jj|�|jj|�y	y	)
z�Reload the list of action/key binding pairs for the active key set.

        An action/key binding can be selected to change the key binding.
        FTrrcr�rXr.rCN)r�curselectionrrr0�	GetKeySetrer�rHrrZr�r�rr r!)r`r3�reselectrI�keyset�
bind_namesrK�keys        rcr2zKeysPage.load_keys_list�s,��
�����)�)�+��H��*�*�0�0��8�J��#�#�K�0���&�\�
�������� � ��C�(�#�I��(�(�6�)�,�-�C�!�!�B��I��g�f�o�-������ <�<�!�&�/�+�6�y�A�C����$�$�S�)�E�/�#�*=�>�$�����!�!�*�-����(�(��4����+�+�J�7�rdc��tjdj|�|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_set�sM��	���� �+�+�K�8��E��5�M�E����V�$�.�.�{�E�5�I�rdc�,�tj|i|��Sr�r�rs   rcr�zKeysPage.askyesno�rrdc��|jj�}d}|jd||z|��sy|jj	�t
j
d|�tjdd�}|j�|s8|jjd�|jj|d�n|jj||d	�|jjtj d
j#dd��|j$jtj d
j#dd
�xstj&��t
j)�|j*j-�|jj/�|j1�y)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 SetrNr.r�r�r/rrr-r�r4)r�r�r�r>r�r�rr0r�r�rrqr�r$rr�rrr�r1r�rxr�r�r)r`r3rr�s    rcr zKeysPage.delete_custom_keys�sd���&�&�*�*�,��C���}�}� �6�K�#7���F�����)�)�+����v�{�3��+�+�F�F�;�	�������!�!�'�'�
�6��O�O�#�#�I�/C�D��O�O�#�#�I�y��|�<������x�2�2�6�:� #��F�I� 6�	8������h�1�1�&�9�=�=�f�f�M�9�!)�!6�!6�!8�	:�	�������0�0�2����'�'�)����rd)r�r�r�rKrrr�r�rrrrrFr"rrGr2�staticmethodr[r�r r�r�s@rcr|r|Wsn����^>�@)�>#�('�+�
P�
A�*8�X�3�3��<8�6�
J��
J�4� rdr|c�0��eZdZ�fd�Zd�Zd�Zd�Z�xZS)r~c���t�|�|�|j�|j�|j	�yr�)r�rK�init_validators�create_page_windows�load_windows_cfg�r`r�r�s  �rcrKzWinPage.__init__s4���
���� ������ � �"����rdc�j��tjd���fd�}|j|�df|_y)N�[0-9]*c�*���j|�duS�z+Return 's is blank or contains only digits'N��	fullmatch�r)�digits_or_empty_res �rc�is_digits_or_emptyz3WinPage.init_validators.<locals>.is_digits_or_empty����%�/�/��2�$�>�>rd�%P��re�compile�register�digits_only�r`rzrys  @rcrnzWinPage.init_validators�0����Z�Z�	�2��	?�!�M�M�*<�=�t�E��rdc�j�tjt|�d�|_tjt	|�d�|_tjt	|�d�|_tjt	|�d�|_tjt|�d�|_	tjt	|�d�|_
tjt	|�d�|_tjt	|�d�|_tjt|�d	�|_
tjt	|�d
�|_t|dt 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/tTtV�0�|jQtRd/dtX�1�|jQtZt\d/d/�2�|j*jQt^t\d/d/�2�|j(jQt^t\d/d/�2�|jQtRd/dtX�1�|jQtZt\d/d/�2�|j2jQt^t`dd/�2�|jQt^t`d/�3�|j0jQt^t`dd/�2�|jQt^t`d/�3�|jQtRd/dtX�1�|	jQtZt\d/�4�|j6jQtZt\d�4�|jBjQt^t`d5d/�2�|jQtRd/dtX�1�|jQtZt\d/d/�2�|jDjQtRdd/�6�|
jQtRd/dtX�1�|jQtZt\d/d/�2�|jHjQtRdd/�6�|jQtRd/dtX�1�|jQtZt\d/�4�|jLjQt^t`d5d/�2�|jJjQtRt\d5d/�2�|jQtRd/dtX�1�|jQtZt\d/d/�2�|jNjQtRdd/�6�y7#t8$r6t;||jdt=t?dd ��d�!�|_Y��wxYw)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
        )r�General�editor-on-startup)rrrI)rrrH)r�Indent�
num-spaces)rr�cursor-blink)r:r8�	popupwait)r:r:r?)r:r:�flash-delay)r:r:�bell)r:r;�	max-widthr�z Window Preferencesr�rrxz
At Startuprkr�zOpen Edit Window�r�r0rlzOpen Shell Windowz$Initial Window Size  (in characters)�Widthr�rg��textvariablerI�validatecommand�validate�HeightzIndent spaces (4 is standard)�
)r��from_�torIr�r��readonly�)r�rqrErIzCursor BlinkzCursor blink)rlr�z%Completions Popup Wait (milliseconds)r�zParen Match Style�
expression�opener�parensz;Time Match Displayed (milliseconds)
(0 is until next input)zBell on MismatchzFormat Paragraph Max Widthr|rfryr�r~�rpr�r�r�r�rzN)1r[r�r�startup_editr�	win_width�
win_height�
indent_spacesr�cursor_blink�autocomplete_wait�paren_style�flash_delay�
paren_bell�format_widthr"rr!r&r)�startup_editor_on�startup_shell_onr%r��
win_width_int�win_height_intr,�indent_chooserr r-rer�r$�cursor_blink_bool�
auto_wait_intr'�paren_style_type�paren_flash_time�bell_on�format_width_intr�rr	rrrrr
r)r`�frame_window�	frame_run�
startup_title�frame_win_size�win_size_title�win_width_title�win_height_title�frame_cursor�indent_title�cursor_blink_title�frame_autocomplete�auto_wait_title�frame_paren1�paren_style_title�frame_paren2�paren_time_title�frame_format�format_width_titles                   rcrozWinPage.create_page_windowss���R$�K�K��t��F�H��� ����$��!B�D���!�+�+��$��!C�E���$�[�[��$��!A�C���#�K�K��4� �"J�L���!(����$��!L�"N���"�;�;��$��!F�H���"�;�;��$��!L�N���!�+�+��4� �"F�H���#�K�K��$��!O�Q���"�$�A�f�'<�>���,�A�6�	��i�l�;�
�!,��D�$5�$5�Q�'�")���!,��D�$5�$5�Q�(�!*����|��;����%K�M����W�=��"��T�^�^�1� $� 0� 0�5�
���!��h�?��#��T�_�_�A� $� 0� 0�5�
���
�\�q�9���\�"A�C��	I�")� �t�/A�/A���!�$(�$4�$4�u�#F�D��#�<�n�E��!,�\��6:�6G�6G�"I���#�<�Q�@��� 2�%L�N��"�"��1G�1G���)9�)9�E�K����\�q�9��!�,�5H�I�� *��d�.�.����,�!0����\�q�9�� ��$<�=��!&��4�+;�+;�1� $� 0� 0�5�!B���#��#5����Q����\�q�9��"�<�(D�F�� %��4�+<�+<�A� $� 0� 0�5�!���	���s���4�d��K����C�a�a�a��8�����Q�Q�Q��?����"�"��a�a�a�"�H����#�#��q�q�q�#�I�����1�1�1��=�����a�a�a��@���� � �e�A�B�Q� �G����5����;������U�1�2�A��F����%����:����s�����;����t�A�A��6���� � �d�1�2� �>����#�#��q�r��#�J����S�q�q�q��A����$�q�q�q��A������S�r���:����s�����;����D�����C����"�"��"�1�"�=����s�����;����4����:������u�Q�R�a��@����"�"��A�B�Q�"�G����s�����;����T�!�!�!��D����"�"��"�1�"�=��O�	I�"*� �t�/A�/A�$�T�%��"�+�->�a�#I�D��	I�s�3+]3�3;^2�1^2c���|jjtjdddd���|jjtjdddd���|j
jtjddd	d���|jjtjdd
dd���|jjtjdddd���|jjtjd
ddd���|jjtjd
dd��|jjtjd
ddd���|jjtjd
dd��|jjtjd
ddd���y)Nrr�r�r��r3rrI�intrHr�r�r�r:r8r�r:r?r�r�r;r�)
r�r�r0r�r�r�r�r�r�r�r�r�r�r�s rcrpzWinPage.load_windows_cfg�s��������h�0�0��	�#6�V�E�	F������8�-�-����e�=�	>������H�.�.����u�>�	?������x�1�1���,�U� <�	=������h�0�0����V�E�	F����"�"�8�#5�#5��n�k��$G�	H������X�/�/��l�G�5�	6������X�/�/��l�M��G�	H������H�.�.��l�F�4�	5������h�0�0��/��5�J�	Krd)r�r�r�rKrnrorpr�r�s@rcr~r~	s��� �F�h>�TKrdr~c�0��eZdZ�fd�Zd�Zd�Zd�Z�xZS)r�c���t�|�|�|j�|j�|j	�yr�)r�rKrn�create_page_shed�load_shelled_cfgrqs  �rcrKzShedPage.__init__�s4���
���� ������������rdc�j��tjd���fd�}|j|�df|_y)Nrsc�*���j|�duSrurvrxs �rcrzz4ShedPage.init_validators.<locals>.is_digits_or_empty�r{rdr|r}r�s  @rcrnzShedPage.init_validators�r�rdc�t�tjt|�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.ddt0��t|�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.dd��y)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
        )r�PyShell�auto-squeeze-min-lines)rr��autosave)rr�line-numbers-default)r:r9�maxlinesr�z Shell Preferencesr�z Editor PreferencesrrxzAuto-Squeeze Min. Lines:rkr|rg)rIr�r�r�zAt Start of Run (F5)  zPrompt to Saver�r�z	No Promptz Show line numbers in new windows)r�rIzMax Context Lines :r�r�rfr�r~rzN)r[r�r�auto_squeeze_min_linesrr�r�line_numbers_default�
context_linesr"rr!r&r%r��auto_squeeze_min_lines_intr)�save_ask_on�save_auto_onr$�line_numbers_default_bool�context_intr�rrrrrr
)r`�frame_shell�frame_editor�frame_auto_squeeze_min_lines�auto_squeeze_min_lines_title�
frame_save�run_save_title�frame_line_numbers_default�line_numbers_default_title�
frame_context�
context_titles           rcr�zShedPage.create_page_shed�s6��>'.�k�k��$��!N�'P��#� ����t��=�?��
�$+�K�K��4� �@�%B��!�%�[�[��$��!J�L���!��1�V�&:�<��!�$�A�f�'<�>��(-�[�a�'H�$�',�-I�2L�(N�$�*/�,�A�!�8�8� $� 0� 0�5�+
��'��<�Q�7�
��z�0H�I��&��T�]�]�!�%�'���(��T�]�]�!� �"���&+�<�Q�%G�"�%*�&�-O�&Q�"�)4�*��2�2��*��&�
�l��:�
��m�2G�H�
� ��D�,>�,>�a� $� 0� 0�5�
���	���c�����=�
�d��������s�����>�$�)�)�s����)�K�$�)�)�t�A�A�A�)�N��'�'�,�,�#�A�A�,�F����S�q�q�q��9�����a�a�a��@������E�!�!�!��D������5�����C�"�'�'�S�q�q�q�'�I�"�'�'�T�!�!�!�'�L��&�&�+�+��A�A�+�F�����!�!�!��<�����Q�Q�Q��?������3�Q�Q��7rdc	��|jjtjdddd���|jjtjddddd	�
��|j
jtjdddd	���|jjtjd
ddd���y)Nrr�r�r�r�r�r�rr�)r�r3rr�r:r9r�)r�r�r0r�r�r�r�r�s rcr�zShedPage.load_shelled_cfgSs����#�#�'�'��(:�(:��	�#;�%�)I�	J�	
�
�
���(�,�,��	�:�q�v�G�	H��!�!�%�%�h�&8�&8���(>�V�'M�	N������x�1�1��m�Z�e� E�	Frd)r�r�r�rKrnr�r�r�r�s@rcr�r��s��� �F�f8�P
Frdr�c�B��eZdZ�fd�Zd�Zd�Zd�Zd�Zd�Zd�Z	�xZ
S)rwc���t�|�|�tjd|_tj
d|_|jt�|_|j�|j�y)Nr:)r�rKr0r�ext_defaultCfgr��ext_userCfgr��is_int�load_extensions�create_page_extensionsrqs  �rcrKzExtPage.__init__as^���
���� �&�1�1�,�?���#�+�+�L�9����m�m�F�+��������#�#�%rdc��t|�|_t|dtd��}t	|dtd��|_|j
dd��|jdd��t||jd�	�|_	|jjd
|j�t||jj��}|j|j_t|dd�
�|_|jj#ddd��|j#ddd��|j j#dddddg��|j%d��i|_d|_||_|j|_d}t/|j0�D]}|j3|�|dz|zdz}� |jj|�|jj5d�|jd�|j#ddd��t7|�j#dd��|j
j#ddd��y)a�Configure 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().
        r�z Feature Extensions r�z Help Menu Extensions rr�r��browse)�listvariable�
selectmodez<<ListboxSelect>>r��)rIrH�nws�r�r�rj�nsr�r�)r�r�rjr�rgNr��{z} r)r�r��sew)r�extension_namesr"r�	HelpFrame�
frame_helpr�r�r�extension_listr��extension_selectedr*r�r�r��
details_framerur��config_frame�current_extension�
outerframe�tabbed_page_setrr:�create_extension_frame�
selection_setr&)r`�	frame_ext�scroll�	ext_namesr?s     rcr�zExtPage.create_page_extensionsis
��0 )������t��6�$:�<�	�#�D�a��$<�>���	���q���+��!�!�!�A�!�.�%�i�d�>R�>R�19�;������ � �!4�d�6M�6M�N��9�d�.A�.A�.G�.G�H��+1�:�:����*�'�	��S�I������ � ��q�� �?����1�!�D��1������q�a��b�!�W��M����B��'����!%������#�2�2����	��t���/�H��'�'��1�!�C��(�2�T�9�I�0�	
��� � ��+����)�)�!�,�����%�	���1�Q�v��6�
�d����Q�q��)�������1�U��;rdc
��i|_tjd��D]}g|j|<�|jD]�}t|jj|��}|D�cgc]}|j
d�r|��}}|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	}YnwxYwY��wxYw#t$r|}Y��wxYw)zAFill self.extensions with data from the default and user configs.F)�active_only�enableT)�raw)�True�Falser�r�N)r3r
r�)r4r3r�r0�var)r:r0�
GetExtensionsrr��
GetOptionList�
startswith�remover�KeyErrorr�r#r�rr�r��append)
r`r?�opt_list�opt_name�enables�def_str�def_obj�opt_typer0r
s
          rcr�zExtPage.load_extensions�s������ �.�.�5�A�H�(*�D�O�O�H�%�B����H��d�1�1�?�?��I�J�H�19�9��H�"�-�-�h�7� ��G�9�#������)�$���)�H�$���-�-�1�1� �(��2�6��	(�&*�E�:�7�C�G�%�H�$� �,�,�0�0�$�h�X�4�$+�1�-�E�
 ��o������E�
�#�����)�0�0�(�:B�=D�;@�9<�	23�4�-%�(��9�� �(�(�"%�g�,��#(���%�(�")��#'��(��	(��"�$�#�E�$�sN�)D?�
E� E5�	E2�
E�E2�
E,	�)E2�+E,	�,E2�1E2�5F�Fc���|jj�}|r|jj|�}|�||jk7rV|jrJ|jjd��|j|jj�d|_|rE|jj|��|j|jddd��||_yy)z/Handle selection of an extension from the list.Nr�rkrr�r�)	r�rbr�r�r�r�r��grid_forgetru)r`r5�newsels   rcr�zExtPage.extension_selected�s����$�$�1�1�3����(�(�,�,�V�4�F��>�V�t�'=�'=�=��%�%��"�"�)�)�r�)�2��!�!�$�"8�"8�9�E�E�G�)-��&�����%�%�6�%�2����f�%�*�*�!��6�*�J�%+�D�"�rdc�&�t|jdd��}||j|<|j}t	|j
|�D]�\}}t
||d��}|j|dt��|d}|dd	k(r(t||d
dd�
�j|dtd���c|ddk(r4t||d|jdfd��j|dtd����t||d��j|dtd����y)z=Create a frame holding the widgets to configure one extensionr�rGr4rkrrr
r3r�rrr{)r�r�r�rIr��)r�r�rjr�r�rgr|r�)r�r�r�rIr�)r�rIN)�VerticalScrolledFramer�r��interior�	enumerater:r&rurr$rr%r�r)r`r?�f�
entry_arear��opt�labelr
s        rcrzExtPage.create_extension_frame�s��!�$�"4�"4�S��L��&'����(�#��Z�Z�
�!�$�/�/�(�";�<�H�C���*�3�v�;�7�E��J�J�3�q��J�4��e�*�C��6�{�f�$��J��$*�W�A��"�d�s�1�Q�Q�d�G��V���%��j�s�U�'+�{�{�D�&9������Q�t�!��D��j�s�"�����Q�t�!��D�#=�$	rdc��|d}|d}|dj�j�xs|}|dj|�||k(r|jj	||�S|jj|||�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.
        r4r�r
)r�r�r�r��RemoveOptionr�)r`�sectionr$r4r�r0s      rc�set_extension_valuezExtPage.set_extension_value�s����6�{���i�.���E�
��� �&�&�(�3�G���E�
���u��
�W���#�#�0�0��$�?�?����)�)�'�4��?�?rdc��d}|jD]-}|j|}|D]}|j||�s�d}��/|r|jj�yy)z�Save configuration changes to the user config file.

        Attributes accessed:
            extensions

        Methods:
            set_extension_value
        FTN)r:r)r��Save)r`�has_changesr?�optionsr$s     rcr�z#ExtPage.save_all_changed_extensionss`�������H��o�o�h�/�G����+�+�H�c�:�"&�K��(�
����!�!�#�rd)r�r�r�rKr�r�r�rr)r�r�r�s@rcrwrw`s)���&�=<�~,4�\
,��4@�"$rdrwc�N��eZdZ�fd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Z�xZS)
r�c�f��t�|�|fi|��|j�|j�yr�)r�rK�create_frame_help�
load_helplist)r`r��cfgr�s   �rcrKzHelpFrame.__init__%s-���
����'�3�'���� ����rdc���t|�}t|ddt��|_t	|�}|jj
|d<|j|jd<|jjd|j�t|�}t|ddd	|j�
�|_t|dd	|j��|_
t|d
dd	|j�
�|_|j!t"ddt$t&��|jj!t"t(t$t&��|j!t*t,t.��|j!t*ddt.��|jj!t0t,d��|jj!t0t,��|jj!t0t,d��y)a8Create LabelFrame for additional help menu sources.

        load_helplist loads list user_helplist with
        name, position pairs and copies names to listbox helplist.
        Clicking a name invokes help_source selected. Clicking
        button_helplist_name invokes helplist_item_name, which also
        changes user_helplist.  These functions all call
        set_add_delete_state. All but load call update_help_changes to
        rewrite changes['main']['HelpFiles'].

        Widgets for HelpFrame(LabelFrame):  (*) widgets bound to self
            frame_helplist: Frame
                (*)helplist: ListBox
                scroll_helplist: Scrollbar
            frame_buttons: Frame
                (*)button_helplist_edit
                (*)button_helplist_add
                (*)button_helplist_remove
        rfTr�r�r�r��Editrpr{)rlrqrIr��Add)rlrIr��Removery)rpr�rqrr)rpr�rrr�r�r�N)r!rr
�helplistr*r�r�r��help_source_selectedr#�helplist_item_edit�button_helplist_edit�helplist_item_add�button_helplist_add�helplist_item_remove�button_helplist_remover�rr	rrr
rrr)r`�frame_helplist�scroll_helplist�
frame_buttonss    rcr0zHelpFrame.create_frame_help*s���*�t�����q�D� %�'��
�$�N�3��%)�]�]�%8�%8��	�"�*9�*=�*=��
�
�&�'��
�
���.��0I�0I�J��d��
�$*��F�*���!8�!8�%:��!�$*��E���!7�!7�$9�� �'-��H�J���!:�!:�'<��#�
	����A�A�d���N��
�
����Q�t�$��G����%����:�����A�A�A��>��!�!�&�&�C���&�B�� � �%�%�3�q�%�9��#�#�(�(�c�!�!�(�Drdc�$�|j�y)z+Handle event for selecting additional help.N)�set_add_delete_staterVs  rcr8zHelpFrame.help_source_selected\r�rdc��|jj�dkr7|jjd�|jjd�y|jj�r7|jjd�|jjd�y|jjd�|jjd�y)zAToggle the state for the help list buttons based on list entries.r�r�r�N)r7�sizer:rqr>rbr�s rcrCzHelpFrame.set_add_delete_state`s����=�=����!�#��%�%�+�+�M�:��'�'�-�-�m�<��}�}�)�)�+��)�)�/�/��?��+�+�1�1�.�A��)�)�/�/�
�>��+�+�1�1�-�@rdc���t|d�j}|rO|jj|�|jjt|d�|j�yy)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)r6r��
user_helplistrr7r�r�update_help_changes)r`�help_sources  rcr;zHelpFrame.helplist_item_addmsW��!��'8�9�@�@������%�%�k�2��M�M� � ��k�!�n�5��$�$�&�rdc��|jjt�}|j|}t	|d|d|d��j
}|rp||k7rj||j|<|jj
|�|jj||d�|j�|j�yyy)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�)�menuitem�filepathN)
r7rrrGr6r�rHr�rHrC)r`�
item_indexrI�new_help_sources    rcr9zHelpFrame.helplist_item_editys����]�]�(�(��0�
��(�(��4��$��(�$�Q��$�Q����&�		�
��+�=�-<�D���z�*��M�M� � ��,��M�M� � ��_�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_remove�sP��
�]�]�(�(��0�
����z�*��
�
���Z�(�� � �"��!�!�#rdc���itdd<tdt|j�dz�D]E}tj	ddt|�dj
|j|dz
dd���Gy)z2Clear and rebuild the HelpFiles section in changesr�	HelpFilesr��;Nr�)r�r�r�rGr-r�rZ)r`�nums  rcrHzHelpFrame.update_help_changes�sl��')�����$���C�� 2� 2�3�a�7�8�C�����K��S���H�H�T�/�/��A��6�r��:�;�
=�9rdc��tj�|_|jj	dd�|jD]%}|jjt|d��'|j�y)Nrr�)r0�GetAllExtraHelpSourcesListrGr7rHr�rrC)r`�	help_items  rcr1zHelpFrame.load_helplist�s[��%�@�@�B����
�
���Q��&��+�+�I��M�M� � ��i��l�3�,��!�!�#rd)
r�r�r�rKr0r8rCr;r9r=rHr1r�r�s@rcr�r�#s3����
0E�d$�A�
'�(�(	$�=�$rdr�c�>�eZdZdZd�Zd�Zd�Zed��Zd�Z	d�Z
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)�untraced�tracedr�s rcrKzVarTrace.__init__�s����
���rdc�l�|jj�|jj�y)zClear lists (for tests).N)rZr�r[r�s rcr�zVarTrace.clear�s$��	
�
�
���������rdc��t|t�r|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.
        )�
isinstance�tuple�
make_callbackrZr�r`r
�callbacks   rcr�zVarTrace.add�s;���h��&��)�)�#�x�8�H��
�
���c�8�_�-��
rdc������fd�}|S)zCReturn default callback function to add values to changes instance.c�P��tjg���j����y)z&Add config values to changes instance.N)r�r-r�)r/r�r
s ��rc�default_callbackz0VarTrace.make_callback.<locals>.default_callback�s������2��2����	�2rdr[)r
r�res`` rcr`zVarTrace.make_callback�s���	3� �rdc���|jrZ|jj�\}}|jd|�|jj	||f�|jr�Yyy)z0Attach callback to all vars that are not traced.�writeN)rZ�pop�	trace_addr[rras   rcr\zVarTrace.attach�sL���m�m� �M�M�-�-�/�M�C���M�M�'�8�,��K�K����X��/��m�mrdc��|jrn|jj�\}}|jd|j�dd�|jj||f�|jr�myy)z!Remove callback from traced vars.rgrr�N)r[rh�trace_remove�
trace_inforZrras   rc�detachzVarTrace.detach�s]���k�k� �K�K�O�O�-�M�C�����W�c�n�n�&6�q�&9�!�&<�=��M�M� � �#�x��1��k�krdN)r�r�r�r�rKr�r�rkr`r\rmr[rdrcrXrX�s2��,�
���"� �� �0�2rdrXa7When 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-r�rnc�@�|sy	t|�y#t$rYywxYw)z(Return 's is blank or represents an int'TF)r�r#)r)s rcr�r�-	s)������A��������s��	�c��eZdZdZd�Zy)rz�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
    c�H���	�tj||g|��i|��t|t��}|j	t
tt��t|dd|jd����j	ttt��|j�j���jd��j!d�t��x|_��j%dd�t&���	��fd	�}�j)d
|����	fd�}�j)d
|�y)Nr)rrrprqr��)r�rXr�rIrr�)�windowr�c�p���j��j�f}�jd|z��y)Nz	0 0 %s %s)�scrollregion)�winfo_reqwidth�winfo_reqheightr�)r5rE�canvasr s  ��rc�_configure_interiorz;VerticalScrolledFrame.__init__.<locals>._configure_interiorT	s2����+�+�-�x�/G�/G�/I�J�D��M�M�{�T�'9�M�:rdz<Configure>c����j��j�k7r"�j��j���yy)N)rI)ru�winfo_width�
itemconfigure)r5rwr �interior_ids ���rc�_configure_canvasz9VerticalScrolledFrame.__init__.<locals>._configure_canvasZ	s?����&�&�(�F�,>�,>�,@�@��$�$�[��8J�8J�8L�$�M�Ard)r!rKr*rr�rr
r
rr�rrr	r�r��xview_moveto�yview_movetor �
create_windowrr�)
r`rLr��kw�
vscrollbarrxr}rwr r|s
       @@@rcrKzVerticalScrolledFrame.__init__?	s����
���t�V�1�d�1�b�1��t�H�5�
����Q�U�5��9���!��'1�~�~�S�B������D���6����&�,�,��/�	���A�����A��$)��=�0��
���*�*�1�a���*�L��	;�	�
�
�m�%8�9�	N�	���M�#4�5�rdN)r�r�r�r�rKr[rdrcrr8	s���!rdr�__main__)rz#idlelib.idle_test.test_configdialogr�F)�	verbosity�exit)�run)cr�r~�tkinterrrrrrrr	r
rrr
rrrrrrrrrrrrrrrrrrr �tkinter.ttkr!r"r#r$r%r&r'r(r)r*r+r,r-r.�tkinter.fontr(rr/�idlelib.configr0r1�idlelib.config_keyr2�idlelib.dynoptionr3�idlelibr4�
idlelib.queryr5r6�idlelib.textviewr7�idlelib.autocompleter8�idlelib.codecontextr9�idlelib.parenmatchr:�idlelib.formatr;�idlelib.squeezerr<r=r�r�r?r�r{ryr|r~r�rwr�rXr[r�r�r�rr��unittestr�idlelib.idle_test.htestr�r[rdrc�<module>r�s���
�
�J�J�J�J�J�J�J�J�
,�,�,�,�!���2�,�+��1�&�-�+�)�*�%�0�
�/���[�*�o����{�8�{�^E��<g1�u�g1�TQ
�u�Q
�ho�u�o�d
OK�e�OK�dBF�u�BF�J@$�e�@$�FC$�
�C$�L:2�:2�z�*�����"�
��*�g;�
�|�(�E�(�V�z����	.�!�%�H�+����rd

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists