
    Je*=                         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dZ ej0                  dd      Z G d dee      Zy)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.htmlzDhttps://sphinx-rtd-tutorial.readthedocs.io/en/latest/docstrings.html	shortcutszeditor/docstringc                   D    e Zd Zd Zd Zd Zd Z edd      d        Zy	)
EditorConfigPagec                     t        j                  | ||       t        j                  |        d | _        d | _        d | _        y )N)r   __init__r   removetrail_boxadd_newline_boxremove_trail_newline_box)selfpluginparents      @/usr/lib/python3/dist-packages/spyder/plugins/editor/confpage.pyr   zEditorConfigPage.__init__    s:    !!$7#,,T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    xxr   c                 ^  ? | 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      }| j                  dt        d      dddd      }|j                  j	                  |j
                  j                         |j                  j	                  |j                  j                         |j
                  j                  | j                  d             |j                  j                  | j                  d             t               }|j                  |dd       |j                  |j
                  dd       |j                  |j                  dd       t               }|j                  |       |j                  d       t               }|j                  |       |j                  |       |j                  |       |j                  |       |j                  |       |j                  |       |j                  |       |j                  |	       |j                  |
       |j                  |       |j                  |       t               }|j!                  |        |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      | _        | j)                  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      }| j                  t        dL      t        dM      dNdOddPdQ      ?t+        j,                  dRdSd*      }| j/                  |       ?fdT}|j0                  j2                  j	                  |       t               }|j                  |j4                  dd       |j                  |j0                  dd       |j                  ?j6                  dd       |j                  ?j
                  dd       |j                  ?j                  dd       t               }|j                  |       |j                  d       t               }|j                  |       |j                  |       |j                  |       |j                  |       |j                  |       |j                  |       |j                  | j"                         |j                  | j$                         |j                  | j&                         |j                  |       |j                  |       t               }|j!                  |        |t        dU      dV      }  |t        dW      dX      }! |t        dY      dZ      }"t               }#|#j                  |        |#j                  |!       |#j                  |"       t               }$|$j!                  |#       | j9                  t        d[      | j:                  j<                        }%t?        t        d\            }& |t        d]      d^      }'| j                  t        d_      t        d`      daddbc      }(|'j                  j	                  |(j                         t               })|)j                  |'       |)j                  |(       |&j!                  |)       t?        t        dd            }*dejA                  tB              }+dfjA                  tD              },dgjA                  tF              }-tI        t        dh      jA                  |+|,|-tJ                    }.|.jM                  d/       |.jO                  d/       t        di      djft        dk      dlft        dm      dnff}/| j)                  t        do      |/dp      }0t               }1|1j                  |.       |1j                  |0       |*j!                  |1       t?        t        dq            }2tI        t        dr            }3|3jO                  d/        |t        ds      dt      }4t               }5|5j                  |3       |5j                  |4       |2j!                  |5       t?        t        du            }6tI        t        dv            }7|7jO                  d/        |t        dw      dxd/3      }8 |t        dy      dzd*3      }9t        d{      d|ft        d}      d~ft        d      dff}:| j)                  d|:d      };|9j                  j	                  |;j                         |;j                  | j                  dz             t               }<|<j                  |9       |<j                  |;       t               }=|=j                  |7       |=j                  |8       |=j                  |<       |6j!                  |=       tQ               | _)        | jR                  jU                  | jW                  |      t        d             | jR                  jU                  | jW                  |      t        d             | jR                  jU                  | jW                  |$      t        d             | jR                  jU                  | jW                  |%|&|*|2|6      t        d             t               }>|>j                  | jR                         | j!                  |>       y )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(  r7j                   j                  d       j                  j                  d       y j                   j                  d       j                  j                  d       y )N   TF)plabel
setEnabledspinbox)indextabwidth_spins    r   enable_tabwidth_spinz9EditorConfigPage.setup_page.<locals>.enable_tabwidth_spin   sZ    z$$//5%%006$$//6%%00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>z<a href='{}'>Sphinx</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 or 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	GOOGLEDOC	SPHINXDOCr   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
sphinx_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-   s   $$ q0.A$);<*%,!  %Q';%<%4 6#A&9$:NK"5 6G101>B
": ; 8:": ; 8:aov6#A&;$<$57 q!>?8:--%-7 . . 	&&'>'>'I'IJ&&'='='H'HI** 9:	<)) 9:	< '="">1a8""?#:#:AqA""?#9#91a@&=""#34##A&$  0  !:;  !56  !45  1  ,  1  1  /  !45  !12   0 GH! !56 KL !@A !" * +, DE-t S TU %&#  %FG+   %  	 
 ).HI-)%
  //()
mV$
mW%
mX&
mY'
mZ(
m[)
m\*') 
 ++ hK#AAA	 , / I

 	!!.1	8 	!!55== 	" "-(()9)?)?AF(()9)B)BAqI(()=)=q!D(()>)>1E(()=)=q!D'M##$:;$$Q''M##L1##$45##N3##$45##L1##N3##D$8$89##D$8$89##D$A$AB##N3##$56#I##$56 ADE13LM
	 Q  4 56EG !]
[)Y'\*Y
Z( ))!,I*J*.++*C*CE #1Z=1!GH   ..#$iL	 / 
 	!!))*:*E*EF%-!!"34!!"23  1 $A&6$78,33H=	188C.55i@
    %f]J8JL	
 	,,T2##D)$%gJ
#;$%hK#=$%hK#=#@ ..gJ#
 '=""?3""?3!!"23 &a&67"   
 	%%d+() )]$$%67$$\2##$67 a 89:	1 3 4 5	
 	d#a !. //? #(HI!#
 {^T" &)|_d#

 %)$8$8$%
!
 	 ''//)44	6!,, 56	8 )]$$%<=$$%>? ]
Y']+/0J' L			8!I,G		):;Q}=MN		4a
mD		~)8:K)24 ./	1
 -$))$wr   rL   rK   )optionsectionc                     | j                   | j                  | j                  g}|D ]D  }|s|r|j                  t	        d             n|j                  d       |j                  |       F y)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_statea  sx    &     ))+  		*F%% N O
 %%b)""5)		*r   N)	__name__
__module____qualname__r   r!   r%   r   r
   r|    r   r   r   r      s7    - r h	 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   r   <module>r      sr    > > > 8 @ 3   & ) C 

 K 
 TXXk+=> a*')D a*r   