
    G@dY<                         d Z ddlmZmZmZmZmZmZmZ ddl	m
Z
 ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ d	Zd
Z ej        dd          Z G d dee          ZdS )zEditor config page.    )QGridLayout	QGroupBoxQHBoxLayoutQLabel
QTabWidgetQVBoxLayoutQWidget)on_conf_change)SpyderConfigurationObserver)PluginConfigPage_)CONF)imaz5https://numpydoc.readthedocs.io/en/latest/format.htmlzKhttps://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html	shortcutszeditor/docstringc                   R    e Zd Zd Zd Zd Zd Z edd          d             Zd	S )
EditorConfigPagec                     t          j        | ||           t          j        |            d | _        d | _        d | _        d S )N)r   __init__r   removetrail_boxadd_newline_boxremove_trail_newline_box)selfpluginparents      >lib/python3.11/site-packages/spyder/plugins/editor/confpage.pyr   zEditorConfigPage.__init__   sF    !$777#,T222##(,%%%    c                      t          d          S )NEditorr   r   s    r   get_namezEditorConfigPage.get_name!   s    {{r   c                 *    t          j        d          S )Nedit)r   iconr    s    r   get_iconzEditorConfigPage.get_icon$   s    xr   c                 0  > | j         } |t          d          d          } |t          d          d          } |t          d          d          } |t          d          d          } |t          d	          d
          } |t          d          d          } |t          d          d          } |t          d          d          }	 |t          d          d          }
 |t          d          d          } |t          d          d          }|                     dt          d          dddd          }|j                            |j        j                   |j                            |j        j                   |j                            |                     d                     |j                            |                     d                     t                      }|
                    |dd           |
                    |j        dd           |
                    |j        dd           t                      }|                    |           |                    d           t                      }|
                    |           |
                    |           |
                    |           |
                    |           |
                    |           |
                    |           |
                    |           |
                    |	           |
                    |
           |
                    |           |                    |           t                      }|                    |            |t          d           d!          } |t          d"          d#          } |t          d$          d%          } |t          d&          d'          } |t          d(          d)d*t          d+          ,          } |t          d-          d.d/t          d0          ,          } |t          d1          d2d/3          } |t          d4          d5d*3          | _         |t          d6          d7d*3          | _         |t          d8          d9d*3          | _        |                     t          d:          t          d;          d<ft          d=          d>ft          d?          d@ft          dA          dBft          dC          dDft          dE          dFft          dG          dHft          dI          dJffdK          }|                     t          dL          t          dM          dNdOddPdQ          >t+          j        dRdSd*          }|                     |           >fdT}|j        j                            |           t                      }|
                    |j        dd           |
                    |j        dd           |
                    >j        dd           |
                    >j        dd           |
                    >j        dd           t                      }|                    |           |                    d           t                      }|
                    |           |
                    |           |
                    |           |
                    |           |
                    |           |
                    |           |
                    | j                   |
                    | j                   |
                    | j                   |
                    |           |                    |           t                      }|                    |            |t          dU          dV          }  |t          dW          dX          }! |t          dY          dZ          }"t                      }#|#
                    |            |#
                    |!           |#
                    |"           t                      }$|$                    |#           |                     t          d[          | j        j                  }%t?          t          d\                    }& |t          d]          d^          }'|                     t          d_          t          d`          daddbc          }(|'j                            |(j                   t                      })|)
                    |'           |)
                    |(           |&                    |)           t?          t          dd                    }*de                     tB                    }+df                     tD                    },tG          t          dg                               |+|,tH                              }-|-%                    d/           |-&                    d/           t          dh          dift          dj          dkft          dl          dmff}.|                     t          dn          |.do          }/t                      }0|0
                    |-           |0
                    |/           |*                    |0           t?          t          dp                    }1tG          t          dq                    }2|2&                    d/            |t          dr          ds          }3t                      }4|4
                    |2           |4
                    |3           |1                    |4           t?          t          dt                    }5tG          t          du                    }6|6&                    d/            |t          dv          dwd/3          }7 |t          dx          dyd*3          }8t          dz          d{ft          d|          d}ft          d~          dff}9|                     d|9d          }:|8j                            |:j                   |:                    |                     dy                     t                      };|;
                    |8           |;
                    |:           t                      }<|<
                    |6           |<
                    |7           |<                    |;           |5                    |<           tO                      | _(        | j(        )                    | *                    |          t          d                     | j(        )                    | *                    |          t          d                     | j(        )                    | *                    |$          t          d                     | j(        )                    | *                    |%|&|*|1|5          t          d                     t                      }=|=
                    | j(                   |                     |=           d S )NzShow tab barshow_tab_barz'Show selector for classes and functionsshow_class_func_dropdownzShow indent guidesindent_guideszShow code foldingcode_foldingzShow line numbersline_numberszShow blank spacesblank_spaceszHighlight current linehighlight_current_linezHighlight current cellhighlight_current_cellz
Wrap lineswrapzScroll past the endscroll_past_endzHighlight occurrences afteroccurrence_highlighting z mszoccurrence_highlighting/timeoutd   i@B )min_max_stepr         z7Automatic insertion of parentheses, braces and bracketsclose_parenthesesz%Automatic insertion of closing quotesclose_quotesz;Automatic insertion of colons after 'for', 'if', 'def', etc
add_colonsz0Automatic indentation after 'else', 'elif', etc.auto_unindentzTab always indenttab_always_indentFzIf enabled, pressing Tab will always indent,
even when the cursor is not at the beginning
of a line (when this option is enabled, code
completion may be triggered using the alternate
shortcut: Ctrl+Space))defaulttipz4Automatically strip trailing spaces on changed linesstrip_trailing_spaces_on_modifyTzIf enabled, modified lines of code (excluding strings)
will have their trailing whitespace stripped when leaving them.
If disabled, only whitespace added by Spyder will be stripped.zIntelligent backspaceintelligent_backspace)r>   z6Automatically remove trailing spaces when saving filesalways_remove_trailing_spaceszDInsert a newline at the end if one does not exist when saving a fileadd_newlinez8Trim all newlines after the final one when saving a filealways_remove_trailing_newlineszIndentation characters: z2 spacesz*  *z3 spacesz*   *z4 spacesz*    *z5 spacesz*     *z6 spacesz*      *z7 spacesz	*       *z8 spacesz
*        *Tabulationsz*	*indent_charszTab stop width:spacestab_stop_width_spaces      )r>   r4   r5   r6   completionsprovider_configurationlspvaluesformat_on_savec                     | dk    r6j                             d           j                            d           d S j                             d           j                            d           d S )N   TF)plabel
setEnabledspinbox)indextabwidth_spins    r   enable_tabwidth_spinz9EditorConfigPage.setup_page.<locals>.enable_tabwidth_spin   st    zz$//555%0066666$//666%0077777r   z$Save all files before running scriptsave_all_before_runz<Maintain focus in the editor after running or debugging codefocus_to_editorz>Copy full cell contents to the console when running code cellsrun_cell_copyzEdit template for new filesAutosavez7Automatically save a copy of files with unsaved changesautosave_enabledzAutosave interval: secondsautosave_intervali  )r4   r5   zDocstring typez<a href='{}'>Numpy</a>z<a href='{}'>Google</a>zHere you can select the type of docstrings ({} or {}) you want the editor to automatically introduce when pressing <tt>{}</tt> after a function/method/class declaration.NumpyNumpydocGoogle	GoogledocSphinx	SphinxdoczType:docstring_typeAnnotationszDisplay a marker to the left of line numbers when the following annotations appear at the beginning of a comment: <tt>TODO, FIXME, XXX, HINT, TIP, @todo, HACK, BUG, OPTIMIZE, !!!, ???</tt>zDisplay code annotations	todo_listzEnd-of-line characterszWhen opening a text file containing mixed end-of-line characters (this may raise syntax errors in the consoles on Windows platforms), Spyder may fix the file automatically.z.Fix automatically and show warning message boxcheck_eol_charsz8Convert end-of-line characters to the following on save:convert_eol_on_savez	LF (Unix)LFzCRLF (Windows)CRLFz
CR (macOS)CRconvert_eol_on_save_toDisplayzSource codezRun codezAdvanced settings)+create_checkboxr   create_spinboxtoggledconnectrU   rT   slabel
get_optionr   	addWidgetr   	addLayout
addStretchr   r	   	setLayoutr   r   r   create_comboboxr   geton_format_save_statecomboboxcurrentIndexChangedlabelrS   create_buttonr   edit_templater   formatNUMPYDOC	GOOGLEDOCr   DOCSTRING_SHORTCUTsetOpenExternalLinkssetWordWrapr   tabsaddTab
create_tab)?r   newcbshowtabbar_boxshowclassfuncdropdown_boxshowindentguides_boxshowcodefolding_boxlinenumbers_box
blanks_boxcurrentline_boxcurrentcell_boxwrap_mode_boxscroll_past_end_boxoccurrence_boxoccurrence_spindisplay_g_layoutdisplay_h_layoutdisplay_layoutdisplay_widgetclosepar_boxclose_quotes_boxadd_colons_boxautounindent_boxtab_mode_boxstrip_mode_boxibackspace_boxindent_chars_boxrP   rX   indent_tab_grid_layoutindent_tab_layoutsourcecode_layoutsourcecode_widgetsaveall_box	focus_boxrun_cell_box
run_layout
run_widgettemplate_btnautosave_groupautosave_checkboxautosave_spinboxautosave_layoutdocstring_group	numpy_urlgoogledoc_urldocstring_labeldocstring_combo_choicesdocstring_combodocstring_layoutannotations_groupannotations_labeltodolist_boxannotations_layout	eol_group	eol_labelcheck_eol_boxconvert_eol_on_save_boxeol_combo_choicesconvert_eol_on_save_comboeol_on_save_layout
eol_layoutvlayoutrW   s?                                                                 @r   
setup_pagezEditorConfigPage.setup_page'   s8   $ q00.AA$)E;<<*%, %,!  %uQ';%<%<%4 6  6#eA&9$:$:NKK%"5 6 6GGU1011>BB
%": ; ; 8: :%": ; ; 8: :aoov66#eA&;$<$<$57 7 q!>??8: :--%-7 . . . 	&&'>'IJJJ&&'='HIII** 9::	< 	< 	<)) 9::	< 	< 	< '=="">1a888""?#:AqAAA""?#91a@@@&==""#3444##A&&&$  000  !:;;;  !5666  !4555  111  ,,,  111  111  ///  !4555  !1222   000 uGHH! ! !5566  KLL  !5@AA  u!"" * + +, , , DEE-t S T TU U U %&&#    %uFGG+       %u   	     
 ).HII-) ) )%
  //())
mmV$
mmW%
mmX&
mmY'
mmZ(
mm[)
mm\*') 
 
 ++  hKK#AAA	 , / / I
 

 	!!.111	8 	8 	8 	8 	8 	!5== 	" 	" 	" "-(()9)?AFFF(()9)BAqIII(()=q!DDD(()>1EEE(()=q!DDD'MM##$:;;;$$Q''''MM##L111##$4555##N333##$4555##L111##N333##D$8999##D$8999##D$ABBB##N333##$5666#II##$5666 eADEE13 3ELMM
 
	 uQ  4 5 56EG G !]]
[)))Y'''\***YY
Z((( ))!,I*J*J*.+*CE E #1Z==11!EGHH     ..#$$iLL	 /  
 	!))*:*EFFF%--!!"3444!!"2333  111 $A&6$7$788,33H==	188CC     %f],>@ @	A A 	,,T222##D)))$%gJJ
#;$%hKK#=$%hKK#=#@ ..gJJ# 
 '==""?333""?333!!"2333 &a&6&677"      
 	%%d+++u())  )]]$$%6777$$\222##$6777 a 899::	1 3 4 4 5 5	
 	d###a !. / //? ? ? #(%HII!#
 #
 #
 {^^T"  &)|__d#

 %)$8$8$%
 %
!
 	 '//)4	6 	6 	6!,, 566	8 	8 	8 )]]$$%<===$$%>??? ]]
Y''']+++/000J''' LL		88!I,,GGG	):;;Q}=M=MNNN	44a
mmDDD	~)8:K)24 4 .//	1 	1 	1
 --$)$$$wr   rL   rK   )optionsectionc                     | j         | j        | j        g}|D ]S}|rO|r#|                    t	          d                     n|                    d           |                    |           TdS )a  
        Change options following the `format_on_save` completion option.

        Parameters
        ----------
        value : bool
            If the completion `format_on_save` option is enabled or disabled.

        Returns
        -------
        None.

        zSThis option is disabled since the <i>Autoformat files on save</i> option is active.r2   N)r   r   r   
setToolTipr   setDisabled)r   valueoptionsr   s       r   r|   z%EditorConfigPage.on_format_save_stateX  s    &   )+  		* 		*F * *%% N O O   
 %%b)))""5)))		* 		*r   N)	__name__
__module____qualname__r   r!   r%   r   r
   r|    r   r   r   r      s        - - -       o  o  o b	 ^L  * *	 * * *r   r   N)__doc__qtpy.QtWidgetsr   r   r   r   r   r   r	   spyder.api.config.decoratorsr
   spyder.api.config.mixinsr   spyder.api.preferencesr   spyder.config.baser   spyder.config.managerr   spyder.utils.icon_managerr   r   r   r{   r   r   r   r   r   <module>r      s9    > > > > > > > > > > > > > > > > > > 8 7 7 7 7 7 @ @ @ @ @ @ 3 3 3 3 3 3             & & & & & & ) ) ) ) ) ) CY	TXk+=>> ^* ^* ^* ^* ^*')D ^* ^* ^* ^* ^*r   