B
    nôb\÷ó ã               @   s^  d Z ddlZddlmZ ddlZddlZddlmZm	Z	 ddl
mZmZmZ ddlmZmZmZmZ ddlmZ ddlmZmZmZ ddl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&m'Z'm(Z(m)Z) dd	l*m+Z+ dd
l,m-Z-m.Z.m/Z/ ddl0m1Z1m2Z2m3Z3 ddl4m5Z5m6Z6m7Z7 ddl8m9Z9m:Z:m;Z; ddl<m=Z=m>Z>m?Z?m@Z@ ddl<mAZB ddlCmDZD ddlEmFZFmGZGmHZH ddlImJZJ ddlKmLZL ddlMmNZNmOZOmPZPmQZQ ddlRmSZS ddlTmUZUmVZVmWZWmXZX ddlYmZZZ ddl[m\Z\ ddl]m^Z^m_Z_m`Z`maZa dZbe+jcde-dƒebd dd„ Zdd d!„ Zed"d#„ Zfd$d%„ Zgd&d'„ Zhe? id(¡ZjG d)d*„ d*e\ƒZkG d+d,„ d,eZƒZldS )-zEditor Pluginé    N)ÚAPIÚPYQT5)Úfrom_qvariantÚgetopenfilenamesÚto_qvariant)Ú
QByteArrayÚQtÚSignalÚSlot)ÚQKeySequence)ÚQAbstractPrintDialogÚQPrintDialogÚQPrinter)ÚQActionÚQActionGroupÚQApplicationÚQDialogÚQFileDialogÚQGridLayoutÚ	QGroupBoxÚQHBoxLayoutÚQInputDialogÚQLabelÚQMenuÚ	QSplitterÚ
QTabWidgetÚQToolBarÚQVBoxLayoutÚQWidget)Údependencies)Ú_Úget_conf_pathÚrunning_under_pytest)ÚCONFÚRUN_CELL_SHORTCUTÚRUN_CELL_AND_ADVANCE_SHORTCUT)Úget_edit_filetypesÚget_edit_filtersÚ
get_filter)ÚPY2Úqbytearray_to_strÚto_text_string)ÚcodeanalysisÚencodingÚprogramsÚ
sourcecode)Úicon_manager)ÚIntrospectionManager)Úcreate_actionÚadd_actionsÚMENU_SEPARATOR)Úgetcwd_or_home)ÚFindReplace)ÚEditorMainWindowÚEditorSplitterÚEditorStackÚPrinter)Ú
CodeEditor)ÚCursorPositionStatusÚEncodingStatusÚ	EOLStatusÚReadWriteStatus)ÚSpyderPluginWidget)ÚPluginConfigPage)ÚALWAYS_OPEN_FIRST_RUN_OPTIONÚget_run_configurationÚRunConfigDialogÚRunConfigOneDialogz>=4.0Z	nbconvertz*Manipulate Jupyter notebooks on the Editor)Zrequired_versionc              C   s<   t  ddi ¡} x(t|  ¡ ƒD ]}t |¡s|  |¡ qW | S )NÚrunÚbreakpoints)r#   ÚgetÚlistÚkeysÚospÚisfileÚpop)Úbp_dictÚfilename© rP   ú4lib/python3.7/site-packages/spyder/plugins/editor.pyÚ_load_all_breakpoints?   s
    
rR   c             C   s2   t ƒ  | g ¡}|r.t|d tƒr.dd„ |D ƒ}|S )Nr   c             S   s   g | ]}|d f‘qS )NrP   )Ú.0ÚlinenorP   rP   rQ   ú
<listcomp>K   s    z$load_breakpoints.<locals>.<listcomp>)rR   rH   Ú
isinstanceÚint)rO   rG   rP   rP   rQ   Úload_breakpointsG   s    rX   c             C   s.   t  | ¡sd S tƒ }||| < t dd|¡ d S )NrF   rG   )rK   rL   rR   r#   Úset)rO   rG   rN   rP   rP   rQ   Úsave_breakpointsO   s
    
rZ   c               C   s   t  ddi ¡ d S )NrF   rG   )r#   rY   rP   rP   rP   rQ   Úclear_all_breakpointsW   s    r[   c             C   sF   t | ƒ}|rBx*|d d … D ]}|d |kr| |¡ qW t| |ƒ d S )Nr   )rX   ÚremoverZ   )rO   rT   rG   Ú
breakpointrP   rP   rQ   Úclear_breakpoint[   s    r^   Zwinpdbc               @   s$   e Zd Zdd„ Zdd„ Zdd„ ZdS )ÚEditorConfigPagec             C   s   t dƒS )NÚEditor)r    )ÚselfrP   rP   rQ   Úget_nameh   s    zEditorConfigPage.get_namec             C   s
   t  d¡S )NÚedit)ÚimaÚicon)ra   rP   rP   rQ   Úget_iconk   s    zEditorConfigPage.get_iconc       B         s˜  |   tdƒ| jj¡}ttdƒƒ}| j}|tdƒdƒ}tƒ }| |¡ | |¡ tt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ƒ}|tdƒdƒ}|tdƒdƒ}| j	dtdƒddddd}|j
 |jj¡ |j
 |jj¡ |j |  d¡¡ |j |  d¡¡ |tdƒdƒ}tƒ }| |dd¡ | |dd¡ | |	d d¡ | |
jd d¡ | |
jd d ¡ | |d!d¡ | |d"d¡ | |d#d¡ | |jd#d¡ | |jd#d ¡ | |d$d¡ tƒ }| |¡ | d¡ | |¡ ttd%ƒƒ}|td&ƒd'ƒ}ttd(ƒƒ}|td)ƒd*ƒ}ttd+ƒƒ}t d,¡}|râ|td-ƒd.ƒ}|td/ƒd0ƒ}|td1ƒd2ƒ}|td3ƒd4ƒ}|td5ƒd6td7ƒd8}nttd9ƒƒ}| d:¡ ttdƒƒ}|td;ƒd<ƒ}|td=ƒd>ƒ} |td?ƒd@ƒ}!|tdAƒdBƒ}"|  tdCƒtdDƒdEftdFƒdGftdHƒdIftdJƒdKftdLƒdMftdNƒdOftdPƒdQftdRƒdSffdT¡}#|  	tdUƒtdVƒdWd"ddXd¡‰ ‡ fdYdZ„}$|#jj |$¡ |td[ƒd\d]td^ƒd_}%|td`ƒdad:db}&|tdcƒddd]db}'ttdeƒƒ}(df})ttdgƒ |)¡ƒ}*|* d:¡ t ¡ }+t dh¡d k	},|tdiƒdjd:tdkƒd_}-|- |+¡ |+s|-  tdlƒtj! ¡ |tdmƒdnd]tdoƒd_}.|. |,¡ |tdpƒdqd:db}/|  "tdrƒdsd:¡}0|  "tdtƒdu¡}1| j	dtdƒdvdddd}2tƒ }3|3 |0¡ |3 |2¡ tƒ }4|4 |¡ | |4¡ tƒ }5|5 |¡ | |5¡ tƒ }6|rŽ|6 |¡ |6 |¡ |6 |¡ |6 |¡ |6 |¡ n
|6 |¡ | |6¡ tƒ }7|7 |-¡ tƒ }8|8 |.¡ |8 |*¡ |7 |8¡ |7 |/¡ |7 |3¡ |7 |1¡ |( |7¡ tƒ }9|9 |¡ |9 |"¡ |9 |!¡ |9 | ¡ tƒ }:tƒ };|; |#j#dd¡ |; |#jdd¡ |; ˆ j$dd¡ |; ˆ jdd¡ |; ˆ jdd ¡ |: |;¡ |: d¡ |9 |:¡ |9 |%¡ |9 |&¡ |9 |'¡ | |9¡ ttdwƒƒ}<ttdxƒƒ}=|= d:¡ |tdyƒdzd:db}>tƒ }?|? |=¡ |? |>¡ |< |?¡ t%ƒ }@|@ &|  '||¡td{ƒ¡ |@ &|  '||(¡td|ƒ¡ |@ &|  '|||||<¡td}ƒ¡ tƒ }A|A |@¡ |  |A¡ d S )~NzEdit template for new modulesZ	InterfacezShow tab barÚshow_tab_barzSource codezShow line numbersÚline_numberszShow blank spacesÚblank_spaceszShow vertical line afterÚ	edge_lineÚ Z
charactersÚedge_line_columnéO   é   iô  zHighlight current lineÚhighlight_current_linezHighlight current cellÚhighlight_current_cellzHighlight occurrences afterÚoccurrence_highlightingz mszoccurrence_highlighting/timeoutéd   i@B )Zmin_Zmax_Ústepz
Wrap linesÚwrapr   é   é   é   é   é   ÚRunz$Save all files before running scriptÚsave_all_before_runzRun selectionz>Maintain focus in the Editor after running cells or selectionsÚfocus_to_editorZIntrospectionZropezAutomatic code completionzcodecompletion/autozCase sensitive code completionzcodecompletion/case_sensitivezEnter key selects completionzcodecompletion/enter_keyzDisplay balloon tipsÚcalltipszLink to object definitionÚgo_to_definitionz{If this option is enabled, clicking on an object
name (left-click + Ctrl key) will go this object
definition (if resolved).)ÚtipzŸ<b>Warning:</b><br>The Python module <i>rope</i> is not installed on this computer: calltips, code completion and go-to-definition features won't be available.Tz7Automatic 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Indentation characters: z2 spacesz*  *z3 spacesz*   *z4 spacesz*    *z5 spacesz*     *z6 spacesz*      *z7 spacesz	*       *z8 spacesz
*        *ZTabulationsz*	*Úindent_charszTab stop width:ZspacesÚtab_stop_width_spacesé   c                s>   | dkr"ˆ j  d¡ ˆ j d¡ nˆ j  d¡ ˆ j d¡ d S )Né   TF)ÚplabelÚ
setEnabledÚspinbox)Úindex)Útabwidth_spinrP   rQ   Úenable_tabwidth_spinÝ   s
    z9EditorConfigPage.setup_page.<locals>.enable_tabwidth_spinzTab always indentÚtab_always_indentFzÌIf 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))Údefaultr   zIntelligent backspaceÚintelligent_backspace)r   z6Automatically remove trailing spaces when saving filesÚalways_remove_trailing_spacesZAnalysisz;<a href="https://www.python.org/dev/peps/pep-0008">PEP8</a>z<i>(Refer to the {} page)</i>ZpycodestylezReal-time code analysiszcode_analysis/pyflakeszÜ<p>If enabled, Python source code will be analyzed using pyflakes, lines containing errors or warnings will be highlighted.</p><p><u>Note</u>: add <b>analysis:ignore</b> in a comment to ignore code analysis warnings.</p>z#Code analysis requires pyflakes %s+zReal-time code style analysiszcode_analysis/pep8zê<p>If enabled, Python source code will be analyzed using pycodestyle, lines that are not following PEP8 style guide will be highlighted.</p><p><u>Note</u>: add <b>analysis:ignore</b> in a comment to ignore style analysis warnings.</p>zTCode annotations (TODO, FIXME, XXX, HINT, TIP, @todo, HACK, BUG, OPTIMIZE, !!!, ???)Ú	todo_listz+Perform analysis when saving file and everyÚrealtime_analysisz&Perform analysis only when saving fileZonsave_analysiszrealtime_analysis/timeoutzEnd-of-line charactersz¬When 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_charsZDisplayzCode Introspection/AnalysiszAdvanced settings)(Zcreate_buttonr    ZpluginÚedit_templater   Zcreate_checkboxr   Ú	addWidgetÚ	setLayoutZcreate_spinboxÚtoggledÚconnectrŠ   r‰   ZslabelÚ
get_optionr   r   Z	addLayoutZ
addStretchr.   Úis_module_installedr   ZsetWordWrapZcreate_comboboxZcomboboxZcurrentIndexChangedÚformatZsetOpenExternalLinksr,   Zis_pyflakes_installedZget_checker_executableZ
setToolTipZPYFLAKES_REQVERZcreate_radiobuttonZlabelrˆ   r   ZaddTabZ
create_tab)Bra   Ztemplate_btnZinterface_groupZnewcbZshowtabbar_boxZinterface_layoutZdisplay_groupZlinenumbers_boxZ
blanks_boxZedgeline_boxZedgeline_spinZcurrentline_boxZcurrentcell_boxZoccurrence_boxZoccurrence_spinZwrap_mode_boxZdisplay_layoutZdisplay_h_layoutZ	run_groupZsaveall_boxZrun_selection_groupZ	focus_boxZintrospection_groupZrope_is_installedZcompletion_boxZcase_comp_boxZcomp_enter_boxZcalltips_boxZgotodef_boxZ
rope_labelZsourcecode_groupZclosepar_boxZclose_quotes_boxZadd_colons_boxZautounindent_boxZindent_chars_boxr   Ztab_mode_boxZibackspace_boxZremovetrail_boxZanalysis_groupZpep_urlZ
pep8_labelZis_pyflakesZis_pep8Zpyflakes_boxZpep8_boxZtodolist_boxZrealtime_radioZsaveonly_radioZaf_spinZ	af_layoutZ
run_layoutZrun_selection_layoutZintrospection_layoutZanalysis_layoutZanalysis_pep_layoutZsourcecode_layoutZindent_tab_layoutZindent_tab_grid_layoutZ	eol_groupZ	eol_labelZcheck_eol_boxZ
eol_layoutÚtabsZvlayoutrP   )rŒ   rQ   Ú
setup_pagen   s†   

































































zEditorConfigPage.setup_pageN)Ú__name__Ú
__module__Ú__qualname__rb   rf   rž   rP   rP   rP   rQ   r_   g   s   r_   c            	   @   s(  e Zd ZdZdZeZedƒZedƒZ	dZ
eeeeeeeeƒZeeeƒZeeƒZeeƒZeƒ ZeeeeeeƒZeeƒZd	dd„Zdd	„ Zeƒ d
d„ ƒZdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Z d
dd„Z!dd„ Z"d d!„ Z#d"d#„ Z$d$d%„ Z%d&d'„ Z&dd)d*„Z'd+d,„ Z(d-d.„ Z)d/d0„ Z*d1d2„ Z+d3d4„ Z,eeeƒd5d6„ ƒZ-eeeeƒd7d8„ ƒZ.eeeeƒd9d:„ ƒZ/d;d<„ Z0d=d>„ Z1d?d@„ Z2dAdB„ Z3dCdD„ Z4dEdF„ Z5dGdH„ Z6ddIdJ„Z7dKdL„ Z8dMdN„ Z9dOdP„ Z:ddQdR„Z;ddSdT„Z<dUdV„ Z=dWdX„ Z>dYdZ„ Z?d[d\„ Z@d]d^„ ZAd_d`„ ZBdadb„ ZCdcdd„ ZDdedf„ ZEdgdh„ ZFdidj„ ZGdkdl„ ZHdmdn„ ZIdodp„ ZJdqdr„ ZKeƒ dsdt„ ƒZLdudv„ ZMdwdx„ ZNeƒ eeƒddydz„ƒƒZOd{d|„ ZPd}d~„ ZQeƒ dd€„ ƒZReƒ dd‚„ ƒZSeƒ eeƒeeeTeƒeeeTeeUƒdd…d†„ƒƒƒƒZVeƒ d‡dˆ„ ƒZWeƒ d‰dŠ„ ƒZXeƒ d‹dŒ„ ƒZYeƒ ddŽ„ ƒZZeƒ ddd„ƒZ[eƒ d‘d’„ ƒZ\eƒ d“d”„ ƒZ]eƒ d•d–„ ƒZ^eƒ d—d˜„ ƒZ_eƒ d™dš„ ƒZ`eƒ d›dœ„ ƒZaeƒ ddž„ ƒZbeƒ dŸd „ ƒZcd¡d¢„ Zdd£d¤„ Zed¥d¦„ Zfd§d¨„ Zgd©dª„ Zhd«d¬„ Zieƒ d­d®„ ƒZjeƒ d¯d°„ ƒZkeƒ d±d²„ ƒZleƒ d³d´„ ƒZmeƒ dµd¶„ ƒZneƒ d·d¸„ ƒZoeƒ d¹dº„ ƒZpeƒ d»d¼„ ƒZqeƒ d½d¾„ ƒZreƒ d¿dÀ„ ƒZseƒ dÁdÂ„ ƒZtdÃdÄ„ ZueeƒdÅdÆ„ ƒZveƒ dÇdÈ„ ƒZweƒ dÉdÊ„ ƒZxdËdÌ„ ZyddÍdÎ„ZzdÏdÐ„ Z{dÑdÒ„ Z|dÓdÔ„ Z}eƒ dÕdÖ„ ƒZ~d×dØ„ Zeƒ dÙdÚ„ ƒZ€eƒ dÛdÜ„ ƒZeƒ ddÝdÞ„ƒZ‚eƒ dßdà„ ƒZƒeƒ dádâ„ ƒZ„eƒ dãdä„ ƒZ…dådæ„ Z†dçdè„ Z‡eƒ dédê„ ƒZˆeƒ ddëdì„ƒZ‰dídî„ ZŠeƒ dïdð„ ƒZ‹eƒ dñdò„ ƒZŒeƒ dódô„ ƒZeƒ dõdö„ ƒZŽeƒ d÷dø„ ƒZeƒ dùdú„ ƒZdûdü„ Z‘dýdþ„ Z’dÿd „ Z“dd„ Z”dd„ Z•dd„ Z–dd„ Z—d(S (  r`   z"
    Multi-file Editor widget
    Úeditorztemp.pyztemplate.pyFc                s¦  t rtjˆ ||d nt ˆ |¡ dˆ _t ˆ j¡sžtjdkrDg }ndt	rNdnd g}|ddd	d
ddd
g }yt
 tj |¡ˆ jd¡ W n tk
rœ   Y nX d ˆ _d ˆ _d ˆ _g ˆ _g ˆ _d ˆ _d ˆ _d ˆ _dˆ _g ˆ _i ˆ _g ˆ _g ˆ _d ˆ _d ˆ _ˆ  ¡  d ˆ _ˆ j  !¡ }t"ˆ |ƒˆ _#t$ˆ |ƒˆ _%t&ˆ |ƒˆ _'t(ˆ |ƒˆ _)t*ƒ }t+ˆ ƒˆ _,t-ˆ j,ˆ jƒ | .ˆ j,¡ d ˆ _/g ˆ _0d ˆ _1dˆ _2t3ƒ rÖtj4 5d¡sÖyddl6m7} W n" t8k
rÊ   ddl9m7} Y nX |ƒ ˆ _:nt;ˆ j  <¡ dˆ _:ˆ j j= >ˆ j?¡ ˆ j j@ >ˆ jA¡ tBˆ ddˆ _Cˆ jC D¡  ˆ jCjE >‡ fdd„¡ ˆ  Fˆ jC¡ tGˆ ƒ}t*ƒ }	|	 Hdddd¡ | I|	¡ tJˆ ˆ ˆ jddˆ _K|	 .ˆ jK¡ |	 .ˆ jC¡ tLˆ ƒˆ _Mˆ jM Hdddd¡ ˆ jM .|¡ ˆ jM Ndd¡ ˆ jM Ndd¡ | .ˆ jM¡ ˆ  I|¡ ˆ  OtPjQ¡ ˆ  Rdd ¡}
|
d k	r0ˆ jM StTƒ  UtV|
ƒ Wd¡¡¡ ˆ  Rdg ¡ˆ _Xdˆ _Yd ˆ _Zd ˆ _[d ˆ _\d ˆ _]dˆ _2ˆ  ^¡ }|d k	r’ˆ  _¡ }| `d¡}ˆ  a||¡ ˆ  b¡  ˆ  A¡  d S )N)ÚmainTÚntz#!/usr/bin/env pythonÚ2Ú3z# -*- coding: utf-8 -*-z"""zCreated on %(date)srk   z@author: %(username)szutf-8ZSPY_TEST_USE_INTROSPECTIONr   )ÚMock)Z
extra_path)Zenable_replacec                s   ˆ   ¡ S )N)Úrehighlight_cells)Zvs)ra   rP   rQ   Ú<lambda>Û  s    z!Editor.__init__.<locals>.<lambda>)Úfirstrx   rn   Úsplitter_stateÚrecent_filesFÚcursor)cr   r@   Ú__init__Ú_Editor__set_eol_charsrK   rL   ÚTEMPLATE_PATHÚosÚnamer)   r-   ÚwriteÚlinesepÚjoinÚEnvironmentErrorÚprojectsÚoutlineexplorerÚhelpÚfile_dependent_actionsÚpythonfile_dependent_actionsÚdock_toolbar_actionsÚedit_menu_actionsÚstack_menu_actionsÚ_Editor__first_open_files_setupÚeditorstacksÚlast_focus_editorstackÚeditorwindowsÚeditorwindows_to_be_createdÚtoolbar_listÚ	menu_listZinitialize_pluginÚdialog_sizer£   Z	statusBarr?   Úreadwrite_statusr>   Ú
eol_statusr=   Úencoding_statusr<   Úcursorpos_statusr   r   Údock_toolbarr3   r–   Úlast_edit_cursor_posÚcursor_pos_historyÚcursor_pos_indexÚ_Editor__ignore_cursor_positionr"   ÚenvironrH   Zunittest.mockr§   ÚImportErrorZmockÚintrospectorr1   Úget_spyder_pythonpathZall_actions_definedr™   Úsetup_other_windowsZsig_pythonpath_changedÚset_pathr6   Úfind_widgetÚhideÚvisibility_changedÚregister_widget_shortcutsr   ZsetContentsMarginsr—   r8   Úeditorsplitterr   ÚsplitterZsetStretchFactorZsetFocusPolicyr   Z
ClickFocusrš   ZrestoreStater   ZfromHexÚstrÚencoder¬   Úuntitled_numZ_Editor__last_ic_execÚ_Editor__last_ec_execÚedit_filetypesÚedit_filtersÚget_current_editorÚget_current_filenameÚget_positionÚadd_cursor_position_to_historyÚupdate_cursorpos_actions)ra   ÚparentZignore_last_opened_filesZshebangÚheaderZ	statusbarÚlayoutr§   Zeditor_widgetsZeditor_layoutÚstateÚcurrent_editorrO   ÚpositionrP   )ra   rQ   r®   „  sÂ    











zEditor.__init__c             C   s
   || _ d S )N)r·   )ra   r·   rP   rP   rQ   Úset_projects  s    zEditor.set_projectsc             C   s@   | j d k	r<| j j}| ¡ r$| ¡  n| ¡  | ¡  |  ¡  d S )N)r·   Ú
dockwidgetÚ	isVisibler×   ÚshowÚraise_Úswitch_to_plugin)ra   ZdwrP   rP   rQ   Úshow_hide_projects  s    

zEditor.show_hide_projectsc                s`   |ˆ _ xˆ jD ]}| ˆ j ¡ qW ˆ jd  ¡  ˆ j j ‡ fdd„¡ ˆ j j ‡ fdd„¡ d S )Nr   c                s   ˆ j | ||ˆ dS )N)Ú	filenamesÚgotoÚwordÚeditorwindow)Úload)rô   rõ   rö   )ra   rP   rQ   r©      s    
z,Editor.set_outlineexplorer.<locals>.<lambda>c                s   ˆ j | ˆ dS )N)rô   r÷   )rø   )rô   )ra   rP   rQ   r©   $  s    )r¸   rÀ   Úset_outlineexplorerZinitialize_outlineexplorerÚ	edit_gotor™   rc   )ra   r¸   ÚeditorstackrP   )ra   rQ   rù     s    zEditor.set_outlineexplorerc             C   s&   || _ x| jD ]}| | j ¡ qW d S )N)r¹   rÀ   Úset_help)ra   Zhelp_pluginrû   rP   rP   rQ   rü   '  s    zEditor.set_helpc             C   s*   y|   ¡  ¡  W n tk
r$   Y nX dS )z9Restoring scrollbar position after main window is visibleN)râ   ZcenterCursorÚAttributeError)ra   rP   rP   rQ   Úrestore_scrollbar_position-  s    z!Editor.restore_scrollbar_positionc             C   sX   t dƒ}| jrT|  ¡ }| jjrD|rT| jj ¡ dk rT|dt|ƒ 7 }n|dt|ƒ 7 }|S )zReturn widget titler`   ru   z - )r    rî   rã   Zdock_tabbarÚcountr+   )ra   ÚtitlerO   rP   rP   rQ   Úget_plugin_title6  s    zEditor.get_plugin_titlec             C   s
   t  d¡S )zReturn widget icon.rc   )rd   re   )ra   rP   rP   rQ   Úget_plugin_iconB  s    zEditor.get_plugin_iconc             C   s   |   ¡ S )z|
        Return the widget to give focus to.

        This happens when plugin's dockwidget is raised on top-level.
        )râ   )ra   rP   rP   rQ   Úget_focus_widgetF  s    zEditor.get_focus_widgetc             C   sF   t  | |¡ | j ¡ r"| j ¡  n
| j ¡  |r8|  ¡  | j 	¡  dS )z!DockWidget visibility has changedN)
r@   rØ   rî   ZisWindowrË   rð   r×   Úrefresh_pluginÚupdate_plugin_titleÚemit)ra   ÚenablerP   rP   rQ   rØ   N  s    

zEditor.visibility_changedc             C   s   |   ¡ }| ¡  |  ¡  dS )zRefresh editor pluginN)Úget_current_editorstackZrefreshÚrefresh_save_all_action)ra   rû   rP   rP   rQ   r  Y  s    zEditor.refresh_pluginc             C   sò   | j  ¡ }|  dt|ƒ¡ g }| jd }d}| jdk	r@| j ¡ }|sN|  ¡  n| j dd„ |j	D ƒ¡ |  d| j
 ¡ ¡ |  ddd„ | jD ƒ¡ |  d	| j¡ y:| |¡s²|r²d
S x| jdd… D ]}| ¡  qÂW dS W n tk
rì   dS X dS )z3Perform actions before parent main window is closedr«   r   Nc             S   s   g | ]
}|j ‘qS rP   )rO   )rS   ÚfinforP   rP   rQ   rU   m  s    z)Editor.closing_plugin.<locals>.<listcomp>Úlayout_settingsÚwindows_layout_settingsc             S   s   g | ]}|  ¡ ‘qS rP   )Úget_layout_settings)rS   ÚwinrP   rP   rQ   rU   r  s    r¬   FT)rÛ   Z	saveStateÚ
set_optionr*   rÀ   r·   Úget_active_project_pathÚset_open_filenamesZset_project_filenamesÚdatarÚ   r  rÂ   r¬   Zsave_if_changedÚcloseÚ
IndexError)ra   Z
cancelablerê   rô   rû   Úactive_project_pathr  rP   rP   rQ   Úclosing_plugin_  s0    




zEditor.closing_pluginc       +         sp  t ˆ tdƒt d¡tdƒˆ jtjdˆ _ˆ jˆ jdddd t ˆ tdƒtd	ƒˆ j	d
ˆ _
ˆ jˆ j
dd	d t ˆ tdƒt d¡tdƒˆ jtjdˆ _ˆ jˆ jdddd t ˆ tdƒt d¡tdƒˆ jdˆ _t ˆ tdƒt d¡tdƒˆ jtjdˆ _ˆ jˆ jdddd t ˆ tdƒt d¡tdƒˆ jtjdˆ _ˆ jˆ jdddd t ˆ tdƒdt d¡tdƒˆ jtjd}ˆ  |dd¡ t ˆ td ƒdt d¡td!ƒˆ jd"}t ˆ td#ƒtd#ƒˆ jd
}t ˆ td$ƒt d%¡td&ƒˆ jdˆ _t ˆ td'ƒt d(¡td)ƒˆ jdˆ _t ˆ td*ƒt d+¡td,ƒˆ jtjdˆ _ˆ jˆ jdd-d td.ƒ}t ˆ |t d/¡|ˆ jtjd}ˆ j|d0d1dd t ˆ td2ƒt d3¡ˆ jtjd4}ˆ j|d0d5d t ˆ td6ƒt d7¡ˆ jtjd4}ˆ j|d0d8d td9ƒ}t ˆ |t d:¡|ˆ jtjd}ˆ j|d0d;d t ˆ td<ƒt d=¡ˆ j tjd4}	ˆ j|	dd>d t ˆ td?ƒt d@¡ˆ j!tjd4}
ˆ j|
ddAd t ˆ tdBƒˆ j"d"}t ˆ tdCƒˆ j#d"ˆ _$ˆ j$ %t&dk	o¢t'¡ t ˆ tdDƒt dE¡tdFƒˆ j(d}ˆ j|d0dGdd t ˆ tdHƒt dI¡tdJƒ‡ fdKdL„d}ˆ j|d0dMddN t ˆ tdOƒt dP¡tdQƒ‡ fdRdL„d}ˆ j|d0dSddN t ˆ tdTƒt dU¡tdVƒ‡ fdWdL„d}ˆ j|d0dXddN t ˆ tdYƒt dZ¡td[ƒ‡ fd\dL„d}ˆ j|d0d]ddN t ˆ td^ƒt d_¡td`ƒ‡ fdadL„d}ˆ j|d0dbddN t ˆ tdcƒt dd¡tdeƒˆ j)d}ˆ j|d0dfdd t ˆ tdgƒt dh¡tdiƒt*j+ˆ j,dj}ˆ j|d0dkdd t ˆ tdlƒt dm¡tdnƒˆ j-d}ˆ j|d0dodd t ˆ tdpƒt dq¡tdrƒˆ j.tjd}ˆ j|ddsdd t ˆ tdtƒt du¡t/t0ƒtdvƒˆ j1tjdw}t ˆ tdxƒt dy¡t/t2ƒtdzƒˆ j3tjdw}t ˆ td{ƒtd|ƒˆ j4tjd}ˆ j|dd}dd t ˆ td~ƒt d¡td€ƒˆ j5dˆ _6t7ˆ ƒˆ _8ˆ j6 9ˆ j8¡ ˆ j8j: ;ˆ j<¡ t ˆ tdƒt d‚¡tdƒƒˆ j=dˆ _>t7ˆ ƒˆ _?ˆ j> 9ˆ j?¡ ˆ j?j: ;ˆ j@¡ t ˆ td„ƒt d…¡td†ƒˆ jAdˆ _Bt ˆ td‡ƒt dˆ¡td‰ƒˆ j=dˆ _Ct ˆ tdŠƒt d‹¡tdŒƒˆ jDtjdˆ _Eˆ jˆ jEddŠdd t ˆ tdƒt dŽ¡tdƒˆ jFtjdˆ _Gˆ jˆ jGdddd t ˆ tdƒt d‘¡td’ƒˆ jHtjdˆ _Iˆ jˆ jIdddd t ˆ td“ƒd” td•ƒ t d–¡td—ƒˆ jJtjdˆ _Kˆ jˆ jKdd˜d t ˆ td™ƒtdšƒˆ jLtjd}ˆ j|dd›d t ˆ tdœƒtdƒˆ jMtjd}ˆ j|ddžd t ˆ tdŸƒd t d¡¡td¢ƒˆ jNtjdˆ _Ot ˆ td£ƒd¤t d¥¡td¦ƒˆ jPtjdˆ _Qt ˆ td§ƒtd¨ƒˆ jRtjdˆ _Sˆ jˆ jSdd©d t ˆ tdªƒtd«ƒˆ jTtjdˆ _Uˆ jˆ jUdd¬d t ˆ td­ƒ‡ fd®dL„d¯ˆ _Vt ˆ td°ƒ‡ fd±dL„d¯ˆ _Wt ˆ td²ƒ‡ fd³dL„d¯ˆ _XtYˆ ƒ}ˆ jVˆ jWˆ jXf}tZ||ƒ t7td´ƒˆ ƒ}tZ||ƒ t ˆ tdµƒˆ j[d"}t ˆ td¶ƒˆ j\d¯ˆ _]t ˆ td·ƒtd¸ƒˆ j^d
}t ˆ td¹ƒt dº¡ˆ j_tjd4} ˆ j| dd»d t ˆ td¼ƒt d½¡td¾ƒˆ j`d}!t ˆ td¿ƒˆ jad"ˆ _bt ˆ tdÀƒtdÁƒˆ jcd
ˆ _dt7tdÂƒˆ ƒˆ _eˆ jej: ;ˆ jf¡ ˆ jtgˆ jˆ j
ˆ jetgtgˆ jˆ j||ˆ jtg|ˆ jtgˆ jˆ jtgg}"ˆ jh ji|"7  _iˆ jˆ jˆ jˆ jgˆ jhjj }#|#ˆ jh_j||||gˆ jh_k|||gˆ jh_lˆ jK||ˆ jOˆ jQˆ jSˆ jUgˆ _mˆ jh jmtggˆ jm 7  _mˆ jKˆ jQˆ jOg}$ˆ jh jn|$7  _nˆ jh jk| g7  _kˆ jh jl| g7  _l||||tg|||tgg	}%ˆ jh jo|%7  _o|||||g}&ˆ jh jp|&7  _p||||||tg|	|
|dÃtgˆ j$g}'ˆ jh jq|'7  _q||||||g}(ˆ jh jr|(7  _r|ˆ j]||tgˆ j6ˆ j>ˆ jBˆ jCtgˆ jEˆ jGˆ jIg})ˆ jh js|)7  _sˆ j6ˆ j>ˆ jBˆ jCtgˆ jEˆ jGˆ jIg}*ˆ jh jt|*7  _t|#tgg |* tgg |& tgg |( tgg |$ ˆ _u|||	|
|||||||ˆ j$gˆ _v||gˆ _wˆ jvˆ j|||ˆ jˆ j| |!ˆ jˆ jˆ jKˆ jˆ jOˆ jQg ˆ _x| |!gˆ _yˆ jxS )Äz*Return a list of actions related to pluginz&New file...ZfilenewzNew file)re   r   Ú	triggeredÚcontextr`   T)r  r²   Úadd_sc_to_tipzO&pen last closedzOpen last closed)r   r  )r  r²   z&Open...Zfileopenz	Open filez&RevertÚrevertzRevert file from disk)re   r   r  z&SaveZfilesavez	Save filez	Sav&e allÚsave_allzSave all fileszSave allzSave &as...NZ
filesaveaszSave current file as...)r   r  r  zSave AszSave copy as...zSave copy of current file as...)r  zPrint preview...z	&Print...ÚprintzPrint current file...z&CloseZ	fileclosezClose current filez
C&lose allZfilecloseallzClose all opened filesz	Close allz
&Find textÚfindr    z	Find textz
Find &nextZfindnext)re   r  r  z	Find nextzFind &previousZfindpreviouszFind previousz&Replace textÚreplacezReplace textzSet/Clear breakpointZbreakpoint_bigZ
BreakpointzSet/Edit conditional breakpointZbreakpoint_cond_bigzConditional breakpointzClear breakpoints in all fileszDebug with winpdbz&DebugÚdebugz
Debug fileZDebugZStepzarrow-step-overzRun current linec                  s
   ˆ   d¡S )NÚnext)Údebug_commandrP   )ra   rP   rQ   r©     s    z+Editor.get_plugin_actions.<locals>.<lambda>zDebug Step Over)r  ZContinuezarrow-continuez(Continue execution until next breakpointc                  s
   ˆ   d¡S )NÚcontinue)r!  rP   )ra   rP   rQ   r©   
  s    zDebug Continuez	Step Intozarrow-step-inz,Step into function or method of current linec                  s
   ˆ   d¡S )Nrs   )r!  rP   )ra   rP   rQ   r©     s    zDebug Step IntozStep Returnzarrow-step-outz,Run until current function or method returnsc                  s
   ˆ   d¡S )NÚreturn)r!  rP   )ra   rP   rQ   r©     s    zDebug Step ReturnZStopZ
stop_debugzStop debuggingc                  s
   ˆ   d¡S )NÚexit)r!  rP   )ra   rP   rQ   r©     s    z
Debug Exitz&RunrF   zRun filerz   z&Configuration per file...Zrun_settingszRun settings)re   r   Zmenuroler  Z	ConfigurezRe-run &last scriptZ	run_againzRun again last filezRe-run last scriptzRun &selection or current lineÚrun_selectionzRun selection or current linezRun selectionzRun cellÚrun_cellz7Run current cell (Ctrl+Enter)
[Use #%% to create cells])re   Zshortcutr   r  r  zRun cell and advanceZrun_cell_advancez5Run current cell and go to the next one (Shift+Enter)zRe-run last cellzRe run last cell zre-run last cellzShow todo listr’   zLShow comments list (TODO/FIXME/XXX/HINT/TIP/@todo/HACK/BUG/OPTIMIZE/!!!/???)zShow warning/error listZwng_listz"Show code analysis warnings/errorszPrevious warning/errorZprev_wngz*Go to previous code analysis warning/errorzNext warning/errorZnext_wngz&Go to next code analysis warning/errorzLast edit locationZlast_edit_locationzGo to last edit locationzPrevious cursor positionZprev_cursorzGo to previous cursor positionzNext cursor positionZnext_cursorzGo to next cursor positionÚCommentú/Z	UncommentÚcommentz!Comment current line or selectionzToggle commentzAdd &block commentz2Add block comment around current line or selectionZBlockcommentzR&emove block commentz5Remove comment block around current line or selectionZUnblockcommentZIndentZTabÚindentz Indent current line or selectionZUnindentz	Shift+TabÚunindentz"Unindent current line or selectionzToggle Uppercasez-Change to uppercase current line or selectionztransform to uppercasezToggle Lowercasez-Change to lowercase current line or selectionztransform to lowercasez'Carriage return and line feed (Windows)c                s   ˆ   d| ¡S )Nr¤   )Útoggle_eol_chars)Úchecked)ra   rP   rQ   r©   È  s    )r˜   zLine feed (UNIX)c                s   ˆ   d| ¡S )NÚposix)r,  )r-  )ra   rP   rQ   r©   Ë  s    zCarriage return (Mac)c                s   ˆ   d| ¡S )NZmac)r,  )r-  )ra   rP   rQ   r©   Î  s    zConvert end-of-line characterszRemove trailing spaceszShow blank spaceszFix indentationz*Replace tab characters by space characterszGo to line...Zgotolinez
Go to linezSet console working directoryZDirOpenIconzUSet current console (and file explorer) working directory to current script directoryz!Maximum number of recent files...zClear this listzClear recent files listzOpen &recentZlist_breakpoints)zr2   r    rd   re   Únewr   ZWidgetShortcutÚ
new_actionZregister_shortcutÚopen_last_closedZopen_last_closed_actionrø   Úopen_actionr  Úrevert_actionÚsaveÚsave_actionr  Úsave_all_actionÚsave_asÚsave_copy_asÚprint_previewÚ
print_fileZprint_actionÚ
close_fileZclose_actionÚclose_all_filesZclose_all_actionr  Ú	find_nextÚfind_previousr  Úset_or_clear_breakpointÚ"set_or_edit_conditional_breakpointr[   Ú
run_winpdbÚwinpdb_actionr‰   ÚWINPDB_PATHr)   Ú
debug_fileÚrun_filer   ZNoRoleÚedit_run_configurationsÚre_run_filer%  r   r$   r&  r%   Úrun_cell_and_advanceÚre_run_last_cellÚgo_to_next_todoÚtodo_list_actionr   Ú	todo_menuZsetMenuZaboutToShowr™   Úupdate_todo_menuÚgo_to_next_warningÚwarning_list_actionÚwarning_menuÚupdate_warning_menuÚgo_to_previous_warningÚprevious_warning_actionÚnext_warning_actionÚgo_to_last_edit_locationÚprevious_edit_cursor_actionÚgo_to_previous_cursor_positionÚprevious_cursor_actionÚgo_to_next_cursor_positionÚnext_cursor_actionÚtoggle_commentZtoggle_comment_actionÚblockcommentÚunblockcommentr*  Zindent_actionr+  Zunindent_actionÚtext_uppercaseZtext_uppercase_actionÚtext_lowercaseZtext_lowercase_actionÚwin_eol_actionÚlinux_eol_actionÚmac_eol_actionr   r3   Úremove_trailing_spacesÚtoggle_show_blanksÚshowblanks_actionÚfix_indentationÚ
go_to_lineÚ_Editor__set_workdirÚchange_max_recent_filesÚmax_recent_actionÚclear_recent_filesÚclear_recent_actionÚrecent_file_menuÚupdate_recent_file_menur4   r£   Úfile_menu_actionsÚfile_toolbar_actionsÚsearch_menu_actionsZsearch_toolbar_actionsr½   Úedit_toolbar_actionsÚrun_menu_actionsÚrun_toolbar_actionsÚdebug_menu_actionsÚdebug_toolbar_actionsÚsource_menu_actionsÚsource_toolbar_actionsr¼   r»   Úcythonfile_compatible_actionsrº   r¾   )+ra   Zsave_as_actionZsave_copy_as_actionZprint_preview_actionZ_textZfind_actionZfind_next_actionZfind_previous_actionZreplace_actionZset_clear_breakpoint_actionZset_cond_breakpoint_actionZclear_all_breakpoints_actionZdebug_actionZdebug_next_actionZdebug_continue_actionZdebug_step_actionZdebug_return_actionZdebug_exit_actionZ
run_actionZconfigure_actionZre_run_actionZrun_selected_actionZrun_cell_actionZrun_cell_advance_actionZre_run_last_cell_actionZblockcomment_actionZunblockcomment_actionZeol_action_groupZeol_actionsZeol_menuZtrailingspaces_actionZfixindentation_actionZgotoline_actionZworkdir_actionro  rp  rr  rs  rt  ru  rv  rw  rx  rP   )ra   rQ   Úget_plugin_actions  sX   













































































&


zEditor.get_plugin_actionsc             C   s¾   | j j | j¡ | j jj | j¡ | j | j j¡ | j | j j	¡ | j
 | j jj¡ |  | j j¡ | j jdk	r||  | j j¡ |  ¡ }|js’|  ¡  | j  | ¡ | j  | |j|jt d¡¡ dS )z'Register plugin in Spyder's main windowNZTextFileIcon)r£   rþ   r™   Zconsolerú   rø   Úexec_in_extconsoleZexecute_in_external_consoleÚredirect_stdioZredirect_internalshell_stdioÚopen_dirZworkingdirectoryÚchdirrü   r¹   r¸   rù   r  r  Ú_Editor__load_temp_fileZadd_dockwidgetZadd_to_fileswitcherr   rd   re   )ra   rû   rP   rP   rQ   Úregister_pluginˆ  s    zEditor.register_pluginc             C   s`   |   ¡ }|  ¡ }xJ| jD ]@}| ||¡ t dd¡}x"|jD ]}|jj}| 	||¡ q<W qW dS )zUpdate font from Preferencesr£   zcompletion/sizeN)
Úget_plugin_fontÚget_color_schemerÀ   Úset_default_fontr#   rH   r  r¢   Zcompletion_widgetZsetup_appearance)ra   ÚfontÚcolor_schemerû   Zcompletion_sizer
  Zcomp_widgetrP   rP   rQ   Úupdate_fontš  s    zEditor.update_fontc             C   s8   t  ¡ }t|tƒr|S x| jD ]}| |¡r|S qW d S )N)r   ÚfocusWidgetrV   r9   rÀ   ÚisAncestorOf)ra   Zfwidgetrû   rP   rP   rQ   Z__get_focus_editorstack¦  s    

zEditor.__get_focus_editorstackc             C   s   || j |< || j d < d S )N)rÁ   )ra   r÷   rû   rP   rP   rQ   Úset_last_focus_editorstack¯  s    
z!Editor.set_last_focus_editorstackNc             C   s
   | j | S )N)rÁ   )ra   r÷   rP   rP   rQ   Úget_last_focus_editorstack³  s    z!Editor.get_last_focus_editorstackc             C   s2   x,t | j ¡ ƒD ]\}}||krd | j|< qW d S )N)rI   rÁ   Úitems)ra   rû   r÷   ZwidgetrP   rP   rQ   Úremove_last_focus_editorstack¶  s    z$Editor.remove_last_focus_editorstackc             C   s@   |   ¡ }|d k	r<x*| g| j D ]}| |¡r|  ||¡ qW d S )N)Ú_Editor__get_focus_editorstackrÂ   rˆ  r‰  )ra   rû   r  rP   rP   rQ   Úsave_focus_editorstack»  s
    
zEditor.save_focus_editorstackc                s°  ˆ j  |¡ ˆ  |¡ tˆ j ƒdkr@ˆ jd k	r@ˆ jjj |j¡ ˆ  	|¡rüˆ  
ˆ |¡ | tˆ j ƒdk¡ ˆ jd k	r€| ˆ j¡ | ˆ j¡ |j ˆ jj¡ |j ˆ jj¡ |j ˆ jj¡ |j ˆ jj¡ |j ˆ jj¡ |j ˆ jj¡ |j ˆ jj¡ | ˆ j¡ | ˆ jˆ j ˆ j!ˆ j"¡ | #ˆ j$¡ | %ˆ j&¡ d}x&|D ]\}}t'||ƒˆ  (|¡ƒ qBW | )t* +dd¡¡ ˆ  ,¡ }| -ˆ  .¡ |¡ |j/ ˆ j/¡ |j0 ˆ j0¡ |j1 ‡ fdd„¡ |j2 ‡ fdd„¡ |j3 ‡ fdd„¡ |j4 ˆ j5¡ |j4 ˆ j6¡ |j4 ˆ jj7¡ |j8 ‡ fd	d„¡ |j9 ‡ fd
d„¡ |j: ‡ fdd„¡ |j; ‡ fdd„¡ |j;d  ˆ j<¡ |j= ˆ j>¡ |j? ˆ j@¡ |jA ˆ jB¡ |jC ˆ jC¡ |jD ˆ jD¡ |jE ˆ jE¡ |jF ˆ jF¡ |jG ˆ jG¡ |jG ˆ jH¡ |jI ˆ jI¡ |jJ ˆ jJ¡ |j ˆ jK¡ |jL ˆ jL¡ |jM ˆ jM¡ |jN ˆ jN¡ |jO ˆ jP¡ |jOd  ˆ jP¡ |jQ ˆ jP¡ |jR ˆ jS¡ |jT ˆ jU¡ |jV ˆ jW¡ |jX ˆ jY¡ d S )Nrn   ))Úset_pyflakes_enabledzcode_analysis/pyflakes)Úset_pep8_enabledzcode_analysis/pep8)Úset_todolist_enabledr’   )Úset_realtime_analysis_enabledr“   )Úset_realtime_analysis_timeoutzrealtime_analysis/timeout)Úset_blanks_enabledri   )Úset_linenumbers_enabledrh   )Úset_edgeline_enabledrj   )Úset_edgeline_columnrl   )Úset_codecompletion_auto_enabledzcodecompletion/auto)Úset_codecompletion_case_enabledzcodecompletion/case_sensitive)Ú set_codecompletion_enter_enabledzcodecompletion/enter_key)Úset_calltips_enabledr}   )Úset_go_to_definition_enabledr~   )Úset_focus_to_editorr|   )Úset_close_parentheses_enabledr€   )Úset_close_quotes_enabledr   )Úset_add_colons_enabledr‚   )Úset_auto_unindent_enabledrƒ   )Úset_indent_charsr„   )Úset_tab_stop_width_spacesr…   )Úset_wrap_enabledrt   )Úset_tabmode_enabledrŽ   )Ú!set_intelligent_backspace_enabledr   )Ú"set_highlight_current_line_enabledro   )Ú"set_highlight_current_cell_enabledrp   )Ú#set_occurrence_highlighting_enabledrq   )Ú#set_occurrence_highlighting_timeoutzoccurrence_highlighting/timeout)Zset_checkeolchars_enabledr”   )Úset_tabbar_visiblerg   )Ú!set_always_remove_trailing_spacesr‘   r¹   zconnect/editorc                s   ˆ j  | ¡S )N)r|  r  )rê   )ra   rP   rQ   r©     s    z-Editor.register_editorstack.<locals>.<lambda>c                s   ˆ j  | |¡S )N)r{  r  )ÚtextZoption)ra   rP   rQ   r©     s    c                  s
   ˆ j  ¡ S )N)r  r  rP   )ra   rP   rQ   r©     s    c                  s
   ˆ   d¡S )Nrn   )ÚzoomrP   )ra   rP   rQ   r©     s    c                  s
   ˆ   d¡S )Néÿÿÿÿ)r®  rP   )ra   rP   rQ   r©     s    c                  s
   ˆ   d¡S )Nr   )r®  rP   )ra   rP   rQ   r©     s    c                s   ˆ j | dS )N)r­  )r/  )Ús)ra   rP   rQ   r©     s    rP   )ZrÀ   ÚappendrÙ   Úlenr£   ZfileswitcherZsig_goto_filer™   Zset_stack_indexrˆ  r‰  Zset_closabler¸   rù   Zset_find_widgetrÖ   Zreset_statusbarrÇ   r×   rÉ   rÊ   Zreadonly_changedZencoding_changedZ"sig_editor_cursor_position_changedZcursor_position_changedZsig_refresh_eol_charsrÈ   Zeol_changedrü   r¹   Zset_io_actionsr0  r2  r5  r3  Zset_tempfile_pathÚTEMPFILE_PATHZset_introspectorrÒ   Úgetattrrš   Úset_help_enabledr#   rH   r‚  rƒ  r  Ústarting_long_processÚending_long_processr|  r{  r  Zeditor_focus_changedrŽ  Ú!set_editorstack_for_introspectionZplugin_focus_changedZzoom_inZzoom_outZ
zoom_resetZsig_new_filer/  Zsig_close_fileÚclose_file_in_all_editorstacksZ
file_savedÚfile_saved_in_editorstackZfile_renamed_in_dataÚ#file_renamed_in_data_in_editorstackÚcreate_new_windowÚopened_files_list_changedÚanalysis_results_changedÚtodo_results_changedÚupdate_code_analysis_actionsÚupdate_todo_actionsÚrefresh_file_dependent_actionsr	  Úrefresh_eol_charsrZ   Útext_changed_atÚcurrent_file_changedZplugin_loadrø   rú   Zsig_save_asr7  Zsig_prev_edit_posrU  Zsig_prev_cursorrW  Zsig_next_cursorrY  )ra   rû   ZsettingsÚmethodZsettingr…  rP   )ra   rQ   Úregister_editorstackÃ  s˜    






 zEditor.register_editorstackc             C   s<   |   |¡ t| jƒdkr4| j |¡}| j |¡ dS dS dS )z8Removing editorstack only if it's not the last remainingrn   TFN)rŒ  r²  rÀ   r‹   rM   )ra   rû   r‹   rP   rP   rQ   Úunregister_editorstack=  s    
zEditor.unregister_editorstackc             C   s0   |  | jd ¡ x|jD ]}|  |j¡ qW d S )Nr   )Z
clone_fromrÀ   r  rÙ   r¢   )ra   rû   r
  rP   rP   rQ   Úclone_editorstackH  s    zEditor.clone_editorstackc             C   sP   xJ| j D ]@}tt|ƒƒ|kr| d¡ | |¡}|j|dd | d¡ qW d S )NT)ÚforceF)rÀ   rÜ   ÚidZblockSignalsZget_index_from_filenamer;  )ra   Úeditorstack_id_strrO   rû   r‹   rP   rP   rQ   r¹  M  s    

z%Editor.close_file_in_all_editorstacksc             C   s0   x*| j D ] }tt|ƒƒ|kr| ||¡ qW dS )z5A file was saved in editorstack, this notifies othersN)rÀ   rÜ   rË  Zfile_saved_in_other_editorstack)ra   rÌ  Úoriginal_filenamerO   rû   rP   rP   rQ   rº  V  s    z Editor.file_saved_in_editorstackc             C   s0   x*| j D ] }tt|ƒƒ|kr| ||¡ qW dS )z?A file was renamed in data in editorstack, this notifies othersN)rÀ   rÜ   rË  Úrename_in_data)ra   rÌ  rÍ  rO   rû   rP   rP   rQ   r»  _  s    z*Editor.file_renamed_in_data_in_editorstackc                sx   |   ¡ ‰ ˆ dk	rt| j ˆ ¡ y| jj ¡  | jj ¡  W n tk
rL   Y nX | jj ˆ j¡ | jj ‡ fdd„¡ dS )ze
        Set the current editorstack to be used by the IntrospectionManager
        instance
        Nc                s   ˆ j  | ||¡S )N)rú   r  )ÚfnamerT   r²   )rû   rP   rQ   r©   z  s    z:Editor.set_editorstack_for_introspection.<locals>.<lambda>)	r  rÒ   Zset_editor_widgetZsig_send_to_helpZ
disconnectZsig_edit_gotoÚ	TypeErrorr™   Zsend_to_help)ra   rP   )rû   rQ   r¸  g  s    z(Editor.set_editorstack_for_introspectionc          	   C   sþ   t dƒd| jjft dƒd| jjft dƒd| jjft dƒd| jjft d	ƒd
| jjft dƒd| jjff| _t dƒ| jj	ft dƒ| jj
ft dƒ| jjft dƒ| jjft dƒ| jjft dƒ| jjft dƒg ft dƒ| jjff| _x | jD ]}|  ¡ }| |¡ qàW dS )z3Setup toolbars and menus for 'New window' instanceszFile toolbarZfile_toolbarzSearch toolbarZsearch_toolbarzSource toolbarZsource_toolbarzRun toolbarZrun_toolbarzDebug toolbarZdebug_toolbarzEdit toolbarZedit_toolbarz&Filez&Editz&SearchzSour&cez&Runz&Toolsz&Viewz&HelpN)r    r£   rp  rq  rx  rt  rv  rr  rÄ   ro  r½   rw  rs  Ztools_menu_actionsZhelp_menu_actionsrÅ   rÃ   r¼  Úset_layout_settings)ra   r  r  rP   rP   rQ   rÔ   ~  s.    
zEditor.setup_other_windowsc          	      s„   ˆ j  ¡ }tˆ ˆ jˆ jˆ j|d |d |d d‰ˆ dˆ ¡ ¡ ˆ ¡  ˆ 	ˆ  
¡ ¡ ˆ ¡  ˆ  ˆ¡ ˆj ‡ ‡fdd„¡ ˆS )NÚshow_fullpathÚshow_all_filesÚshow_comments)rÒ  rÓ  rÔ  z&Viewc                  s
   ˆ   ˆ¡S )N)Úunregister_editorwindowrP   )ra   ÚwindowrP   rQ   r©   ¦  s    z*Editor.create_new_window.<locals>.<lambda>)r¸   Zget_optionsr7   r¾   rÄ   rÅ   Zadd_toolbars_to_menuZget_toolbarsZload_toolbarsÚresizeÚsizerð   Úregister_editorwindowZ	destroyedr™   )ra   Z
oe_optionsrP   )ra   rÖ  rQ   r¼  š  s    

zEditor.create_new_windowc             C   s   | j  |¡ d S )N)rÂ   r±  )ra   rÖ  rP   rP   rQ   rÙ  ©  s    zEditor.register_editorwindowc             C   s   | j  | j  |¡¡ d S )N)rÂ   rM   r‹   )ra   rÖ  rP   rP   rQ   rÕ  ¬  s    zEditor.unregister_editorwindowc             C   s   dd„ | j d jD ƒS )Nc             S   s   g | ]
}|j ‘qS rP   )rO   )rS   r
  rP   rP   rQ   rU   ²  s    z(Editor.get_filenames.<locals>.<listcomp>r   )rÀ   r  )ra   rP   rP   rQ   Úget_filenames±  s    zEditor.get_filenamesc             C   s   | j d  |¡S )Nr   )rÀ   Úhas_filename)ra   rO   rP   rP   rQ   Úget_filename_index´  s    zEditor.get_filename_indexc             C   s`   | j d k	r\t| j ƒdkr$| j d }n4|  ¡ }|d ks<|d k	rX|  |¡}|d krX| j d }|S d S )Nrn   r   )rÀ   r²  r  rŠ  )ra   r÷   rû   rP   rP   rQ   r  ·  s    


zEditor.get_current_editorstackc             C   s   |   ¡ }|d k	r| ¡ S d S )N)r  râ   )ra   rû   rP   rP   rQ   râ   Ã  s    zEditor.get_current_editorc             C   s   |   ¡ }|d k	r| ¡ S d S )N)r  Úget_current_finfo)ra   rû   rP   rP   rQ   rÝ  È  s    zEditor.get_current_finfoc             C   s   |   ¡ }|d k	r| ¡ S d S )N)r  rã   )ra   rû   rP   rP   rQ   rã   Í  s    zEditor.get_current_filenamec             C   s   | j d  |¡S )Nr   )rÀ   Úis_file_opened)ra   rO   rP   rP   rQ   rÞ  Ò  s    zEditor.is_file_openedc             C   s   |   |¡}| |¡S )zpSet focus to *filename* if this file has been opened
        Return the editor instance associated to *filename*)r  Úset_current_filename)ra   rO   r÷   rû   rP   rP   rQ   rß  Õ  s    
zEditor.set_current_filenamec             C   s>   x | j d jD ]}| j ¡ |_qW | jr:| j | j ¡ ¡ d S )Nr   )rÀ   r  r£   rÓ   ÚpathrÒ   Zchange_extra_path)ra   r
  rP   rP   rQ   rÕ   Û  s
    zEditor.set_pathc             C   s   |   ¡ S )z,Get the widget with the TabWidget attribute.)r  )ra   rP   rP   rQ   Úget_current_tab_managerã  s    zEditor.get_current_tab_managerc             C   s:   | j r6| j  ¡ r6|  ¡ dk	}x| jD ]}| |¡ q$W dS )zMEnable/disable file dependent actions
        (only if dockwidget is visible)N)rî   rï   râ   rº   r‰   )ra   r  ÚactionrP   rP   rQ   rÂ  è  s    z%Editor.refresh_file_dependent_actionsc             C   s0   |   ¡ }|r,tdd„ |jD ƒƒ}| j |¡ dS )z0Enable 'Save All' if there are files to be savedc             s   s"   | ]}|j  ¡  ¡ p|jV  qd S )N)r¢   ÚdocumentZ
isModifiedZnewly_created)rS   r
  rP   rP   rQ   ú	<genexpr>ô  s   z1Editor.refresh_save_all_action.<locals>.<genexpr>N)r  Úanyr  r6  r‰   )ra   rû   rê   rP   rP   rQ   r	  ð  s
    zEditor.refresh_save_all_actionc       	         s    ˆ  ¡ }| ¡ }ˆj ¡  ˆ ¡ ‰ xx|D ]p\}‰d|k}|dd…  ¡ |dd…  }|rbt d¡nt d¡}‡ ‡‡fdd„}tˆ|||d}ˆj 	|¡ q(W dS )	zUpdate warning list menuZsyntaxNrn   ÚerrorZwarningc                  s   ˆ  ¡  ˆjˆ ˆd d S )N)rõ   )rò   rø   rP   )rO   Úline_numberra   rP   rQ   Úslot  s    z(Editor.update_warning_menu.<locals>.slot)r­  re   r  )
r  Úget_analysis_resultsrP  Úclearrã   Úupperrd   re   r2   Ú	addAction)	ra   rû   Zcheck_resultsÚmessageræ  r­  re   rè  râ  rP   )rO   rç  ra   rQ   rQ  ø  s    
zEditor.update_warning_menuc             C   s\   |   ¡ }| ¡ }| ¡ }|dkrP|j| j}x"| jD ]}||k	r4| ||¡ q4W |  ¡  dS )zo
        Synchronize analysis results between editorstacks
        Refresh analysis navigation buttons
        r¯  N)r  ré  Úget_stack_indexr  rO   rÀ   Zset_analysis_resultsrÀ  )ra   rû   Úresultsr‹   rO   Úother_editorstackrP   rP   rQ   r¾  
  s    zEditor.analysis_results_changedc                sv   ˆ  ¡ }| ¡ }ˆj ¡  ˆ ¡ ‰ xF|D ]>\}‰t d¡}‡ ‡‡fdd„}tˆ|||d}ˆj |¡ q(W ˆ 	¡  dS )zUpdate todo list menuZtodoc                  s   ˆ  ¡  ˆjˆ ˆd d S )N)rõ   )rò   rø   rP   )rO   Úline0ra   rP   rQ   rè  "  s    z%Editor.update_todo_menu.<locals>.slot)r­  re   r  N)
r  Úget_todo_resultsrL  rê  rã   rd   re   r2   rì  rÁ  )ra   rû   rï  r­  re   rè  râ  rP   )rO   rñ  ra   rQ   rM    s    

zEditor.update_todo_menuc             C   s\   |   ¡ }| ¡ }| ¡ }|dkrP|j| j}x"| jD ]}||k	r4| ||¡ q4W |  ¡  dS )zl
        Synchronize todo results between editorstacks
        Refresh todo list navigation buttons
        r¯  N)r  rò  rî  r  rO   rÀ   Zset_todo_resultsrÁ  )ra   rû   rï  r‹   rO   rð  rP   rP   rQ   r¿  *  s    zEditor.todo_results_changedc             C   sP   t |ƒ}d| _|dkr$| j d¡ n"|dkr:| j d¡ n| j d¡ d| _d S )NFr¤   Tr.  )r+   r¯   r`  Ú
setCheckedra  rb  )ra   Úos_namerP   rP   rQ   rÃ  9  s    zEditor.refresh_eol_charsc             C   sŠ   |   ¡ }|r†| ¡ }|p(t d¡o(| ¡ }xJ| jD ]@}|| jkrF|}n|}|| jkrh| |obt	dk	¡ q2| |¡ q2W | j
 |  ¡ ¡ dS )z­
        Opened files list has changed:
        --> open/close file action
        --> modification ('*' added to title)
        --> current edited file has changed
        ZCythonN)râ   Z	is_pythonr.   r›   Z	is_cythonr»   ry  rB  r‰   rC  Úopen_file_updater  rã   )ra   r¢   Zpython_enableZcython_enablerâ  r  rP   rP   rQ   r½  F  s    

z Editor.opened_files_list_changedc             C   s\   |   ¡ }| ¡ }|  d¡s$|  d¡o2|d k	o2t|ƒ}x"| j| j| jfD ]}| |¡ qFW d S )Nzcode_analysis/pyflakeszcode_analysis/pep8)r  ré  rš   r²  rO  rS  rT  r‰   )ra   rû   rï  rê   râ  rP   rP   rQ   rÀ  ^  s    


z#Editor.update_code_analysis_actionsc             C   s:   |   ¡ }| ¡ }|  d¡o(|d k	o(t|ƒ}| j |¡ d S )Nr’   )r  rò  rš   r²  rK  r‰   )ra   rû   rï  rê   rP   rP   rQ   rÁ  j  s
    
zEditor.update_todo_actionsc             C   s   |   ¡ }| ¡  t ¡  dS )z#Rehighlight cells of current editorN)râ   r¨   r   ÚprocessEvents)ra   r¢   rP   rP   rQ   r¨   q  s    zEditor.rehighlight_cellsc             C   sJ   t |ƒ}t |ƒ}t t |¡¡}|r.t|ƒ}ng }t||ƒ | j ¡  d S )N)r+   rK   ÚnormpathÚabspathÚevalrZ   Úbreakpoints_savedr  )ra   rO   rG   rP   rP   rQ   rZ   y  s    

zEditor.save_breakpointsc             C   s„   t  | j¡stddtdƒdtdƒdddg}tj dd„ |D ƒ¡}yt t	|ƒ| jd¡ W n t
k
rr   |  ¡  d	S X |  | j¡ d	S )
z;Load temporary file from a text file in user home directoryz# -*- coding: utf-8 -*-z"""zSpyder Editorrk   z This is a temporary script file.c             S   s   g | ]}t  |¡‘qS rP   )r-   Z
to_unicode)rS   ZqstrrP   rP   rQ   rU     s   z+Editor.__load_temp_file.<locals>.<listcomp>zutf-8N)rK   rL   r³  r    r±   r´   rµ   r-   r³   r+   r¶   r/  rø   )ra   r   r­  rP   rP   rQ   Z__load_temp_file…  s    



zEditor.__load_temp_filec             C   s0   |   ¡ }|dk	r,t t |¡¡}| j |¡ dS )z1Set current script directory as working directoryN)rã   rK   Údirnamerø  r}  r  )ra   rÏ  Z	directoryrP   rP   rQ   Z__set_workdir˜  s    zEditor.__set_workdirc             C   sT   |dkrdS || j kr"| j  |¡ | j  d|¡ t| j ƒ|  d¡krP| j  d¡ dS )zAdd to recent file listNr   Úmax_recent_filesr¯  )r¬   r\   Úinsertr²  rš   rM   )ra   rÏ  rP   rP   rQ   Z__add_recent_file   s    
zEditor.__add_recent_filec             C   s4   x.| j dd… D ]}|j|dd}|  |¡ qW dS )z¹Clone file (*src_editor* widget) in all editorstacks
        Cloning from the first editorstack in which every single new editor
        is created (when loading or creating a new file)rn   NF)Úset_current)rÀ   Zclone_editor_fromrÙ   )ra   r
  rû   r¢   rP   rP   rQ   Ú_clone_file_everywhereª  s    zEditor._clone_file_everywherec          	   C   s"  d}y¬|dkršd}t  | j¡\}}t d|¡}|r<| d¡}t  tj 	dd¡¡}|sht  tj 	dd	¡¡}t
 ¡ |d
œ}	y||	 }W q® tk
r–   Y q®X nd}t  | j¡d }W n( ttfk
rØ   d}d}d}d}Y nX dd„ }
|dkrô|  ¡ }n|}|dk}|r–x,|
| jƒ}|  jd7  _t |¡sP qW tƒ }| jj ¡ dk	rZ| jj ¡ }n(|  ¡ }|dk	r‚|| jkr‚t |¡}t t ||¡¡}n2t t|ƒ¡}| |¡}|dk	rÈ| |¡sÈdS | j d  !|||||¡}| j "¡ |_#|  $|¡ | %|j&¡}|  '|¡ |s| j(dd dS )z®
        Create a new file - Untitled
        
        fname=None --> fname will be 'untitledXX.py' but do not create file
        fname=<basestring> --> create file
        FNTz!-*- coding: ?([a-z0-9A-Z\-]*) -*-rn   ZUSERNAMErk   ZUSERú-)ZdateÚusernamezutf-8c             S   s   t tdƒƒd|   S )NZuntitledz%d.py)r+   r    )ÚnrP   rP   rQ   r©   Þ  s    zEditor.new.<locals>.<lambda>r   )rÊ  ))r-   Úreadr°   ÚreÚsearchÚgroupÚto_unicode_from_fsr±   rÐ   rH   ÚtimeZctimeÚ	ExceptionÚIOErrorÚOSErrorr  rÞ   rK   rL   r5   r£   r·   Úget_active_projectr  rã   r³  rû  rø  rµ   r+   rÛ  r;  rÀ   r/  rÓ   rà  rÿ  rß  rO   rÙ   r4  )ra   rÏ  rû   r­  ÚemptyZdefault_contentÚencZ	enc_matchr  ZVARSZcreate_fnameÚ
current_esZcreated_from_hereÚbasedirÚc_fnamer‹   r
  rë   rP   rP   rQ   r/  ²  sr    








z
Editor.newc             C   s   |   | j¡ dS )zEdit new file templateN)rø   r°   )ra   rP   rP   rQ   r•     s    zEditor.edit_templatec             C   s²   g }x0| j D ]&}|  |¡dkrt |¡r| |¡ qW | j ¡  |r„x>|D ]6}t| |t 	d¡| j
d}| t|ƒ¡ | j |¡ qJW | j t|ƒdk¡ t| jd| j| jfƒ dS )zUpdate recent file menuNZFileIcon)re   r  r   )r¬   rÞ  rK   rL   r±  rm  rê  r2   rd   re   rø   ZsetDatar   rì  rl  r‰   r²  r3   rj  )ra   r¬   rÏ  râ  rP   rP   rQ   rn    s    


zEditor.update_recent_file_menuc             C   s
   g | _ dS )zClear recent files listN)r¬   )ra   rP   rP   rQ   rk    s    zEditor.clear_recent_filesc             C   sB   |   ¡ }t |tdƒtdƒ|  d¡dd¡\}}|r>|  d|¡ dS )zChange max recent files entriesr`   zMaximum number of recent filesrü  rn   é#   N)r  r   ZgetIntr    rš   r  )ra   rû   ZmrfZvalidrP   rP   rQ   ri  "  s    zEditor.change_max_recent_filesrk   Tc                sj  |   ¡ }|dk	r$| d¡}|  ¡ }nd\}}|sP|  ¡ }	t|	tƒrPt|	 ¡ tƒ}|sRt	ƒ }
| j
dkrntƒ | _
| jdkr€tƒ | _|  ¡ }|dk	r¤|| jkr¤t |¡}
| j d¡ |  ¡ }|dk	rØt| j
t |¡d ƒ}nd}tƒ st|tdƒ|
| j|tjd\}}n&t|tdƒtjd	}| ¡ r,| ¡ }| j d
¡ |rNdd„ |D ƒ}ndS t ¡ }| j r–| j! "¡ s–|| j kr„| j d }| #¡  | $¡  nJ| j!rà| j%sà| j! &|¡sàt|t'ƒsà| j! (d
¡ | j! #¡  | j! $¡  dd„ ‰ t)|dƒrüt*|ƒ}t|t*ƒsˆ |ƒg}n‡ fdd„t*|ƒD ƒ}t|t+ƒr>|g}n |dk	r^t,|ƒt,|ƒkr^d}xt-|ƒD ]ø\}}|  .||¡}|dkr t /|¡s˜qj|  |¡}| j0d j1|dd}| j2 3¡ |_4|  5|¡ | .|¡}| 6t7|ƒ¡ |  8|¡ | 9¡  |  :|¡ |dk	r6|j;|| |d | d¡}|  <||||¡ | =¡  | #¡  | >¡  $¡  |rjt ?¡  qjW dS )ar  
        Load a text file
        editorwindow: load in this editorwindow (useful when clicking on 
        outline explorer with multiple editor windows)
        processevents: determines if processEvents() should be called at the
        end of this method (set to False to prevent keyboard events from
        creeping through to the editor during debugging)
        Nr­   )NNFrn   rk   z	Open file)ÚselectedfilterÚoptions)r  Tc             S   s   g | ]}t  |¡‘qS rP   )rK   r÷  )rS   rÏ  rP   rP   rQ   rU   e  s    zEditor.load.<locals>.<listcomp>r   c             S   sN   t  t | ¡¡} tjdkrJt| ƒdkrJ| d dkrJ| d  ¡ | dd …  } | S )Nr¤   ru   rn   ú:r   )rK   rø  r-   r  r±   r²   r²  rë  )rÏ  rP   rP   rQ   Ú_converty  s    "zEditor.load.<locals>._convertZreplaceInStringsc                s   g | ]}ˆ |ƒ‘qS rP   rP   )rS   rÏ  )r  rP   rQ   rU   …  s    )rþ  )rö   )@râ   rä   rã   ZsenderrV   r   r   r  r+   r5   rà   r&   rá   r'   r³  rK   rû  r|  r  r  r(   Úsplitextr"   r   r    r   ZHideNameFilterDetailsZDontUseNativeDialogÚexec_ZselectedFilesr   r‡  rÂ   rî   rï   ÚsetFocusrñ   Zismaximizedrˆ  r;   Z
setVisibleÚhasattrrI   rW   r²  Ú	enumeraterß  rL   rÀ   rø   r£   rÓ   rà  rÿ  Zset_breakpointsrX   rÙ   Zanalyze_scriptÚ_Editor__add_recent_filerg  Úcursor_movedZ
clearFocusrÖ  rö  )ra   rô   rõ   rö   r÷   ZprocesseventsZeditor0Ú	position0Ú	filename0râ  r  r  Zparent_widgetr  Z_sfÚdialogÚfocus_widgetr‹   rO   rë   r  r
  rì   rP   )r  rQ   rø   ,  s¨    




















zEditor.loadc             C   sœ   |   ¡ }|  ¡ }ttj|  d¡d}t||ƒ}| ¡ rD| t	j
d¡ | j d¡ | ¡ }| j d¡ |tjkr˜|  tdƒ¡ | |¡ | |¡ |  ¡  dS )zPrint current fileÚprinter_header)ÚmodeÚheader_fontTFzPrinting...N)râ   rã   r:   r   ÚHighResolutionr  r   Zhas_selected_textZ	setOptionr   ZPrintSelectionr|  r  r  r   ZAcceptedr¶  r    Z
setDocNameÚprint_r·  )ra   r¢   rO   ÚprinterZprintDialogZanswerrP   rP   rQ   r:  «  s    



zEditor.print_filec                sv   ddl m} |  ¡ ‰ ttj|  d¡d}||| ƒ}| tj	¡ |j
 ‡ fdd„¡ | j d¡ | ¡  | j d¡ d	S )
zPrint preview for current filer   )ÚQPrintPreviewDialogr"  )r#  r$  c                s
   ˆ   | ¡S )N)r&  )r'  )r¢   rP   rQ   r©   È  s    z&Editor.print_preview.<locals>.<lambda>FTN)Úqtpy.QtPrintSupportr(  râ   r:   r   r%  r  ZsetWindowFlagsr   ZWindowZpaintRequestedr™   r|  r  r  )ra   r(  r'  ZpreviewrP   )r¢   rQ   r9  ¾  s    
zEditor.print_previewc             C   s   |   ¡ }| ¡  dS )zClose current fileN)r  r;  )ra   rû   rP   rP   rQ   r;  Í  s    zEditor.close_filec             C   s   | j d  ¡  dS )zClose all opened scriptsr   N)rÀ   r<  )ra   rP   rP   rQ   r<  Ó  s    zEditor.close_all_filesc             C   s   |   ¡ }|j||dS )z	Save file)r‹   rÊ  )r  r4  )ra   r‹   rÊ  rû   rP   rP   rQ   r4  Ø  s    zEditor.savec             C   s&   |   ¡ }| ¡ r"| ¡ }|  |¡ dS )z#Save *as* the currently edited fileN)r  r7  rã   r  )ra   rû   rÏ  rP   rP   rQ   r7  Þ  s    zEditor.save_asc             C   s   |   ¡ }| ¡  dS )z(Save *copy as* the currently edited fileN)r  r8  )ra   rû   rP   rP   rQ   r8  æ  s    zEditor.save_copy_asc             C   s   |   ¡  ¡  dS )zSave all opened filesN)r  r  )ra   rP   rP   rQ   r  ì  s    zEditor.save_allc             C   s   |   ¡ }| ¡  dS )z*Revert the currently edited file from diskN)r  r  )ra   rû   rP   rP   rQ   r  ñ  s    zEditor.revertc             C   s"   |   ¡ }|j ¡  |jj ¡  dS )z	Find slotN)r  rÖ   rð   Zsearch_textr  )ra   rû   rP   rP   rQ   r  ÷  s    
zEditor.findc             C   s   |   ¡ }|j ¡  dS )zFnd next slotN)r  rÖ   r=  )ra   rû   rP   rP   rQ   r=  þ  s    zEditor.find_nextc             C   s   |   ¡ }|j ¡  dS )zFind previous slotN)r  rÖ   r>  )ra   rû   rP   rP   rQ   r>    s    zEditor.find_previousc             C   s   |   ¡ }|j ¡  dS )zReplace slotN)r  rÖ   Zshow_replace)ra   rû   rP   rP   rQ   r  
  s    zEditor.replacec             C   sF   |   ¡ }| ¡ }t|ƒdkrB|d }| |¡ | |¡ |  |¡ dS )z Reopens the last closed tab.r   N)r  Zget_last_closed_filesr²  r\   Zset_last_closed_filesrø   )ra   rû   Zlast_closed_filesZfile_to_openrP   rP   rQ   r1    s    

zEditor.open_last_closedc             C   s:   t  t|ƒ¡}| jd  |¡}|dk	r6| jd  |¡ dS )zClose file from its namer   N)rK   rø  r+   rÀ   rÛ  r;  )ra   rO   r‹   rP   rP   rQ   Úclose_file_from_name  s    zEditor.close_file_from_namec             C   s   |   |¡ dS )z?File was removed in file explorer widget or in project explorerN)r*  )ra   rO   rP   rP   rQ   Úremoved"  s    zEditor.removedc             C   s>   t  t|ƒ¡}x*|  ¡ D ]}t  |¡ |¡r|  |¡ qW dS )z0Directory was removed in project explorer widgetN)rK   rø  r+   rÚ  Ú
startswithr*  )ra   rû  rÏ  rP   rP   rQ   Úremoved_tree&  s    zEditor.removed_treec             C   sL   t  t|ƒ¡}| jd  |¡}|dk	rHx | jD ]}|j|t|ƒd q.W dS )z?File was renamed in file explorer widget or in project explorerr   N)Únew_filename)rK   rø  r+   rÀ   rÛ  rÎ  )ra   ÚsourceÚdestrO   r‹   rû   rP   rP   rQ   Úrenamed-  s    zEditor.renamedc             C   sV   t  t|ƒ¡}t|ƒ}x:|  ¡ D ].}t  |¡ |¡r | ||¡}| j||d q W dS )z>Directory was renamed in file explorer or in project explorer.)r/  r0  N)rK   rø  r+   rÚ  r,  r  r1  )ra   r/  r0  rû  ZtofilerÏ  r.  rP   rP   rQ   Úrenamed_tree6  s    zEditor.renamed_treec             C   s   |   ¡ }|dk	r| ¡  dS )z Indent current line or selectionN)râ   r*  )ra   r¢   rP   rP   rQ   r*  @  s    zEditor.indentc             C   s   |   ¡ }|dk	r| ¡  dS )z"Unindent current line or selectionN)râ   r+  )ra   r¢   rP   rP   rQ   r+  G  s    zEditor.unindentc             C   s   |   ¡ }|dk	r| ¡  dS )z.Change current line or selection to uppercase.N)râ   Ztransform_to_uppercase)ra   r¢   rP   rP   rQ   r^  N  s    zEditor.text_uppercasec             C   s   |   ¡ }|dk	r| ¡  dS )z.Change current line or selection to lowercase.N)râ   Ztransform_to_lowercase)ra   r¢   rP   rP   rQ   r_  U  s    zEditor.text_lowercasec             C   s   |   ¡ }|dk	r| ¡  dS )z!Comment current line or selectionN)râ   r[  )ra   r¢   rP   rP   rQ   r[  \  s    zEditor.toggle_commentc             C   s   |   ¡ }|dk	r| ¡  dS )z'Block comment current line or selectionN)râ   r\  )ra   r¢   rP   rP   rQ   r\  c  s    zEditor.blockcommentc             C   s   |   ¡ }|dk	r| ¡  dS )z*Un-block comment current line or selectionN)râ   r]  )ra   r¢   rP   rP   rQ   r]  j  s    zEditor.unblockcommentc             C   s0   |   ¡  |  ¡ }| ¡ }|  ¡ }|  ||¡ d S )N)rò   râ   rJ  rã   rå   )ra   r¢   rì   rO   rP   rP   rQ   rJ  p  s
    zEditor.go_to_next_todoc             C   s0   |   ¡  |  ¡ }| ¡ }|  ¡ }|  ||¡ d S )N)rò   râ   rN  rã   rå   )ra   r¢   rì   rO   rP   rP   rQ   rN  x  s
    zEditor.go_to_next_warningc             C   s0   |   ¡  |  ¡ }| ¡ }|  ¡ }|  ||¡ d S )N)rò   râ   rR  rã   rå   )ra   r¢   rì   rO   rP   rP   rQ   rR  €  s
    zEditor.go_to_previous_warningc             C   s\   |   ¡ rX|  ¡ }t|ƒ}|dkr*g }d}n| ¡  ¡ }| ¡ }tjt|g| |pRdd dS )z Run winpdb to debug current fileN)Úcwd)	r4  rã   rC   Úget_argumentsÚsplitZget_working_directoryr.   Zrun_programrC  )ra   rÏ  ÚrunconfÚargsÚwdirrP   rP   rQ   rA  ˆ  s    zEditor.run_winpdbc             C   s.   |r*|   ¡ }| jr*|  ¡  | t |¡¡ d S )N)râ   r¯   rò   Zset_eol_charsr/   Zget_eol_chars_from_os_name)ra   rô  r-  r¢   rP   rP   rQ   r,  š  s
    zEditor.toggle_eol_charsc             C   s   |   ¡  |  ¡ }| |¡ d S )N)rò   râ   r”  )ra   r-  r¢   rP   rP   rQ   rd  ¡  s    zEditor.toggle_show_blanksc             C   s   |   ¡  |  ¡ }| ¡  d S )N)rò   r  rc  )ra   rû   rP   rP   rQ   rc  §  s    zEditor.remove_trailing_spacesc             C   s   |   ¡  |  ¡ }| ¡  d S )N)rò   r  rf  )ra   rû   rP   rP   rQ   rf  ­  s    zEditor.fix_indentationc             C   sX   | j  | jd k	¡ | j | jd k	o*| jdk¡ | j | jd k	oP| jt| jƒd k ¡ d S )Nr   rn   )rV  r‰   rÌ   rX  rÎ   rZ  r²  rÍ   )ra   rP   rP   rQ   ræ   ´  s    zEditor.update_cursorpos_actionsc             C   sÜ   | j r
d S x„t| jd d … ƒD ]n\}\}}||kr||ksB|dkr|rf||f| j|< || _|  ¡  d S | j|kr~|  jd8  _| j |¡ P qW | jd k	r°| jd | jd … | _| j ||f¡ t| jƒd | _|  ¡  d S )Nr   rn   )rÏ   r  rÍ   rÎ   ræ   rM   r±  r²  )ra   rO   rì   Úfcr‹   rÏ  ÚposrP   rP   rQ   rå   ¼  s&     

z%Editor.add_cursor_position_to_historyc             C   s$   |dk	r|   ||¡ |   ||¡ dS )zCursor was just moved: 'go to'N)rå   )ra   r  r  Z	filename1Z	position1rP   rP   rQ   r  Ó  s    zEditor.cursor_movedc             C   s   t |ƒ|f| _d S )N)r+   rÌ   )ra   rO   rì   rP   rP   rQ   rÄ  Ù  s    zEditor.text_changed_atc             C   s   | j t|ƒ|dd d S )NT)r9  )rå   r+   )ra   rO   rì   rP   rP   rQ   rÅ  Ü  s    zEditor.current_file_changedc             C   sX   | j d k	rT| j \}}t |¡s(d | _ d S |  |¡ |  ¡ }|| ¡  ¡ k rT| |¡ d S )N)rÌ   rK   rL   rø   râ   rã  ÚcharacterCountÚset_cursor_position)ra   rO   rì   r¢   rP   rP   rQ   rU  à  s    



zEditor.go_to_last_edit_locationc             C   sê   | j d krd S | j| j  \}}||  ¡  d¡f| j| j < d| _| j }tt| jƒd td| j | gƒgƒ| _ | j| j  \}}t 	|¡s¬| j 
| j ¡ | j |k r¤|d8 }|| _ n,|  |¡ |  ¡ }|| ¡  ¡ k rØ| |¡ d| _|  ¡  d S )Nr­   Trn   r   F)rÎ   rÍ   râ   rä   rÏ   Úminr²  ÚmaxrK   rL   rM   rø   rã  r;  r<  ræ   )ra   Z
index_moverO   Z	_positionZ	old_indexrì   r¢   rP   rP   rQ   Z__move_cursor_positioní  s,    




zEditor.__move_cursor_positionc             C   s   |   ¡  |  d¡ d S )Nr¯  )rò   Ú_Editor__move_cursor_position)ra   rP   rP   rQ   rW  	  s    z%Editor.go_to_previous_cursor_positionc             C   s   |   ¡  |  d¡ d S )Nrn   )rò   r?  )ra   rP   rP   rQ   rY  	  s    z!Editor.go_to_next_cursor_positionc             C   s   |   ¡ }|dk	r| |¡ dS )zOpen 'go to line' dialogN)r  rg  )ra   Úlinerû   rP   rP   rQ   rg  	  s    zEditor.go_to_linec             C   s$   |   ¡ }|dk	r |  ¡  | ¡  dS )zSet/Clear breakpointN)r  rò   r?  )ra   rû   rP   rP   rQ   r?  	  s    zEditor.set_or_clear_breakpointc             C   s$   |   ¡ }|dk	r |  ¡  | ¡  dS )zSet/Edit conditional breakpointN)r  rò   r@  )ra   rû   rP   rP   rQ   r@   	  s    z)Editor.set_or_edit_conditional_breakpointc             C   sN   |   ¡  tƒ  | j ¡  |  ¡ }|dk	rBx|jD ]}|j ¡  q0W |  ¡  dS )zClear breakpoints in all filesN)	rò   r[   rú  r  r  r  r¢   Zclear_breakpointsr  )ra   rû   r  rP   rP   rQ   r[   (	  s    
zEditor.clear_all_breakpointsc             C   sL   t ||ƒ | j ¡  |  ¡ }|dk	rH|  |¡}|dk	rH|j| j |¡ dS )zRemove a single breakpointN)r^   rú  r  r  rÞ  r  r¢   Zadd_remove_breakpoint)ra   rO   rT   rû   r‹   rP   rP   rQ   r^   4	  s    


zEditor.clear_breakpointc             C   s2   |   ¡  | jj |¡ | jj ¡ }|r.| ¡  dS )zDebug actionsN)rò   r£   Z
ipyconsoleZwrite_to_stdinr  r  )ra   Zcommandr!  rP   rP   rQ   r!  >	  s
    zEditor.debug_commandc                sv   t ˆ ƒ}|j ‡ fdd„¡ ˆ jd k	r2| ˆ j¡ t ˆ  ¡ ¡}| |¡ | 	¡ rr|j
}|d k	rrˆ  |¡ ˆ  ¡  d S )Nc                s
   ˆ   | ¡S )N)Úset_dialog_size)r°  )ra   rP   rQ   r©   J	  s    z0Editor.edit_run_configurations.<locals>.<lambda>)rD   Úsize_changer™   rÆ   r×  rK   rø  rã   Úsetupr  Zfile_to_runrø   rE  )ra   r   rÏ  rP   )ra   rQ   rF  G	  s    


zEditor.edit_run_configurationsc                s”  ˆ   ¡ }| ¡ rˆ  ¡ }t ˆ  ¡ ¡}t |¡}| dd¡ dd¡}| dd¡ dd¡}t|ƒ}|dkrðt	ˆ ƒ}|j
 ‡ fdd„¡ ˆ jdk	rœ| ˆ j¡ | |¡ t dd	tƒ  ¡rÌd
}t dd	d¡ nt dt¡}|rè| ¡ sèdS | ¡ }| ¡ }	| ¡ }
|j}|j}|j}|j}|j}|jr,|}n(|jr:d}nt |j ¡rP|j }nd}d
}|||	||||
||||fˆ _!ˆ  "¡  |s|s| #¡  dS )z5Run script inside current interpreter or in a new oneú'z\'ú"z\"Nc                s
   ˆ   | ¡S )N)rA  )r°  )ra   rP   rQ   r©   i	  s    z!Editor.run_file.<locals>.<lambda>rF   Zopen_at_least_onceTFrk   )$r  r4  râ   rK   rø  rã   rû  r  rC   rE   rB  r™   rÆ   r×  rC  r#   rH   r"   rY   rB   r  Zget_configurationr4  Zget_python_argumentsÚinteractÚpost_mortemÚcurrentÚsystermÚclear_namespaceZfile_dirZcw_dirÚisdirÚdirrß   rG  r  )ra   r  rû   r¢   rÏ  rû  r6  r   Zshow_dlgr7  Úpython_argsrF  rG  rH  rI  rJ  r8  ÚpythonrP   )ra   rQ   rE  U	  sV    






zEditor.run_filec             C   s
   || _ d S )N)rÆ   )ra   rØ  rP   rP   rQ   rA  š	  s    zEditor.set_dialog_sizec             C   s   |   ¡  | jdd dS )zDebug current scriptT)r  N)rò   rE  )ra   rP   rP   rQ   rD  	  s    zEditor.debug_filec             C   sz   |   d¡r|  ¡  | jdkr dS | j\}}}}}}}}}	}
}|	sZ| j |||||
||¡ n| j ||||||||	|
¡	 dS )zRe-run last scriptr{   N)rš   r  rß   Úrun_in_current_ipyclientr  r£   Zopen_external_console)ra   rÏ  r8  r7  rF  r  rN  rM  rH  rI  rG  rJ  rP   rP   rQ   rG  £	  s    


zEditor.re_run_filec             C   s   |   ¡ }| ¡  dS )z1Run selection or current line in external consoleN)r  r%  )ra   rû   rP   rP   rQ   r%  ¶	  s    zEditor.run_selectionc             C   s   |   ¡ }| ¡  dS )zRun current cellN)r  r&  )ra   rû   rP   rP   rQ   r&  ¼	  s    zEditor.run_cellc             C   s   |   ¡ }| ¡  dS )z,Run current cell and advance to the next oneN)r  rH  )ra   rû   rP   rP   rQ   rH  Â	  s    zEditor.run_cell_and_advancec             C   s   |   ¡ }| ¡  dS )zRun last executed cell.N)r  rI  )ra   rû   rP   rP   rQ   rI  È	  s    zEditor.re_run_last_cellc             C   sd   |   ¡  ¡ }|dkr(|  ¡ }| |¡ n0| ¡ }| ¡ | }|dkrX| |¡ | |¡ | ¡  dS )zZoom in/out/resetr   N)r  râ   r  Zset_fontr„  Z	pointSizeZsetPointSizeZupdate_tab_stop_width_spaces)ra   Zfactorr¢   r„  rØ  rP   rP   rQ   r®  Ï	  s    

zEditor.zoomc       D      C   sÐ  | j dk	rÌd}|  ¡ }d}|  |¡}d}|  |¡}d}|  |¡}	d}
|  |
¡}d}|  |¡}xz| j D ]p}||kr|| |¡ ||krŽ| |¡ ||kr | |¡ ||kr²| |	¡ |
|krÄ| |¡ ||krf| |¡ qfW d}|  |¡}d	}|  |¡}d
}|  |¡}d}|  |¡}d}|  |¡}d}|  |¡}d}|  |¡}d}|  |¡}d}|  |¡} d}!|  |!¡}"d}#|  |#¡}$d}%|  |%¡}&d}'|  |'¡}(d})|  |)¡}*d}+|  |+¡},d}-|  |-¡}.d}/|  |/¡}0d}1|  |1¡}2d}3|  |3¡}4d}5|  |5¡}6d}7t	 
dd¡}8d}9|  |9¡}:d };|  |;¡}<d!}=|  |=¡}>d"}?|  |?¡}@d#}A|  |A¡}B|  ¡ }Cx6| j D ]*}||krt| |¡ ||krŒ|j||Cd$ ||kr¬| |¡ | j |¡ ||krÀ| |¡ ||krÔ| |¡ ||krè| |¡ ||krü| |¡ ||kr| |¡ ||kr$| | ¡ |!|kr8| |"¡ |#|krL| |$¡ |%|kr`| |&¡ |'|krt| |(¡ |)|krˆ| |*¡ |+|krœ| |,¡ |-|kr°| |.¡ |/|krÄ| |0¡ |1|krØ| |2¡ |3|krì|  |4¡ |5|kr | !|6¡ |7|kr| "|8¡ |9|kr,|j#|:|Cd$ |;|krD|j$|<|Cd$ |=|kr\|j%|>|Cd$ |?|krp| &|@¡ |A|krZ| '|B¡ qZW |Cdk	rÌ|9|kr¬|:r¬|C (¡  |;|ksÀ|=|krÌ|C )|<|>¡ dS )%z*Apply configuration file's plugin settingsNZcolor_scheme_namero   rp   rq   zoccurrence_highlighting/timeoutr|   rg   rh   ri   rj   rl   rt   rŽ   r   r‘   zcodecompletion/autozcodecompletion/case_sensitivezcodecompletion/enter_keyr}   r~   r€   r   r‚   rƒ   r„   r…   Zconnect_to_oir¹   zconnect/editorr’   zcode_analysis/pyflakeszcode_analysis/pep8r“   zrealtime_analysis/timeout)Zcurrent_finfo)*rÀ   r‚  rš   Zset_color_schemer§  r¨  r©  rª  r  r#   rH   rÝ  r«  r•  r”  re  ró  r–  r—  r¤  r¥  r¦  r¬  r˜  r™  rš  r›  rœ  rž  rŸ  r   r¡  r¢  r£  rµ  r‘  r  r  r’  r“  Zrun_todo_finderZrun_code_analysis)Dra   r  Zcolor_scheme_nZcolor_scheme_oZcurrentline_nZcurrentline_oZcurrentcell_nZcurrentcell_oZoccurrence_nZoccurrence_oZoccurrence_timeout_nZoccurrence_timeout_oZfocus_to_editor_nZfocus_to_editor_orû   Ztabbar_nZtabbar_oZlinenb_nZlinenb_oZblanks_nZblanks_oZ
edgeline_nZ
edgeline_oZedgelinecol_nZedgelinecol_oZwrap_nZwrap_oZtabindent_nZtabindent_oZibackspace_nZibackspace_oZremovetrail_nZremovetrail_oZ
autocomp_nZ
autocomp_oZcase_comp_nZcase_comp_oZenter_key_nZenter_key_oZ
calltips_nZ
calltips_oZ	gotodef_nZ	gotodef_oZ
closepar_nZ
closepar_oZclose_quotes_nZclose_quotes_oZadd_colons_nZadd_colons_oZautounindent_nZautounindent_oZindent_chars_nZindent_chars_oZtab_stop_width_spaces_nZtab_stop_width_spaces_oZhelp_nZhelp_oZtodo_nZtodo_oZ
pyflakes_nZ
pyflakes_oZpep8_nZpep8_oZrt_analysis_nZrt_analysis_oZrta_timeout_nZrta_timeout_or
  rP   rP   rQ   Úapply_plugin_settingsÞ	  s    















































































zEditor.apply_plugin_settingsc             C   s&   | j d }g }|dd„ |jD ƒ7 }|S )z/Get the list of open files in the current stackr   c             S   s   g | ]
}|j ‘qS rP   )rO   )rS   r
  rP   rP   rQ   rU   
  s    z-Editor.get_open_filenames.<locals>.<listcomp>)rÀ   r  )ra   rû   rô   rP   rP   rQ   Úget_open_filenames{
  s    
zEditor.get_open_filenamesc             C   s,   | j dk	r(| j  ¡ s(|  ¡ }|  d|¡ dS )zá
        Set the recent opened files on editor based on active project.

        If no project is active, then editor filenames are saved, otherwise
        the opened filenames are stored in the project config info.
        Nrô   )r·   r  rQ  r  )ra   rô   rP   rP   rQ   r  ‚
  s    

zEditor.set_open_filenamesc             C   sä   |   d¡ d}| jdk	r"| j ¡ }|r2| j ¡ }n| jdg d}|  ¡  |rÎtdd„ |D ƒƒrÎ|  |¡ | jrÖd| _|  dd¡}|dk	r”| j	 
|¡ |  dg ¡}x|D ]}| j |¡ q¦W |  | | jd	 ¡ n|  ¡  |   d
¡ dS )z(Open the list of saved files per projectFNrô   )r   c             S   s   g | ]}t  |¡‘qS rP   )rK   rL   )rS   ÚfrP   rP   rQ   rU   ›
  s    z+Editor.setup_open_files.<locals>.<listcomp>r  r  r   T)Úset_create_new_file_if_emptyr·   r  Zget_project_filenamesrš   r<  rå  rø   r¿   rÚ   rÑ  rÃ   r±  r‰  rÀ   r  )ra   r  rô   ré   Z
win_layoutr  rP   rP   rQ   Úsetup_open_filesŽ
  s*    




zEditor.setup_open_filesc             C   s   |   d|  ¡ ¡ dS )zSave the list of open filesrô   N)r  rQ  )ra   rP   rP   rQ   Úsave_open_filesª
  s    zEditor.save_open_filesc             C   s   x| j D ]
}||_qW dS )z,Change the value of create_new_file_if_emptyN)rÀ   Zcreate_new_file_if_empty)ra   Úvaluerû   rP   rP   rQ   rS  ®
  s    z#Editor.set_create_new_file_if_empty)F)F)N)N)N)N)NNN)NNrk   NT)NF)F)N)F)˜rŸ   r    r¡   Ú__doc__ZCONF_SECTIONr_   ZCONFIGWIDGET_CLASSr!   r³  r°   ZDISABLE_ACTIONS_WHEN_HIDDENr	   rÜ   ÚboolrO  r{  r|  r}  rú  Zrun_in_current_extconsolerõ  r®   rí   r
   ró   rù   rü   rþ   r  r  r  rØ   r  r  rz  r€  r†  r  r‰  rŠ  rŒ  rŽ  rÇ  rÈ  rÉ  r¹  rº  r»  r¸  rÔ   r¼  rÙ  rÕ  rÚ  rÜ  r  râ   rÝ  rã   rÞ  rß  rÕ   rá  rÂ  r	  rQ  r¾  rM  r¿  rÃ  r½  rÀ  rÁ  r¨   rZ   r  rh  r  rÿ  r/  r•   rn  rk  ri  rW   Úobjectrø   r:  r9  r;  r<  r4  r7  r8  r  r  r  r=  r>  r  r1  r*  r+  r-  r1  r2  r*  r+  r^  r_  r[  r\  r]  rJ  rN  rR  rA  r,  rd  rc  rf  ræ   rå   r  rÄ  rÅ  rU  r?  rW  rY  rg  r?  r@  r[   r^   r!  rF  rE  rA  rD  rG  r%  r&  rH  rI  r®  rP  rQ  r  rT  rU  rS  rP   rP   rP   rQ   r`   q  s:  
 		     	z		
S

 z	

	D 
r`   )mrW  r±   Úos.pathrà  rK   r  r  Zqtpyr   r   Zqtpy.compatr   r   r   Zqtpy.QtCorer   r   r	   r
   Z
qtpy.QtGuir   r)  r   r   r   Zqtpy.QtWidgetsr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   Zspyderr   Zspyder.config.baser    r!   r"   Zspyder.config.mainr#   r$   r%   Zspyder.config.utilsr&   r'   r(   Zspyder.py3compatr)   r*   r+   Zspyder.utilsr,   r-   r.   r/   r0   rd   Z"spyder.utils.introspection.managerr1   Zspyder.utils.qthelpersr2   r3   r4   Zspyder.utils.miscr5   Zspyder.widgets.findreplacer6   Zspyder.widgets.editorr7   r8   r9   r:   Z$spyder.widgets.sourcecode.codeeditorr;   Zspyder.widgets.statusr<   r=   r>   r?   Zspyder.pluginsr@   Zspyder.plugins.configdialogrA   Zspyder.plugins.runconfigrB   rC   rD   rE   ZNBCONVERT_REQVERÚaddrR   rX   rZ   r[   r^   Zfind_programrC  r_   r`   rP   rP   rP   rQ   Ú<module>   sP   H	
  