ó
‹²,]c           @   sE  d  Z  d d l Z d d l j 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 l0 m1 Z1 m2 Z2 m3 Z3 d d l4 m5 Z5 m6 Z6 m7 Z7 d d l8 m9 Z9 m: Z: m; Z; d d l< m= Z= m> Z> m? Z? m@ Z@ d d l< mA ZB d d lC mD ZD d d lE mF ZF mG ZG mH ZH d d lI mJ ZJ d d lK mL ZL d d lM mN ZN mO ZO mP ZP mQ ZQ d d lR mS ZS d d lT mU ZU mV ZV mW ZW mX ZX d d lY mZ ZZ d d l[ m\ Z\ d d l] m^ Z^ m_ Z_ m` Z` ma Za d Zb e+ jc d e- d ƒ d eb ƒd „  Zd d „  Ze d  „  Zf d! „  Zg d" „  Zh e? ji d# ƒ Zj d$ e\ f d% „  ƒ  YZk d& eZ f d' „  ƒ  YZl d S((   s   Editor PluginiÿÿÿÿN(   t   APIt   PYQT5(   t   from_qvariantt   getopenfilenamest   to_qvariant(   t
   QByteArrayt   Qtt   Signalt   Slot(   t   QKeySequence(   t   QAbstractPrintDialogt   QPrintDialogt   QPrinter(   t   QActiont   QActionGroupt   QApplicationt   QDialogt   QFileDialogt   QGridLayoutt	   QGroupBoxt   QHBoxLayoutt   QInputDialogt   QLabelt   QMenut	   QSplittert
   QTabWidgett   QToolBart   QVBoxLayoutt   QWidget(   t   dependencies(   t   _t   get_conf_patht   running_under_pytest(   t   CONFt   RUN_CELL_SHORTCUTt   RUN_CELL_AND_ADVANCE_SHORTCUT(   t   get_edit_filetypest   get_edit_filterst
   get_filter(   t   PY2t   qbytearray_to_strt   to_text_string(   t   codeanalysist   encodingt   programst
   sourcecode(   t   icon_manager(   t   IntrospectionManager(   t   create_actiont   add_actionst   MENU_SEPARATOR(   t   getcwd_or_home(   t   FindReplace(   t   EditorMainWindowt   EditorSplittert   EditorStackt   Printer(   t
   CodeEditor(   t   CursorPositionStatust   EncodingStatust	   EOLStatust   ReadWriteStatus(   t   SpyderPluginWidget(   t   PluginConfigPage(   t   ALWAYS_OPEN_FIRST_RUN_OPTIONt   get_run_configurationt   RunConfigDialogt   RunConfigOneDialogs   >=4.0t	   nbconverts*   Manipulate Jupyter notebooks on the Editort   required_versionc          C   sU   t  j d d i  ƒ }  x9 t |  j ƒ  ƒ D]% } t j | ƒ s( |  j | ƒ q( q( W|  S(   Nt   runt   breakpoints(   R!   t   gett   listt   keyst   ospt   isfilet   pop(   t   bp_dictt   filename(    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   _load_all_breakpoints?   s
    c         C   sT   t  ƒ  j |  g  ƒ } | rP t | d t ƒ rP g  | D] } | d  f ^ q5 } n  | S(   Ni    (   RP   RH   t
   isinstancet   intt   None(   RO   RG   t   lineno(    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   load_breakpointsG   s    "c         C   s=   t  j |  ƒ s d  St ƒ  } | | |  <t j d d | ƒ d  S(   NRF   RG   (   RK   RL   RP   R!   t   set(   RO   RG   RN   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   save_breakpointsO   s
    	
c           C   s   t  j d d i  ƒ d  S(   NRF   RG   (   R!   RV   (    (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   clear_all_breakpointsW   s    c         C   sX   t  |  ƒ } | rT x/ | D]& } | d | k r | j | ƒ q q Wt |  | ƒ n  d  S(   Ni    (   RU   t   removeRW   (   RO   RT   RG   t
   breakpoint(    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   clear_breakpoint[   s    t   winpdbt   EditorConfigPagec           B   s#   e  Z d  „  Z d „  Z d „  Z RS(   c         C   s
   t  d ƒ S(   Nt   Editor(   R   (   t   self(    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   get_nameh   s    c         C   s   t  j d ƒ S(   Nt   edit(   t   imat   icon(   R_   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   get_iconk   s    c   B         sÔ
  |  j  t d ƒ |  j j ƒ } t t d ƒ ƒ } |  j } | t d ƒ d ƒ } t ƒ  } | j | ƒ | j | ƒ t t 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 d ƒ d ƒ } | t d ƒ d ƒ } | t d ƒ d ƒ } |  j	 d t d ƒ d d d d d d d ƒ} | j
 j | j j ƒ | j
 j | j j ƒ | j j |  j d ƒ ƒ | j j |  j d ƒ ƒ | t d ƒ d  ƒ } t ƒ  } | j | d! d! ƒ | j | d d! ƒ | j |	 d" d! ƒ | j |
 j d" d ƒ | j |
 j d" d" ƒ | j | d# d! ƒ | j | d$ d! ƒ | j | d% d! ƒ | j | j d% d ƒ | j | j d% d" ƒ | j | d& d! ƒ t ƒ  } | j | ƒ | j d ƒ | j | ƒ t t d' ƒ ƒ } | t d( ƒ d) ƒ } t t d* ƒ ƒ } | t d+ ƒ d, ƒ } t t d- ƒ ƒ } t j d. ƒ } | r&| t d/ ƒ d0 ƒ } | t d1 ƒ d2 ƒ } | t d3 ƒ d4 ƒ } | t d5 ƒ d6 ƒ } | t d7 ƒ d8 d9 t d: ƒ ƒ} n t t d; ƒ ƒ } | j t ƒ t t d ƒ ƒ } | t d< ƒ d= ƒ } | t d> ƒ d? ƒ }  | t d@ ƒ dA ƒ }! | t dB ƒ dC ƒ }" |  j t dD ƒ t dE ƒ dF f t dG ƒ dH f t dI ƒ dJ f t dK ƒ dL f t dM ƒ dN f t dO ƒ dP f t dQ ƒ dR f t dS ƒ dT f f dU ƒ }# |  j	 t dV ƒ t dW ƒ dX d$ d dY d ƒ ‰  ‡  f dZ †  }$ |# j j j |$ ƒ | t d[ ƒ d\ d] t d9 t d^ ƒ ƒ}% | t d_ ƒ d` d] t ƒ}& | t da ƒ db d] t ƒ}' t t dc ƒ ƒ }( dd }) t t de ƒ j |) ƒ ƒ }* |* j t ƒ t j  ƒ  }+ t j! df ƒ d  k	 }, | t dg ƒ dh d] t d9 t di ƒ ƒ}- |- j |+ ƒ |+ s¢|- j# t dj ƒ t j$ ƒ n  | t dk ƒ dl d] t d9 t dm ƒ ƒ}. |. j |, ƒ | t dn ƒ do d] t ƒ}/ |  j% t dp ƒ dq t ƒ }0 |  j% t dr ƒ ds ƒ }1 |  j	 d t d ƒ dt d d d d d d ƒ}2 t ƒ  }3 |3 j |0 ƒ |3 j |2 ƒ t ƒ  }4 |4 j | ƒ | j |4 ƒ t ƒ  }5 |5 j | ƒ | j |5 ƒ t ƒ  }6 | r|6 j | ƒ |6 j | ƒ |6 j | ƒ |6 j | ƒ |6 j | ƒ n |6 j | ƒ | j |6 ƒ t ƒ  }7 |7 j |- ƒ t ƒ  }8 |8 j |. ƒ |8 j |* ƒ |7 j |8 ƒ |7 j |/ ƒ |7 j |3 ƒ |7 j |1 ƒ |( j |7 ƒ t ƒ  }9 |9 j | ƒ |9 j |" ƒ |9 j |! ƒ |9 j |  ƒ t ƒ  }: t ƒ  }; |; j |# j& d! d! ƒ |; j |# j d! d ƒ |; j ˆ  j' d d! ƒ |; j ˆ  j d d ƒ |; j ˆ  j d d" ƒ |: j |; ƒ |: j d ƒ |9 j |: ƒ |9 j |% ƒ |9 j |& ƒ |9 j |' ƒ | j |9 ƒ t t du ƒ ƒ }< t t dv ƒ ƒ }= |= j t ƒ | t dw ƒ dx d] t ƒ}> t ƒ  }? |? j |= ƒ |? j |> ƒ |< j |? ƒ t( ƒ  }@ |@ j) |  j* | | ƒ t dy ƒ ƒ |@ j) |  j* | |( ƒ t dz ƒ ƒ |@ j) |  j* | | | | |< ƒ t d{ ƒ ƒ t ƒ  }A |A j |@ ƒ |  j |A ƒ d  S(|   Ns   Edit template for new modulest	   Interfaces   Show tab bart   show_tab_bars   Source codes   Show line numberst   line_numberss   Show blank spacest   blank_spacess   Show vertical line aftert	   edge_linet    t
   characterst   edge_line_columniO   i   iô  s   Highlight current linet   highlight_current_lines   Highlight current cellt   highlight_current_cells   Highlight occurrences aftert   occurrence_highlightings    mss   occurrence_highlighting/timeoutt   min_id   t   max_i@B t   steps
   Wrap linest   wrapi    i   i   i   i   i   t   Runs$   Save all files before running scriptt   save_all_before_runs   Run selections>   Maintain focus in the Editor after running cells or selectionst   focus_to_editort   Introspectiont   ropes   Automatic code completions   codecompletion/autos   Case sensitive code completions   codecompletion/case_sensitives   Enter key selects completions   codecompletion/enter_keys   Display balloon tipst   calltipss   Link to object definitiont   go_to_definitiont   tips{   If this option is enabled, clicking on an object
name (left-click + Ctrl key) will go this object
definition (if resolved).sŸ   <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.s7   Automatic insertion of parentheses, braces and bracketst   close_parenthesess%   Automatic insertion of closing quotest   close_quotess;   Automatic insertion of colons after 'for', 'if', 'def', etct
   add_colonss0   Automatic indentation after 'else', 'elif', etc.t   auto_unindents   Indentation characters: s   2 spacess   *  *s   3 spacess   *   *s   4 spacess   *    *s   5 spacess   *     *s   6 spacess   *      *s   7 spacess	   *       *s   8 spacess
   *        *t   Tabulationss   *	*t   indent_charss   Tab stop width:t   spacest   tab_stop_width_spacesi   c            sS   |  d k r/ ˆ  j  j t ƒ ˆ  j j t ƒ n  ˆ  j  j t ƒ ˆ  j j t ƒ d  S(   Ni   (   t   plabelt
   setEnabledt   Truet   spinboxt   False(   t   index(   t   tabwidth_spin(    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   enable_tabwidth_spinÝ   s
    s   Tab always indentt   tab_always_indentt   defaultsÌ   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)s   Intelligent backspacet   intelligent_backspaces6   Automatically remove trailing spaces when saving filest   always_remove_trailing_spacest   Analysiss;   <a href="https://www.python.org/dev/peps/pep-0008">PEP8</a>s   <i>(Refer to the {} page)</i>t   pycodestyles   Real-time code analysiss   code_analysis/pyflakessÜ   <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>s#   Code analysis requires pyflakes %s+s   Real-time code style analysiss   code_analysis/pep8sê   <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>sT   Code annotations (TODO, FIXME, XXX, HINT, TIP, @todo, HACK, BUG, OPTIMIZE, !!!, ???)t	   todo_lists+   Perform analysis when saving file and everyt   realtime_analysiss&   Perform analysis only when saving filet   onsave_analysiss   realtime_analysis/timeouts   End-of-line characterss¬   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.s.   Fix automatically and show warning message boxt   check_eol_charst   Displays   Code Introspection/Analysiss   Advanced settings(+   t   create_buttonR   t   plugint   edit_templateR   t   create_checkboxR   t	   addWidgett	   setLayoutt   create_spinboxt   toggledt   connectR‡   R…   t   slabelt
   get_optionR   R   t	   addLayoutt
   addStretchR,   t   is_module_installedR   t   setWordWrapR†   t   create_comboboxt   comboboxt   currentIndexChangedRˆ   t   formatt   setOpenExternalLinksR*   t   is_pyflakes_installedt   get_checker_executableRS   t
   setToolTipt   PYFLAKES_REQVERt   create_radiobuttont   labelR„   R   t   addTabt
   create_tab(B   R_   t   template_btnt   interface_groupt   newcbt   showtabbar_boxt   interface_layoutt   display_groupt   linenumbers_boxt
   blanks_boxt   edgeline_boxt   edgeline_spint   currentline_boxt   currentcell_boxt   occurrence_boxt   occurrence_spint   wrap_mode_boxt   display_layoutt   display_h_layoutt	   run_groupt   saveall_boxt   run_selection_groupt	   focus_boxt   introspection_groupt   rope_is_installedt   completion_boxt   case_comp_boxt   comp_enter_boxt   calltips_boxt   gotodef_boxt
   rope_labelt   sourcecode_groupt   closepar_boxt   close_quotes_boxt   add_colons_boxt   autounindent_boxt   indent_chars_boxR‹   t   tab_mode_boxt   ibackspace_boxt   removetrail_boxt   analysis_groupt   pep_urlt
   pep8_labelt   is_pyflakest   is_pep8t   pyflakes_boxt   pep8_boxt   todolist_boxt   realtime_radiot   saveonly_radiot   af_spint	   af_layoutt
   run_layoutt   run_selection_layoutt   introspection_layoutt   analysis_layoutt   analysis_pep_layoutt   sourcecode_layoutt   indent_tab_layoutt   indent_tab_grid_layoutt	   eol_groupt	   eol_labelt   check_eol_boxt
   eol_layoutt   tabst   vlayout(    (   RŠ   s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt
   setup_pagen   s†   																																		(   t   __name__t
   __module__R`   Rd   Ró   (    (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR]   g   s   		R^   c        
   B   sˆ  e  Z d  Z d Z e Z e d ƒ Z e d ƒ Z e	 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 e	 d „ Z d „  Z e ƒ  d „  ƒ Z d „  Z d „  Z d	 „  Z d
 „  Z d „  Z d „  Z d „  Z d „  Z  e	 d „ Z! d „  Z" d „  Z# d „  Z$ d „  Z% d „  Z& e' d „ Z( d „  Z) d „  Z* d „  Z+ d „  Z, d „  Z- e e e ƒ d „  ƒ Z. e e e e ƒ d „  ƒ Z/ e e e e ƒ d „  ƒ Z0 d „  Z1 d „  Z2 d  „  Z3 d! „  Z4 d" „  Z5 d# „  Z6 d$ „  Z7 e' d% „ Z8 d& „  Z9 d' „  Z: d( „  Z; e' d) „ Z< e' d* „ Z= d+ „  Z> d, „  Z? d- „  Z@ d. „  ZA d/ „  ZB d0 „  ZC d1 „  ZD d2 „  ZE d3 „  ZF d4 „  ZG d5 „  ZH d6 „  ZI d7 „  ZJ d8 „  ZK d9 „  ZL e ƒ  d: „  ƒ ZM d; „  ZN d< „  ZO e ƒ  e e ƒ e' e' e' d= „ ƒ ƒ ZP d> „  ZQ d? „  ZR e ƒ  d@ „  ƒ ZS e ƒ  dA „  ƒ ZT e ƒ  e e ƒ e e eU e ƒ e e eU e eV ƒ e' e' dB e' eW dC „ ƒ ƒ ƒ ƒ ZX e ƒ  dD „  ƒ ZY e ƒ  dE „  ƒ ZZ e ƒ  dF „  ƒ Z[ e ƒ  dG „  ƒ Z\ e ƒ  e' e	 dH „ ƒ Z] e ƒ  dI „  ƒ Z^ e ƒ  dJ „  ƒ Z_ e ƒ  dK „  ƒ Z` e ƒ  dL „  ƒ Za e ƒ  dM „  ƒ Zb e ƒ  dN „  ƒ Zc e ƒ  dO „  ƒ Zd e ƒ  dP „  ƒ Ze dQ „  Zf dR „  Zg dS „  Zh dT „  Zi dU „  Zj dV „  Zk e ƒ  dW „  ƒ Zl e ƒ  dX „  ƒ Zm e ƒ  dY „  ƒ Zn e ƒ  dZ „  ƒ Zo e ƒ  d[ „  ƒ Zp e ƒ  d\ „  ƒ Zq e ƒ  d] „  ƒ Zr e ƒ  d^ „  ƒ Zs e ƒ  d_ „  ƒ Zt e ƒ  d` „  ƒ Zu e ƒ  da „  ƒ Zv db „  Zw e e ƒ dc „  ƒ Zx e ƒ  dd „  ƒ Zy e ƒ  de „  ƒ Zz df „  Z{ e	 dg „ Z| dh „  Z} di „  Z~ dj „  Z e ƒ  dk „  ƒ Z€ dl „  Z e ƒ  dm „  ƒ Z‚ e ƒ  dn „  ƒ Zƒ e ƒ  e' do „ ƒ Z„ e ƒ  dp „  ƒ Z… e ƒ  dq „  ƒ Z† e ƒ  dr „  ƒ Z‡ ds „  Zˆ dt „  Z‰ e ƒ  du „  ƒ ZŠ e ƒ  e	 dv „ ƒ Z‹ dw „  ZŒ e ƒ  dx „  ƒ Z e ƒ  dy „  ƒ ZŽ e ƒ  dz „  ƒ Z e ƒ  d{ „  ƒ Z e ƒ  d| „  ƒ Z‘ e ƒ  d} „  ƒ Z’ d~ „  Z“ d „  Z” d€ „  Z• d „  Z– d‚ „  Z— dƒ „  Z˜ d„ „  Z™ RS(…   s"   
    Multi-file Editor widget
    t   editors   temp.pys   template.pyc            s  t  r t j ˆ  | d | ƒn t j ˆ  | ƒ t ˆ  _ t j ˆ  j ƒ s× t j	 d k rb g  } n d t
 rq d n d g } | d d d d	 d
 d d	 g } y& t j t j j | ƒ ˆ  j d ƒ Wq× t k
 rÓ q× Xn  d  ˆ  _ d  ˆ  _ d  ˆ  _ g  ˆ  _ g  ˆ  _ d  ˆ  _ d  ˆ  _ d  ˆ  _ t ˆ  _ g  ˆ  _ i  ˆ  _ g  ˆ  _ g  ˆ  _ d  ˆ  _ d  ˆ  _ ˆ  j  ƒ  d  ˆ  _! ˆ  j" j# ƒ  } t$ ˆ  | ƒ ˆ  _% t& ˆ  | ƒ ˆ  _' t( ˆ  | ƒ ˆ  _) t* ˆ  | ƒ ˆ  _+ t, ƒ  } t- ˆ  ƒ ˆ  _. t/ ˆ  j. ˆ  j ƒ | j0 ˆ  j. ƒ d  ˆ  _1 g  ˆ  _2 d  ˆ  _3 t ˆ  _4 t5 ƒ  rŠt j6 j7 d ƒ rŠy d d l8 m9 } Wn! t: k
 rzd d l; m9 } n X| ƒ  ˆ  _< n t= d ˆ  j" j> ƒ  ƒ ˆ  _< ˆ  j" j? j@ ˆ  jA ƒ ˆ  j" jB j@ ˆ  jC ƒ tD ˆ  d t ƒˆ  _E ˆ  jE jF ƒ  ˆ  jE jG j@ ‡  f d †  ƒ ˆ  jH ˆ  jE ƒ tI ˆ  ƒ } t, ƒ  }	 |	 jJ d d d d ƒ | jK |	 ƒ tL ˆ  ˆ  ˆ  j d t ƒˆ  _M |	 j0 ˆ  jM ƒ |	 j0 ˆ  jE ƒ tN ˆ  ƒ ˆ  _O ˆ  jO jJ d d d d ƒ ˆ  jO j0 | ƒ ˆ  jO jP d d ƒ ˆ  jO jP d d ƒ | j0 ˆ  jO ƒ ˆ  jK | ƒ ˆ  jQ tR jS ƒ ˆ  jT d d  ƒ }
 |
 d  k	 rlˆ  jO jU tV ƒ  jW tX |
 ƒ jY d ƒ ƒ ƒ n  ˆ  jT d g  ƒ ˆ  _Z d ˆ  _[ d  ˆ  _\ d  ˆ  _] d  ˆ  _^ d  ˆ  __ t` ˆ  _4 ˆ  ja ƒ  } | d  k	 rýˆ  jb ƒ  } | jc d ƒ } ˆ  jd | | ƒ n  ˆ  je ƒ  ˆ  jC ƒ  d  S(   Nt   maint   nts   #!/usr/bin/env pythont   2t   3s   # -*- coding: utf-8 -*-s   """s   Created on %(date)sRj   s   @author: %(username)ss   utf-8t   SPY_TEST_USE_INTROSPECTIONiÿÿÿÿ(   t   Mockt
   extra_patht   enable_replacec            s
   ˆ  j  ƒ  S(   N(   t   rehighlight_cells(   t   vs(   R_   (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   <lambda>Û  Rj   i    t   firsti   i   t   splitter_statet   recent_filest   cursor(f   R   R>   t   __init__R†   t   _Editor__set_eol_charsRK   RL   t   TEMPLATE_PATHt   ost   nameR'   R+   t   writet   linesept   joint   EnvironmentErrorRS   t   projectst   outlineexplorert   helpt   file_dependent_actionst   pythonfile_dependent_actionst   dock_toolbar_actionst   edit_menu_actionst   stack_menu_actionst   _Editor__first_open_files_setupt   editorstackst   last_focus_editorstackt   editorwindowst   editorwindows_to_be_createdt   toolbar_listt	   menu_listt   initialize_plugint   dialog_sizeR÷   t	   statusBarR=   t   readwrite_statusR<   t
   eol_statusR;   t   encoding_statusR:   t   cursorpos_statusR   R   t   dock_toolbarR1   R›   t   last_edit_cursor_post   cursor_pos_historyt   cursor_pos_indext   _Editor__ignore_cursor_positionR    t   environRH   t   unittest.mockRü   t   ImportErrort   mockt   introspectorR/   t   get_spyder_pythonpatht   all_actions_definedRŸ   t   setup_other_windowst   sig_pythonpath_changedt   set_pathR4   t   find_widgett   hidet   visibility_changedt   register_widget_shortcutsR   t   setContentsMarginsRœ   R6   t   editorsplitterR   t   splittert   setStretchFactort   setFocusPolicyR   t
   ClickFocusR¡   t   restoreStateR   t   fromHext   strt   encodeR  t   untitled_numt   _Editor__last_ic_exect   _Editor__last_ec_exect   edit_filetypest   edit_filtersRˆ   t   get_current_editort   get_current_filenamet   get_positiont   add_cursor_position_to_historyt   update_cursorpos_actions(   R_   t   parentt   ignore_last_opened_filest   shebangt   headert	   statusbart   layoutRü   t   editor_widgetst   editor_layoutt   statet   current_editorRO   t   position(    (   R_   s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR  „  sÂ    																		
															
c         C   s   | |  _  d  S(   N(   R  (   R_   R  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   set_projects  s    c         C   sY   |  j  d  k	 rU |  j  j } | j ƒ  r4 | j ƒ  n | j ƒ  | j ƒ  |  j ƒ  n  d  S(   N(   R  RS   t
   dockwidgett	   isVisibleR5  t   showt   raise_t   switch_to_plugin(   R_   t   dw(    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   show_hide_projects  s    

c            sz   | ˆ  _  x! ˆ  j D] } | j ˆ  j  ƒ q Wˆ  j d j ƒ  ˆ  j  j j ‡  f d †  ƒ ˆ  j  j j ‡  f d †  ƒ d  S(   Ni    c      	      s"   ˆ  j  d |  d | d | d ˆ  ƒ S(   Nt	   filenamest   gotot   wordt   editorwindow(   t   load(   R_  R`  Ra  (   R_   (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR     s    c            s   ˆ  j  d |  d ˆ  ƒ S(   NR_  Rb  (   Rc  (   R_  (   R_   (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR  $  s    (   R  R  t   set_outlineexplorert   initialize_outlineexplorert	   edit_gotoRŸ   Ra   (   R_   R  t   editorstack(    (   R_   s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRd    s    	c         C   s1   | |  _  x! |  j D] } | j |  j  ƒ q Wd  S(   N(   R  R  t   set_help(   R_   t   help_pluginRg  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRh  '  s    	c         C   s,   y |  j  ƒ  j ƒ  Wn t k
 r' n Xd S(   s9   Restoring scrollbar position after main window is visibleN(   RG  t   centerCursort   AttributeError(   R_   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   restore_scrollbar_position-  s    c         C   s€   t  d ƒ } |  j r| |  j ƒ  } |  j j re | ry |  j j j ƒ  d k  ry | d t | ƒ 7} qy q| | d t | ƒ 7} n  | S(   s   Return widget titleR^   i   s    - (   R   RX  RH  t   dock_tabbart   countR)   (   R_   t   titleRO   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   get_plugin_title6  s    	c         C   s   t  j d ƒ S(   s   Return widget icon.Ra   (   Rb   Rc   (   R_   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   get_plugin_iconB  s    c         C   s
   |  j  ƒ  S(   s|   
        Return the widget to give focus to.

        This happens when plugin's dockwidget is raised on top-level.
        (   RG  (   R_   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   get_focus_widgetF  s    c         C   s`   t  j |  | ƒ |  j j ƒ  r/ |  j j ƒ  n |  j j ƒ  | rO |  j ƒ  n  |  j j	 ƒ  d S(   s!   DockWidget visibility has changedN(
   R>   R6  RX  t   isWindowR%  RZ  R5  t   refresh_plugint   update_plugin_titlet   emit(   R_   t   enable(    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR6  N  s    c         C   s$   |  j  ƒ  } | j ƒ  |  j ƒ  d S(   s   Refresh editor pluginN(   t   get_current_editorstackt   refresht   refresh_save_all_action(   R_   Rg  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRt  Y  s    
c         C   sM  |  j  j ƒ  } |  j d t | ƒ ƒ g  } |  j d } d } |  j d k	 r_ |  j j ƒ  } n  | sr |  j ƒ  n) |  j j	 g  | j
 D] } | j ^ q… ƒ |  j d |  j j ƒ  ƒ |  j d g  |  j D] } | j ƒ  ^ qÇ ƒ |  j d |  j ƒ yA | j | ƒ r| rt Sx |  j D] } | j ƒ  qWt SWn t k
 rHt SXd S(   s3   Perform actions before parent main window is closedR  i    t   layout_settingst   windows_layout_settingsR  N(   R:  t	   saveStatet
   set_optionR(   R  RS   R  t   get_active_project_patht   set_open_filenamest   set_project_filenamest   dataRO   R9  t   get_layout_settingsR  R  t   save_if_changedRˆ   t   closeR†   t
   IndexError(   R_   t
   cancelableRT  R_  Rg  t   active_project_patht   finfot   win(    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   closing_plugin_  s0    	 		#c   +         s%  t  ˆ  t d ƒ d t j d ƒ d t d ƒ d ˆ  j d t j ƒˆ  _ ˆ  j ˆ  j d d d	 d d
 t	 ƒt  ˆ  t d ƒ d t d ƒ d ˆ  j
 ƒˆ  _ ˆ  j ˆ  j d d d	 d ƒt  ˆ  t d ƒ d t j d ƒ d t d ƒ d ˆ  j d t j ƒˆ  _ ˆ  j ˆ  j d d d	 d d
 t	 ƒt  ˆ  t d ƒ d t j d ƒ d t d ƒ d ˆ  j ƒˆ  _ t  ˆ  t d ƒ d t j d ƒ d t d ƒ d ˆ  j d t j ƒˆ  _ ˆ  j ˆ  j d d d	 d d
 t	 ƒt  ˆ  t d ƒ d t j d ƒ d t d ƒ d ˆ  j d t j ƒˆ  _ ˆ  j ˆ  j d d d	 d d
 t	 ƒt  ˆ  t d ƒ d¾ t j d ƒ d t d ƒ d ˆ  j d t j ƒ} ˆ  j | d d ƒ t  ˆ  t d ƒ d¾ t j d ƒ t d ƒ d ˆ  j ƒ} t  ˆ  t d  ƒ d t d  ƒ d ˆ  j ƒ} t  ˆ  t d! ƒ d t j d" ƒ d t d# ƒ d ˆ  j ƒˆ  _ t  ˆ  t d$ ƒ d t j d% ƒ d t d& ƒ d ˆ  j ƒˆ  _ t  ˆ  t d' ƒ d t j d( ƒ d t d) ƒ d ˆ  j d t j ƒˆ  _ ˆ  j ˆ  j d d d	 d* ƒt d+ ƒ } t  ˆ  | d t j d, ƒ d | d ˆ  j d t j ƒ} ˆ  j | d d- d	 d. d
 t	 ƒt  ˆ  t d/ ƒ d t j d0 ƒ d ˆ  j d t j ƒ} ˆ  j | d d- d	 d1 ƒt  ˆ  t d2 ƒ d t j d3 ƒ d ˆ  j  d t j ƒ} ˆ  j | d d- d	 d4 ƒt d5 ƒ } t  ˆ  | d t j d6 ƒ d | d ˆ  j! d t j ƒ} ˆ  j | d d- d	 d7 ƒt  ˆ  t d8 ƒ d t j d9 ƒ d ˆ  j" d t j ƒ}	 ˆ  j |	 d d d	 d: ƒt  ˆ  t d; ƒ d t j d< ƒ d ˆ  j# d t j ƒ}
 ˆ  j |
 d d d	 d= ƒt  ˆ  t d> ƒ d ˆ  j$ ƒ} t  ˆ  t d? ƒ d ˆ  j% ƒˆ  _& ˆ  j& j' t( d¾ k	 oþt) ƒ t  ˆ  t d@ ƒ d t j dA ƒ d t dB ƒ d ˆ  j* ƒ} ˆ  j | d d- d	 dC d
 t	 ƒt  ˆ  t dD ƒ d t j dE ƒ d t dF ƒ d ‡  f dG †  ƒ} ˆ  j | d- dH d
 t	 ƒt  ˆ  t dI ƒ d t j dJ ƒ d t dK ƒ d ‡  f dL †  ƒ} ˆ  j | d- dM d
 t	 ƒt  ˆ  t dN ƒ d t j dO ƒ d t dP ƒ d ‡  f dQ †  ƒ} ˆ  j | d- dR d
 t	 ƒt  ˆ  t dS ƒ d t j dT ƒ d t dU ƒ d ‡  f dV †  ƒ} ˆ  j | d- dW d
 t	 ƒt  ˆ  t dX ƒ d t j dY ƒ d t dZ ƒ d ‡  f d[ †  ƒ} ˆ  j | d- d\ d
 t	 ƒt  ˆ  t d] ƒ d t j d^ ƒ d t d_ ƒ d ˆ  j+ ƒ} ˆ  j | d d- d	 d` d
 t	 ƒt  ˆ  t da ƒ d t j db ƒ d t dc ƒ dd t, j- d ˆ  j. ƒ} ˆ  j | d d- d	 de d
 t	 ƒt  ˆ  t df ƒ d t j dg ƒ d t dh ƒ d ˆ  j/ ƒ} ˆ  j | d d- d	 di d
 t	 ƒt  ˆ  t dj ƒ d t j dk ƒ d t dl ƒ d ˆ  j0 d t j ƒ} ˆ  j | d d d	 dm d
 t	 ƒt  ˆ  t dn ƒ d t j do ƒ dp t1 t2 ƒ d t dq ƒ d ˆ  j3 d t j ƒ} t  ˆ  t dr ƒ d t j ds ƒ dp t1 t4 ƒ d t dt ƒ d ˆ  j5 d t j ƒ} t  ˆ  t du ƒ d t dv ƒ d ˆ  j6 d t j ƒ} ˆ  j | d d d	 dw d
 t	 ƒt  ˆ  t dx ƒ d t j dy ƒ d t dz ƒ d ˆ  j7 ƒˆ  _8 t9 ˆ  ƒ ˆ  _: ˆ  j8 j; ˆ  j: ƒ ˆ  j: j< j= ˆ  j> ƒ t  ˆ  t d{ ƒ d t j d| ƒ d t d} ƒ d ˆ  j? ƒˆ  _@ t9 ˆ  ƒ ˆ  _A ˆ  j@ j; ˆ  jA ƒ ˆ  jA j< j= ˆ  jB ƒ t  ˆ  t d~ ƒ d t j d ƒ d t d€ ƒ d ˆ  jC ƒˆ  _D t  ˆ  t d ƒ d t j d‚ ƒ d t dƒ ƒ d ˆ  j? ƒˆ  _E t  ˆ  t d„ ƒ d t j d… ƒ d t d† ƒ d ˆ  jF d t j ƒˆ  _G ˆ  j ˆ  jG d d d	 d„ d
 t	 ƒt  ˆ  t d‡ ƒ d t j dˆ ƒ d t d‰ ƒ d ˆ  jH d t j ƒˆ  _I ˆ  j ˆ  jI d d d	 d‡ d
 t	 ƒt  ˆ  t dŠ ƒ d t j d‹ ƒ d t dŒ ƒ d ˆ  jJ d t j ƒˆ  _K ˆ  j ˆ  jK d d d	 dŠ d
 t	 ƒt  ˆ  t d ƒ dŽ t d ƒ d t j d ƒ d t d‘ ƒ d ˆ  jL d t j ƒˆ  _M ˆ  j ˆ  jM d d d	 d’ ƒt  ˆ  t d“ ƒ d t d” ƒ d ˆ  jN d t j ƒ} ˆ  j | d d d	 d• ƒt  ˆ  t d– ƒ d t d— ƒ d ˆ  jO d t j ƒ} ˆ  j | d d d	 d˜ ƒt  ˆ  t d™ ƒ dš d t j d› ƒ d t dœ ƒ d ˆ  jP d t j ƒˆ  _Q t  ˆ  t d ƒ dž d t j dŸ ƒ d t d  ƒ d ˆ  jR d t j ƒˆ  _S t  ˆ  t d¡ ƒ d t d¢ ƒ d ˆ  jT d t j ƒˆ  _U ˆ  j ˆ  jU d d d	 d£ ƒt  ˆ  t d¤ ƒ d t d¥ ƒ d ˆ  jV d t j ƒˆ  _W ˆ  j ˆ  jW d d d	 d¦ ƒt  ˆ  t d§ ƒ d¨ ‡  f d© †  ƒˆ  _X t  ˆ  t dª ƒ d¨ ‡  f d« †  ƒˆ  _Y t  ˆ  t d¬ ƒ d¨ ‡  f d­ †  ƒˆ  _Z t[ ˆ  ƒ } ˆ  jX ˆ  jY ˆ  jZ f } t\ | | ƒ t9 t d® ƒ ˆ  ƒ } t\ | | ƒ t  ˆ  t d¯ ƒ d ˆ  j] ƒ} t  ˆ  t d° ƒ d¨ ˆ  j^ ƒˆ  __ t  ˆ  t d± ƒ d t d² ƒ d ˆ  j` ƒ} t  ˆ  t d³ ƒ d t j d´ ƒ d ˆ  ja d t j ƒ}  ˆ  j |  d d d	 dµ ƒt  ˆ  t d¶ ƒ d t j d· ƒ d t d¸ ƒ d ˆ  jb ƒ}! t  ˆ  t d¹ ƒ d ˆ  jc ƒˆ  _d t  ˆ  t dº ƒ d t d» ƒ d ˆ  je ƒˆ  _f t9 t d¼ ƒ ˆ  ƒ ˆ  _g ˆ  jg j< j= ˆ  jh ƒ ˆ  j ti ˆ  j ˆ  j ˆ  jg ti ti ˆ  j ˆ  j | | ˆ  j ti | ˆ  j ti ˆ  j ˆ  j ti g }" ˆ  jj jk |" 7_k ˆ  j ˆ  j ˆ  j ˆ  j g ˆ  jj jl }# |# ˆ  jj _l | | | | g ˆ  jj _m | | | g ˆ  jj _n ˆ  jM | | ˆ  jQ ˆ  jS ˆ  jU ˆ  jW g ˆ  _o ˆ  jj jo ti g ˆ  jo 7_o ˆ  jM ˆ  jS ˆ  jQ g }$ ˆ  jj jp |$ 7_p ˆ  jj jm |  g 7_m ˆ  jj jn |  g 7_n | | | | ti | | | ti g	 }% ˆ  jj jq |% 7_q | | | | | g }& ˆ  jj jr |& 7_r | | | | | | ti |	 |
 | d½ ti ˆ  j& g }' ˆ  jj js |' 7_s | | | | | | g }( ˆ  jj jt |( 7_t | ˆ  j_ | | ti ˆ  j8 ˆ  j@ ˆ  jD ˆ  jE ti ˆ  jG ˆ  jI ˆ  jK g }) ˆ  jj ju |) 7_u ˆ  j8 ˆ  j@ ˆ  jD ˆ  jE ti ˆ  jG ˆ  jI ˆ  jK g }* ˆ  jj jv |* 7_v |# ti g |* ti g |& ti g |( ti g |$ ˆ  _w | | |	 |
 | | | | | | | ˆ  j& g ˆ  _x | | g ˆ  _y ˆ  jx ˆ  j | | | ˆ  j ˆ  j |  |! ˆ  j ˆ  j ˆ  jM ˆ  j ˆ  jQ ˆ  jS g ˆ  _z |  |! g ˆ  _{ ˆ  jz S(¿   s*   Return a list of actions related to plugins   &New file...Rc   t   filenewR{   s   New filet	   triggeredt   contextR^   R
  t   add_sc_to_tips   O&pen last closeds   Open last closeds   &Open...t   fileopens	   Open files   &Revertt   reverts   Revert file from disks   &Savet   filesaves	   Save files	   Sav&e allt   save_alls   Save all filess   Save alls   Save &as...t
   filesaveass   Save current file as...s   Save Ass   Save copy as...s   Save copy of current file as...s   Print preview...s	   &Print...t   prints   Print current file...s   &Closet	   filecloses   Close current files
   C&lose allt   fileclosealls   Close all opened filess	   Close alls
   &Find textt   findR   s	   Find texts
   Find &nextt   findnexts	   Find nexts   Find &previoust   findpreviouss   Find previouss   &Replace textt   replaces   Replace texts   Set/Clear breakpointt   breakpoint_bigt
   Breakpoints   Set/Edit conditional breakpointt   breakpoint_cond_bigs   Conditional breakpoints   Clear breakpoints in all filess   Debug with winpdbs   &Debugt   debugs
   Debug filet   Debugt   Steps   arrow-step-overs   Run current linec              s   ˆ  j  d ƒ S(   Nt   next(   t   debug_command(    (   R_   (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR    Rj   s   Debug Step Overt   Continues   arrow-continues(   Continue execution until next breakpointc              s   ˆ  j  d ƒ S(   Nt   continue(   R£  (    (   R_   (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR  
  Rj   s   Debug Continues	   Step Intos   arrow-step-ins,   Step into function or method of current linec              s   ˆ  j  d ƒ S(   NRr   (   R£  (    (   R_   (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR    Rj   s   Debug Step Intos   Step Returns   arrow-step-outs,   Run until current function or method returnsc              s   ˆ  j  d ƒ S(   Nt   return(   R£  (    (   R_   (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR    Rj   s   Debug Step Returnt   Stopt
   stop_debugs   Stop debuggingc              s   ˆ  j  d ƒ S(   Nt   exit(   R£  (    (   R_   (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR    Rj   s
   Debug Exits   &RunRF   s   Run fileRt   s   &Configuration per file...t   run_settingss   Run settingst   menurolet	   Configures   Re-run &last scriptt	   run_agains   Run again last files   Re-run last scripts   Run &selection or current linet   run_selections   Run selection or current lines   Run selections   Run cellt   run_cellt   shortcuts7   Run current cell (Ctrl+Enter)
[Use #%% to create cells]s   Run cell and advancet   run_cell_advances5   Run current cell and go to the next one (Shift+Enter)s   Re-run last cells   Re run last cell s   re-run last cells   Show todo listR’   sL   Show comments list (TODO/FIXME/XXX/HINT/TIP/@todo/HACK/BUG/OPTIMIZE/!!!/???)s   Show warning/error listt   wng_lists"   Show code analysis warnings/errorss   Previous warning/errort   prev_wngs*   Go to previous code analysis warning/errors   Next warning/errort   next_wngs&   Go to next code analysis warning/errors   Last edit locationt   last_edit_locations   Go to last edit locations   Previous cursor positiont   prev_cursors   Go to previous cursor positions   Next cursor positiont   next_cursors   Go to next cursor positiont   Commentt   /t	   Uncommentt   comments!   Comment current line or selections   Toggle comments   Add &block comments2   Add block comment around current line or selectiont   Blockcomments   R&emove block comments5   Remove comment block around current line or selectiont   Unblockcommentt   Indentt   Tabt   indents    Indent current line or selectiont   Unindents	   Shift+Tabt   unindents"   Unindent current line or selections   Toggle Uppercases-   Change to uppercase current line or selections   transform to uppercases   Toggle Lowercases-   Change to lowercase current line or selections   transform to lowercases'   Carriage return and line feed (Windows)Rž   c            s   ˆ  j  d |  ƒ S(   NRø   (   t   toggle_eol_chars(   t   checked(   R_   (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR  È  Rj   s   Line feed (UNIX)c            s   ˆ  j  d |  ƒ S(   Nt   posix(   RÃ  (   RÄ  (   R_   (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR  Ë  Rj   s   Carriage return (Mac)c            s   ˆ  j  d |  ƒ S(   Nt   mac(   RÃ  (   RÄ  (   R_   (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR  Î  Rj   s   Convert end-of-line characterss   Remove trailing spacess   Show blank spacess   Fix indentations*   Replace tab characters by space characterss   Go to line...t   gotolines
   Go to lines   Set console working directoryt   DirOpenIconsU   Set current console (and file explorer) working directory to current script directorys!   Maximum number of recent files...s   Clear this lists   Clear recent files lists   Open &recentt   list_breakpointsN(|   R0   R   Rb   Rc   t   newR   t   WidgetShortcutt
   new_actiont   register_shortcutR†   t   open_last_closedt   open_last_closed_actionRc  t   open_actionR‘  t   revert_actiont   savet   save_actionR“  t   save_all_actionRS   t   save_ast   save_copy_ast   print_previewt
   print_filet   print_actiont
   close_filet   close_actiont   close_all_filest   close_all_actionR˜  t	   find_nextt   find_previousR›  t   set_or_clear_breakpointt"   set_or_edit_conditional_breakpointRX   t
   run_winpdbt   winpdb_actionR…   t   WINPDB_PATHR'   t
   debug_filet   run_fileR   t   NoRolet   edit_run_configurationst   re_run_fileR®  R	   R"   R¯  R#   t   run_cell_and_advancet   re_run_last_cellt   go_to_next_todot   todo_list_actionR   t	   todo_menut   setMenut   aboutToShowRŸ   t   update_todo_menut   go_to_next_warningt   warning_list_actiont   warning_menut   update_warning_menut   go_to_previous_warningt   previous_warning_actiont   next_warning_actiont   go_to_last_edit_locationt   previous_edit_cursor_actiont   go_to_previous_cursor_positiont   previous_cursor_actiont   go_to_next_cursor_positiont   next_cursor_actiont   toggle_commentt   toggle_comment_actiont   blockcommentt   unblockcommentRÀ  t   indent_actionRÂ  t   unindent_actiont   text_uppercaset   text_uppercase_actiont   text_lowercaset   text_lowercase_actiont   win_eol_actiont   linux_eol_actiont   mac_eol_actionR   R1   t   remove_trailing_spacest   toggle_show_blankst   showblanks_actiont   fix_indentationt
   go_to_linet   _Editor__set_workdirt   change_max_recent_filest   max_recent_actiont   clear_recent_filest   clear_recent_actiont   recent_file_menut   update_recent_file_menuR2   R÷   t   file_menu_actionst   file_toolbar_actionst   search_menu_actionst   search_toolbar_actionsR  t   edit_toolbar_actionst   run_menu_actionst   run_toolbar_actionst   debug_menu_actionst   debug_toolbar_actionst   source_menu_actionst   source_toolbar_actionsR  R  t   cythonfile_compatible_actionsR  R  (+   R_   t   save_as_actiont   save_copy_as_actiont   print_preview_actiont   _textt   find_actiont   find_next_actiont   find_previous_actiont   replace_actiont   set_clear_breakpoint_actiont   set_cond_breakpoint_actiont   clear_all_breakpoints_actiont   debug_actiont   debug_next_actiont   debug_continue_actiont   debug_step_actiont   debug_return_actiont   debug_exit_actiont
   run_actiont   configure_actiont   re_run_actiont   run_selected_actiont   run_cell_actiont   run_cell_advance_actiont   re_run_last_cell_actiont   blockcomment_actiont   unblockcomment_actiont   eol_action_groupt   eol_actionst   eol_menut   trailingspaces_actiont   fixindentation_actiont   gotoline_actiont   workdir_actionR  R  R  R  R  R  R   R!  R"  (    (   R_   s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   get_plugin_actions  sX   										!								)			
+
	c         C   s  |  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 k	 r¯ |  j |  j  j ƒ n  |  j ƒ  } | j sÑ |  j ƒ  n  |  j  j |  ƒ |  j  j |  | j | j t j d ƒ ƒ d S(   s'   Register plugin in Spyder's main windowt   TextFileIconN(   R÷   Rl  RŸ   t   consoleRf  Rc  t   exec_in_extconsolet   execute_in_external_consolet   redirect_stdiot   redirect_internalshell_stdiot   open_dirt   workingdirectoryt   chdirRh  R  R  RS   Rd  Rx  R‚  t   _Editor__load_temp_filet   add_dockwidgett   add_to_fileswitcherRñ   Rb   Rc   (   R_   Rg  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   register_pluginˆ  s    
	c         C   s‚   |  j  ƒ  } |  j ƒ  } xc |  j D]X } | j | | ƒ t j d d ƒ } x- | j D]" } | j j } | j	 | | ƒ qT Wq" Wd S(   s   Update font from PreferencesR÷   s   completion/sizeN(
   t   get_plugin_fontt   get_color_schemeR  t   set_default_fontR!   RH   R‚  Rö   t   completion_widgett   setup_appearance(   R_   t   fontt   color_schemeRg  t   completion_sizeR‰  t   comp_widget(    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   update_fontš  s    c         C   sJ   t  j ƒ  } t | t ƒ r | Sx$ |  j D] } | j | ƒ r) | Sq) Wd  S(   N(   R   t   focusWidgetRQ   R7   R  t   isAncestorOf(   R_   t   fwidgetRg  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   __get_focus_editorstack¦  s    c         C   s   | |  j  | <| |  j  d  <d  S(   N(   R  RS   (   R_   Rb  Rg  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   set_last_focus_editorstack¯  s    c         C   s   |  j  | S(   N(   R  (   R_   Rb  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   get_last_focus_editorstack³  s    c         C   sF   x? t  |  j j ƒ  ƒ D]( \ } } | | k r d  |  j | <q q Wd  S(   N(   RI   R  t   itemsRS   (   R_   Rg  Rb  t   widget(    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   remove_last_focus_editorstack¶  s    "c         C   s\   |  j  ƒ  } | d  k	 rX x= |  g |  j D]( } | j | ƒ r) |  j | | ƒ q) q) Wn  d  S(   N(   t   _Editor__get_focus_editorstackRS   R  R^  Ra  (   R_   Rg  RŠ  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   save_focus_editorstack»  s
    c             s\  ˆ  j  j | ƒ ˆ  j | ƒ t ˆ  j  ƒ d k r] ˆ  j d  k	 r] ˆ  j j j j | j	 ƒ n  ˆ  j
 | ƒ rgˆ  j ˆ  | ƒ | j t ˆ  j  ƒ d k ƒ ˆ  j d  k	 rº | j ˆ  j ƒ n  | 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 ƒ n  | j ˆ  j ƒ | j ˆ  j  ˆ  j! ˆ  j" ˆ  j# ƒ | j$ ˆ  j% ƒ | j& ˆ  j' ƒ dI dJ dK dL dM dN dO dP dQ dR dS dT dU dV dW dX dY dZ d[ d\ d] d^ d_ d` da db dc dd de df dg f } x0 | D]( \ } } t( | | ƒ ˆ  j) | ƒ ƒ q#W| j* t+ j, d@ dA ƒ ƒ ˆ  j- ƒ  } | j. ˆ  j/ ƒ  | ƒ | j0 j ˆ  j0 ƒ | j1 j ˆ  j1 ƒ | j2 j ‡  f dB †  ƒ | j3 j ‡  f dC †  ƒ | j4 j ‡  f dD †  ƒ | j5 j ˆ  j6 ƒ | j5 j ˆ  j7 ƒ | j5 j ˆ  j j8 ƒ | j9 j ‡  f dE †  ƒ | j: j ‡  f dF †  ƒ | j; j ‡  f dG †  ƒ | j< j ‡  f dH †  ƒ | j< dh j ˆ  j= ƒ | j> j ˆ  j? ƒ | j@ j ˆ  jA ƒ | jB j ˆ  jC ƒ | jD j ˆ  jD ƒ | jE j ˆ  jE ƒ | jF j ˆ  jF ƒ | jG j ˆ  jG ƒ | jH j ˆ  jH ƒ | jH j ˆ  jI ƒ | jJ j ˆ  jJ ƒ | jK j ˆ  jK ƒ | j j ˆ  jL ƒ | jM j ˆ  jM ƒ | jN j ˆ  jN ƒ | jO j ˆ  jO ƒ | jP j ˆ  jQ ƒ | jP di j ˆ  jQ ƒ | jR j ˆ  jQ ƒ | jS j ˆ  jT ƒ | jU j ˆ  jV ƒ | jW j ˆ  jX ƒ | jY j ˆ  jZ ƒ d  S(j   Ni   t   set_pyflakes_enableds   code_analysis/pyflakest   set_pep8_enableds   code_analysis/pep8t   set_todolist_enabledR’   t   set_realtime_analysis_enabledR“   t   set_realtime_analysis_timeouts   realtime_analysis/timeoutt   set_blanks_enabledRh   t   set_linenumbers_enabledRg   t   set_edgeline_enabledRi   t   set_edgeline_columnRl   t   set_codecompletion_auto_enableds   codecompletion/autot   set_codecompletion_case_enableds   codecompletion/case_sensitivet    set_codecompletion_enter_enableds   codecompletion/enter_keyt   set_calltips_enabledRy   t   set_go_to_definition_enabledRz   t   set_focus_to_editorRv   t   set_close_parentheses_enabledR|   t   set_close_quotes_enabledR}   t   set_add_colons_enabledR~   t   set_auto_unindent_enabledR   t   set_indent_charsR   t   set_tab_stop_width_spacesRƒ   t   set_wrap_enabledRs   t   set_tabmode_enabledRŒ   t!   set_intelligent_backspace_enabledRŽ   t"   set_highlight_current_line_enabledRm   t"   set_highlight_current_cell_enabledRn   t#   set_occurrence_highlighting_enabledRo   t#   set_occurrence_highlighting_timeouts   occurrence_highlighting/timeoutt   set_checkeolchars_enabledR•   t   set_tabbar_visibleRf   t!   set_always_remove_trailing_spacesR   R  s   connect/editorc            s   ˆ  j  j |  ƒ S(   N(   RJ  Rv  (   RT  (   R_   (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR    Rj   c            s   ˆ  j  j |  | ƒ S(   N(   RH  Rv  (   t   textt   option(   R_   (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR    s    c              s   ˆ  j  j ƒ  S(   N(   Ru  Rv  (    (   R_   (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR    Rj   c              s   ˆ  j  d ƒ S(   Ni   (   t   zoom(    (   R_   (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR    Rj   c              s   ˆ  j  d ƒ S(   Niÿÿÿÿ(   R‰  (    (   R_   (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR    Rj   c              s   ˆ  j  d ƒ S(   Ni    (   R‰  (    (   R_   (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR    Rj   c            s   ˆ  j  d |  ƒ S(   NR‡  (   RÊ  (   t   s(   R_   (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR    Rj   (   Rh  s   code_analysis/pyflakes(   Ri  s   code_analysis/pep8(   Rj  R’   (   Rk  R“   (   Rl  s   realtime_analysis/timeout(   Rm  Rh   (   Rn  Rg   (   Ro  Ri   (   Rp  Rl   (   Rq  s   codecompletion/auto(   Rr  s   codecompletion/case_sensitive(   Rs  s   codecompletion/enter_key(   Rt  Ry   (   Ru  Rz   (   Rv  Rv   (   Rw  R|   (   Rx  R}   (   Ry  R~   (   Rz  R   (   R{  R   (   R|  Rƒ   (   R}  Rs   (   R~  RŒ   (   R  RŽ   (   R€  Rm   (   R  Rn   (   R‚  Ro   (   Rƒ  s   occurrence_highlighting/timeout(   R„  R•   (   R…  Rf   (   R†  R   (    (    ([   R  t   appendR7  t   lenR÷   RS   t   fileswitchert   sig_goto_fileRŸ   t   set_stack_indexR^  Ra  t   set_closableR  Rd  t   set_find_widgetR4  t   reset_statusbarR!  R5  R#  R$  t   readonly_changedt   encoding_changedt"   sig_editor_cursor_position_changedt   cursor_position_changedt   sig_refresh_eol_charsR"  t   eol_changedRh  R  t   set_io_actionsRÌ  RÐ  RÓ  RÑ  t   set_tempfile_patht   TEMPFILE_PATHt   set_introspectorR.  t   getattrR¡   t   set_help_enabledR!   RH   RT  RU  RS  t   starting_long_processt   ending_long_processRJ  RH  Ru  t   editor_focus_changedRg  t!   set_editorstack_for_introspectiont   plugin_focus_changedt   zoom_int   zoom_outt
   zoom_resett   sig_new_fileRÊ  t   sig_close_filet   close_file_in_all_editorstackst
   file_savedt   file_saved_in_editorstackt   file_renamed_in_datat#   file_renamed_in_data_in_editorstackt   create_new_windowt   opened_files_list_changedt   analysis_results_changedt   todo_results_changedt   update_code_analysis_actionst   update_todo_actionst   refresh_file_dependent_actionsRz  t   refresh_eol_charsRW   t   text_changed_att   current_file_changedt   plugin_loadRc  Rf  t   sig_save_asRÕ  t   sig_prev_edit_posRù  t   sig_prev_cursorRû  t   sig_next_cursorRý  (   R_   Rg  t   settingst   methodt   settingRY  (    (   R_   s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   register_editorstackÃ  sÔ    $				 				
	
	
	
	
	
c         C   sP   |  j  | ƒ t |  j ƒ d k rH |  j j | ƒ } |  j j | ƒ t St Sd S(   s8   Removing editorstack only if it's not the last remainingi   N(   Re  RŒ  R  R‰   RM   R†   Rˆ   (   R_   Rg  R‰   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   unregister_editorstack=  s    c         C   s<   | j  |  j d ƒ x! | j D] } |  j | j ƒ q Wd  S(   Ni    (   t
   clone_fromR  R‚  R7  Rö   (   R_   Rg  R‰  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   clone_editorstackH  s    c         C   so   xh |  j  D]] } t t | ƒ ƒ | k r
 | j t ƒ | j | ƒ } | j | d t ƒ| j t ƒ q
 q
 Wd  S(   Nt   force(   R  R@  t   idt   blockSignalsR†   t   get_index_from_filenameRÚ  Rˆ   (   R_   t   editorstack_id_strRO   Rg  R‰   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR©  M  s    c         C   sC   x< |  j  D]1 } t t | ƒ ƒ | k r
 | j | | ƒ q
 q
 Wd S(   s5   A file was saved in editorstack, this notifies othersN(   R  R@  RÅ  t   file_saved_in_other_editorstack(   R_   RÈ  t   original_filenameRO   Rg  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR«  V  s    	c         C   sC   x< |  j  D]1 } t t | ƒ ƒ | k r
 | j | | ƒ q
 q
 Wd S(   s?   A file was renamed in data in editorstack, this notifies othersN(   R  R@  RÅ  t   rename_in_data(   R_   RÈ  RÊ  RO   Rg  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR­  _  s    c            s™   |  j  ƒ  ‰  ˆ  d k	 r• |  j j ˆ  ƒ y$ |  j j j ƒ  |  j j j ƒ  Wn t k
 r_ n X|  j j j ˆ  j	 ƒ |  j j j ‡  f d †  ƒ n  d S(   se   
        Set the current editorstack to be used by the IntrospectionManager
        instance
        c            s   ˆ  j  j |  | | ƒ S(   N(   Rf  Rv  (   t   fnameRT   R
  (   Rg  (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR  z  s    N(
   Rf  RS   R.  t   set_editor_widgett   sig_send_to_helpt
   disconnectt   sig_edit_gotot	   TypeErrorRŸ   t   send_to_help(   R_   (    (   Rg  s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR¢  g  s    c      	   C   su  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] } |  j ƒ  } | j | ƒ qNWd S(   s3   Setup toolbars and menus for 'New window' instancess   File toolbart   file_toolbars   Search toolbart   search_toolbars   Source toolbart   source_toolbars   Run toolbart   run_toolbars   Debug toolbart   debug_toolbars   Edit toolbart   edit_toolbars   &Files   &Edits   &Searchs   Sour&ces   &Runs   &Toolss   &Views   &HelpN(   R   R÷   R  R  R"  R  R   R  R  R  R  R!  R  t   tools_menu_actionst   help_menu_actionsR  R  R®  t   set_layout_settings(   R_   R{  RŠ  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR1  ~  s.    c            sµ   ˆ  j  j ƒ  } t ˆ  ˆ  j ˆ  j ˆ  j d | d d | d d | d ƒ‰ ˆ j d ˆ j ƒ  ƒ ˆ j ƒ  ˆ j	 ˆ  j
 ƒ  ƒ ˆ j ƒ  ˆ  j ˆ ƒ ˆ j j ‡  ‡ f d †  ƒ ˆ S(   Nt   show_fullpatht   show_all_filest   show_commentss   &Viewc              s   ˆ  j  ˆ ƒ S(   N(   t   unregister_editorwindow(    (   R_   t   window(    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR  ¦  Rj   (   R  t   get_optionsR5   R  R  R  t   add_toolbars_to_menut   get_toolbarst   load_toolbarst   resizet   sizeRZ  t   register_editorwindowt	   destroyedRŸ   (   R_   t
   oe_options(    (   R_   Rà  s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR®  š  s    



c         C   s   |  j  j | ƒ d  S(   N(   R  R‹  (   R_   Rà  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRç  ©  s    c         C   s    |  j  j |  j  j | ƒ ƒ d  S(   N(   R  RM   R‰   (   R_   Rà  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRß  ¬  s    c         C   s$   g  |  j  d j D] } | j ^ q S(   Ni    (   R  R‚  RO   (   R_   R‰  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   get_filenames±  s    c         C   s   |  j  d j | ƒ S(   Ni    (   R  t   has_filename(   R_   RO   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   get_filename_index´  s    c         C   sŽ   |  j  d  k	 rŠ t |  j  ƒ d k r4 |  j  d } nR |  j ƒ  } | d  k sX | d  k	 r† |  j | ƒ } | d  k r† |  j  d } q† n  | Sd  S(   Ni   i    (   R  RS   RŒ  Rf  Rb  (   R_   Rb  Rg  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRx  ·  s    c         C   s&   |  j  ƒ  } | d  k	 r" | j ƒ  Sd  S(   N(   Rx  RS   RG  (   R_   Rg  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRG  Ã  s    c         C   s&   |  j  ƒ  } | d  k	 r" | j ƒ  Sd  S(   N(   Rx  RS   t   get_current_finfo(   R_   Rg  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRí  È  s    c         C   s&   |  j  ƒ  } | d  k	 r" | j ƒ  Sd  S(   N(   Rx  RS   RH  (   R_   Rg  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRH  Í  s    c         C   s   |  j  d j | ƒ S(   Ni    (   R  t   is_file_opened(   R_   RO   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRî  Ò  s    c         C   s   |  j  | ƒ } | j | ƒ S(   sp   Set focus to *filename* if this file has been opened
        Return the editor instance associated to *filename*(   Rx  t   set_current_filename(   R_   RO   Rb  Rg  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRï  Õ  s    c         C   sV   x* |  j  d j D] } |  j j ƒ  | _ q W|  j rR |  j j |  j j ƒ  ƒ n  d  S(   Ni    (   R  R‚  R÷   R/  t   pathR.  t   change_extra_path(   R_   R‰  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR3  Û  s
    		c         C   s
   |  j  ƒ  S(   s,   Get the widget with the TabWidget attribute.(   Rx  (   R_   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   get_current_tab_managerã  s    c         C   sR   |  j  rN |  j  j ƒ  rN |  j ƒ  d k	 } x! |  j D] } | j | ƒ q4 Wn  d S(   sM   Enable/disable file dependent actions
        (only if dockwidget is visible)N(   RX  RY  RG  RS   R  R…   (   R_   Rw  t   action(    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR´  è  s    c         C   sB   |  j  ƒ  } | r> t d „  | j Dƒ ƒ } |  j j | ƒ n  d S(   s0   Enable 'Save All' if there are files to be savedc         s   s-   |  ]# } | j  j ƒ  j ƒ  p$ | j Vq d  S(   N(   Rö   t   documentt
   isModifiedt   newly_created(   t   .0R‰  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pys	   <genexpr>ô  s   N(   Rx  t   anyR‚  RÔ  R…   (   R_   Rg  RT  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRz  ð  s
    	c   
   	      s×   ˆ j  ƒ  } | j ƒ  } ˆ j j ƒ  ˆ j ƒ  ‰  xŸ | D]— \ } } d | k } | d  j ƒ  | d } | r} t j d ƒ n t j d ƒ } | ‡  ‡ f d † } t ˆ d | d | d | ƒ}	 ˆ j j	 |	 ƒ q8 Wd	 S(
   s   Update warning list menut   syntaxi   t   errort   warningc            s   ˆ j  ˆ  d | ƒS(   NR`  (   Rc  (   t   _checkedt   _l(   RO   R_   (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR    Rj   R‡  Rc   R  N(
   Rx  t   get_analysis_resultsRô  t   clearRH  t   upperRb   Rc   R0   t	   addAction(
   R_   Rg  t   check_resultst   messaget   line_numberRú  R‡  Rc   t   slotRó  (    (   RO   R_   s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRõ  ø  s    $c         C   s„   |  j  ƒ  } | j ƒ  } | j ƒ  } | d k rv | j | j } x3 |  j D]% } | | k	 rJ | j | | ƒ qJ qJ Wn  |  j ƒ  d S(   so   
        Synchronize analysis results between editorstacks
        Refresh analysis navigation buttons
        iÿÿÿÿN(   Rx  Rþ  t   get_stack_indexR‚  RO   R  t   set_analysis_resultsR²  (   R_   Rg  t   resultsR‰   RO   t   other_editorstack(    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR°    s    c      	      s¨   ˆ j  ƒ  } | j ƒ  } ˆ j j ƒ  ˆ j ƒ  ‰  xf | D]^ \ } } t j d ƒ } | ‡  ‡ f d † } t ˆ d | d | d | ƒ} ˆ j j | ƒ q8 Wˆ j	 ƒ  d S(   s   Update todo list menut   todoc            s   ˆ j  ˆ  d | ƒS(   NR`  (   Rc  (   Rü  Rý  (   RO   R_   (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR    Rj   R‡  Rc   R  N(
   Rx  t   get_todo_resultsRî  Rÿ  RH  Rb   Rc   R0   R  R³  (   R_   Rg  R  R‡  t   line0Rc   R  Ró  (    (   RO   R_   s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRñ    s    c         C   s„   |  j  ƒ  } | j ƒ  } | j ƒ  } | d k rv | j | j } x3 |  j D]% } | | k	 rJ | j | | ƒ qJ qJ Wn  |  j ƒ  d S(   sl   
        Synchronize todo results between editorstacks
        Refresh todo list navigation buttons
        iÿÿÿÿN(   Rx  R  R  R‚  RO   R  t   set_todo_resultsR³  (   R_   Rg  R  R‰   RO   R	  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR±  "  s    c         C   sp   t  | ƒ } t |  _ | d k r4 |  j j t ƒ n/ | d k rS |  j j t ƒ n |  j j t ƒ t |  _ d  S(   NRø   RÅ  (   R)   Rˆ   R  R	  t
   setCheckedR†   R
  R  (   R_   t   os_name(    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRµ  1  s    	c         C   sÆ   |  j  ƒ  } | rÂ | j ƒ  } | p< t j d ƒ o< | j ƒ  } xg |  j D]\ } | |  j k rg | } n | } | |  j k r˜ | j | o‘ t	 d k	 ƒ qI | j | ƒ qI W|  j j |  j ƒ  ƒ n  d S(   s­   
        Opened files list has changed:
        --> open/close file action
        --> modification ('*' added to title)
        --> current edited file has changed
        t   CythonN(   RG  t	   is_pythonR,   R¤   t	   is_cythonR  R#  Rã  R…   Rä  RS   t   open_file_updateRv  RH  (   R_   Rö   t   python_enablet   cython_enableRó  Rw  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR¯  >  s    	c         C   s‚   |  j  ƒ  } | j ƒ  } |  j d ƒ s6 |  j d ƒ oK | d  k	 oK t | ƒ } x- |  j |  j |  j f D] } | j | ƒ qg Wd  S(   Ns   code_analysis/pyflakess   code_analysis/pep8(	   Rx  Rþ  R¡   RS   RŒ  Ró  R÷  Rø  R…   (   R_   Rg  R  RT  Ró  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR²  V  s    c         C   sS   |  j  ƒ  } | j ƒ  } |  j d ƒ o< | d  k	 o< t | ƒ } |  j j | ƒ d  S(   NR’   (   Rx  R  R¡   RS   RŒ  Rí  R…   (   R_   Rg  R  RT  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR³  b  s
    c         C   s$   |  j  ƒ  } | j ƒ  t j ƒ  d S(   s#   Rehighlight cells of current editorN(   RG  Rÿ   R   t   processEvents(   R_   Rö   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRÿ   i  s    
c         C   si   t  | ƒ } t  | ƒ } t j t j | ƒ ƒ } | rE t | ƒ } n g  } t | | ƒ |  j j ƒ  d  S(   N(   R)   RK   t   normpatht   abspatht   evalRW   t   breakpoints_savedRv  (   R_   RO   RG   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRW   q  s    c         C   sÀ   t  j |  j ƒ s¬ d d t d ƒ d t d ƒ d d d g } t j j g  | D] } t j | ƒ ^ qL ƒ } y  t j	 t
 | ƒ |  j d ƒ Wq¬ t k
 r¨ |  j ƒ  d SXn  |  j |  j ƒ d S(   s;   Load temporary file from a text file in user home directorys   # -*- coding: utf-8 -*-s   """s   Spyder EditorRj   s    This is a temporary script file.s   utf-8N(   RK   RL   R›  R   R	  R  R  R+   t
   to_unicodeR  R)   R  RÊ  Rc  (   R_   R   t   qstrR‡  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   __load_temp_file}  s    	"
c         C   sG   |  j  ƒ  } | d k	 rC t j t j | ƒ ƒ } |  j j | ƒ n  d S(   s1   Set current script directory as working directoryN(   RH  RS   RK   t   dirnameR  RL  Rv  (   R_   RÌ  t	   directory(    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   __set_workdir  s    c         C   sz   | d k r d S| |  j k r2 |  j j | ƒ n  |  j j d | ƒ t |  j ƒ |  j d ƒ k rv |  j j d ƒ n  d S(   s   Add to recent file listNi    t   max_recent_filesiÿÿÿÿ(   RS   R  RY   t   insertRŒ  R¡   RM   (   R_   RÌ  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   __add_recent_file˜  s    c         C   s>   x7 |  j  d D]( } | j | d t ƒ} |  j | ƒ q Wd S(   s¹   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)i   t   set_currentN(   R  t   clone_editor_fromRˆ   R7  (   R_   R‰  Rg  Rö   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   _clone_file_everywhere¢  s    c         C   sø  t  } yø | d k rá t } t j |  j ƒ \ } } t j d | ƒ } | r] | j d ƒ } n  t j	 t
 j j d d ƒ ƒ } | s¢ t j	 t
 j j d d ƒ ƒ } n  i t j ƒ  d 6| d 6}	 y | |	 } Wqý t k
 rÝ qý Xn t  } t j |  j ƒ d } Wn/ t t f k
 r/d } d	 } t } t } n Xd
 „  }
 | d k rT|  j ƒ  } n | } | d k } | r7x; t r©|
 |  j ƒ } |  j d 7_ t j | ƒ soPqoqoWt ƒ  } |  j j j ƒ  d k	 rà|  j j j ƒ  } n9 |  j ƒ  } | d k	 r| |  j k rt j | ƒ } n  t j t j | | ƒ ƒ } nD t j t  | ƒ ƒ } | j! | ƒ } | d k	 r{| j" | ƒ r{d S|  j# d j$ | | | | | ƒ } |  j j% ƒ  | _& |  j' | ƒ | j( | j) ƒ } |  j* | ƒ | sô|  j+ d t ƒ n  d S(   s®   
        Create a new file - Untitled
        
        fname=None --> fname will be 'untitledXX.py' but do not create file
        fname=<basestring> --> create file
        s!   -*- coding: ?([a-z0-9A-Z\-]*) -*-i   t   USERNAMERj   t   USERt   -t   datet   usernames   utf-8c         S   s   t  t d ƒ ƒ d |  S(   Nt   untitleds   %d.py(   R)   R   (   t   n(    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR  Ö  Rj   Ni    RÄ  (,   Rˆ   RS   R†   R+   t   readR  t   ret   searcht   groupt   to_unicode_from_fsR	  R*  RH   t   timet   ctimet	   Exceptiont   IOErrort   OSErrorRx  RB  RK   RL   R3   R÷   R  t   get_active_projectR  RH  R›  R  R  R  R)   Rë  RÚ  R  RÊ  R/  Rð  R&  Rï  RO   R7  RÒ  (   R_   RÌ  Rg  R‡  t   emptyt   default_contentt   enct	   enc_matchR+  t   VARSt   create_fnamet
   current_est   created_from_heret   basedirt   c_fnameR‰   R‰  RU  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRÊ  ª  st    
		

				c         C   s   |  j  |  j ƒ d S(   s   Edit new file templateN(   Rc  R  (   R_   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR™   ÿ  s    c         C   sþ   g  } xE |  j  D]: } |  j | ƒ d k r t j | ƒ r | j | ƒ q q W|  j j ƒ  | r¿ x[ | D]P } t |  | d t	 j
 d ƒ d |  j ƒ} | j t | ƒ ƒ |  j j | ƒ qh Wn  |  j j t | ƒ d k ƒ t |  j d |  j |  j f ƒ d S(   s   Update recent file menuRc   t   FileIconR  i    N(   R  Rî  RS   RK   RL   R‹  R  Rÿ  R0   Rb   Rc   Rc  t   setDataR   R  R  R…   RŒ  R1   R  (   R_   R  RÌ  Ró  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR    s    $c         C   s   g  |  _  d S(   s   Clear recent files listN(   R  (   R_   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR    s    c         C   sb   |  j  ƒ  } t j | t d ƒ t d ƒ |  j d ƒ d d ƒ \ } } | r^ |  j d | ƒ n  d S(   s   Change max recent files entriesR^   s   Maximum number of recent filesR!  i   i#   N(   Rx  R   t   getIntR   R¡   R~  (   R_   Rg  t   mrft   valid(    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR    s    	Rj   c      	   C   s
  y |  j  ƒ  Wn t k
 r! n X|  j ƒ  } | d k	 rX | j d ƒ } |  j ƒ  } n d \ } } | s  |  j ƒ  }	 t |	 t ƒ r  t	 |	 j
 ƒ  t ƒ } q  n  | s.t ƒ  }
 |  j d k rÍ t ƒ  |  _ n  |  j d k rë t ƒ  |  _ n  |  j ƒ  } | d k	 r$| |  j k r$t j | ƒ }
 n  |  j j t ƒ |  j ƒ  } | d k	 rnt |  j t j | ƒ d ƒ } n d } t ƒ  s³t | t d ƒ |
 |  j d | d t j ƒ\ } } n9 t | t d ƒ d t j ƒ} | j  ƒ  rì| j! ƒ  } n  |  j j t" ƒ | r'g  | D] } t j# | ƒ ^ q	} q.d Sn  t$ j% ƒ  } |  j& r‰|  j' j( ƒ  r‰| |  j& k rr|  j& d } n  | j) ƒ  | j* ƒ  nc |  j' rì|  j+ rì|  j' j, | ƒ rìt | t- ƒ rì|  j' j. t" ƒ |  j' j) ƒ  |  j' j* ƒ  n  d	 „  } t/ | d
 ƒ rt0 | ƒ } n  t | t0 ƒ s4| | ƒ g } n% g  t0 | ƒ D] } | | ƒ ^ qA} t | t1 ƒ rt| g } n- | d k	 r¡t2 | ƒ t2 | ƒ k r¡d } n  xbt3 | ƒ D]T\ } } |  j4 | | ƒ } | d k r€t j5 | ƒ síq®n  |  j | ƒ } |  j6 d j7 | d t ƒ} |  j8 j9 ƒ  | _: |  j; | ƒ | j4 | ƒ } | j< t= | ƒ ƒ |  j> | ƒ | j? ƒ  |  j@ | ƒ n  | d k	 rË| jA | | d | ƒ| j d ƒ } |  jB | | | | ƒ n  | jC ƒ  | j) ƒ  | jD ƒ  j* ƒ  | r®t$ jE ƒ  q®q®Wd S(   sr  
        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)
        R  i   Rj   s	   Open filet   selectedfiltert   optionsNi    c         S   sh   t  j t j |  ƒ ƒ }  t j d k rd t |  ƒ d k rd |  d d k rd |  d j ƒ  |  d }  n  |  S(   NRø   i   i   t   :i    (   RK   R  R+   R2  R	  R
  RŒ  R   (   RÌ  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   _convertw  s    1t   replaceInStringsR$  Ra  (   NN(F   R\  Rk  RG  RS   RI  RH  t   senderRQ   R   R   R‚  R)   R3   RE  R$   RF  R%   R›  RK   R  RJ  Rv  Rˆ   Rx  R&   t   splitextR    R   R   R   t   HideNameFilterDetailst   DontUseNativeDialogt   exec_t   selectedFilesR†   R  R   R]  R  RX  RY  t   setFocusR[  t   ismaximizedR^  R9   t
   setVisiblet   hasattrRI   RR   RŒ  t	   enumerateRï  RL   R  Rc  R÷   R/  Rð  R&  t   set_breakpointsRU   R7  t   analyze_scriptt   _Editor__add_recent_fileR  t   cursor_movedt
   clearFocusRà  R  (   R_   R_  R`  Ra  Rb  t   processeventst   editor0t	   position0t	   filename0Ró  RA  RB  t   parent_widgetRH  t   _sft   dialogRÌ  t   focus_widgetRK  R‰   RO   RU  R?  R‰  RV  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRc  $  s°    				%
	%$	


c         C   sã   |  j  ƒ  } |  j ƒ  } t d t j d |  j d ƒ ƒ } t | | ƒ } | j ƒ  rj | j t	 j
 t ƒ n  |  j j t ƒ | j ƒ  } |  j j t ƒ | t j k rß |  j t d ƒ ƒ | j | ƒ | j | ƒ |  j ƒ  n  d S(   s   Print current filet   modet   header_fontt   printer_headers   Printing...N(   RG  RH  R8   R   t   HighResolutionRS  R   t   has_selected_textt	   setOptionR
   t   PrintSelectionR†   RJ  Rv  Rˆ   RQ  R   t   AcceptedRŸ  R   t
   setDocNamet   print_R   (   R_   Rö   RO   t   printert   printDialogt   answer(    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRØ  ©  s    c            s£   d d l  m } |  j ƒ  ‰  t d t j d |  j d ƒ ƒ } | | |  ƒ } | j t j	 ƒ | j
 j ‡  f d †  ƒ |  j j t ƒ | j ƒ  |  j j t ƒ d S(   s   Print preview for current fileiÿÿÿÿ(   t   QPrintPreviewDialogRe  Rf  Rg  c            s   ˆ  j  |  ƒ S(   N(   Rn  (   Ro  (   Rö   (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR  Æ  Rj   N(   t   qtpy.QtPrintSupportRr  RG  R8   R   Rh  RS  t   setWindowFlagsR   t   Windowt   paintRequestedRŸ   RJ  Rv  Rˆ   RQ  R†   (   R_   Rr  Ro  t   preview(    (   Rö   s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR×  ¼  s    
c         C   s   |  j  ƒ  } | j ƒ  d S(   s   Close current fileN(   Rx  RÚ  (   R_   Rg  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRÚ  Ë  s    c         C   s   |  j  d j ƒ  d S(   s   Close all opened scriptsi    N(   R  RÜ  (   R_   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRÜ  Ñ  s    c         C   s"   |  j  ƒ  } | j d | d | ƒ S(   s	   Save fileR‰   RÄ  (   Rx  RÒ  (   R_   R‰   RÄ  Rg  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRÒ  Ö  s    c         C   s8   |  j  ƒ  } | j ƒ  r4 | j ƒ  } |  j | ƒ n  d S(   s#   Save *as* the currently edited fileN(   Rx  RÕ  RH  RZ  (   R_   Rg  RÌ  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRÕ  Ü  s    c         C   s   |  j  ƒ  } | j ƒ  d S(   s(   Save *copy as* the currently edited fileN(   Rx  RÖ  (   R_   Rg  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRÖ  ä  s    c         C   s   |  j  ƒ  j ƒ  d S(   s   Save all opened filesN(   Rx  R“  (   R_   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR“  ê  s    c         C   s   |  j  ƒ  } | j ƒ  d S(   s*   Revert the currently edited file from diskN(   Rx  R‘  (   R_   Rg  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR‘  ï  s    c         C   s-   |  j  ƒ  } | j j ƒ  | j j j ƒ  d S(   s	   Find slotN(   Rx  R4  RZ  t   search_textRS  (   R_   Rg  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR˜  õ  s    c         C   s   |  j  ƒ  } | j j ƒ  d S(   s   Fnd next slotN(   Rx  R4  RÞ  (   R_   Rg  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRÞ  ü  s    c         C   s   |  j  ƒ  } | j j ƒ  d S(   s   Find previous slotN(   Rx  R4  Rß  (   R_   Rg  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRß    s    c         C   s   |  j  ƒ  } | j j ƒ  d S(   s   Replace slotN(   Rx  R4  t   show_replace(   R_   Rg  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR›    s    c         C   sb   |  j  ƒ  } | j ƒ  } t | ƒ d k r^ | d } | j | ƒ | j | ƒ |  j | ƒ n  d S(   s    Reopens the last closed tab.i    N(   Rx  t   get_last_closed_filesRŒ  RY   t   set_last_closed_filesRc  (   R_   Rg  t   last_closed_filest   file_to_open(    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRÎ    s    
c         C   sR   t  j t | ƒ ƒ } |  j d j | ƒ } | d k	 rN |  j d j | ƒ n  d S(   s   Close file from its namei    N(   RK   R  R)   R  Rë  RS   RÚ  (   R_   RO   R‰   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   close_file_from_name  s    c         C   s   |  j  | ƒ d S(   s?   File was removed in file explorer widget or in project explorerN(   R~  (   R_   RO   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   removed   s    c         C   sX   t  j t | ƒ ƒ } x< |  j ƒ  D]. } t  j | ƒ j | ƒ r" |  j | ƒ q" q" Wd S(   s0   Directory was removed in project explorer widgetN(   RK   R  R)   Rê  t
   startswithR~  (   R_   R  RÌ  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   removed_tree$  s    c         C   sk   t  j t | ƒ ƒ } |  j d j | ƒ } | d k	 rg x- |  j D] } | j | d t | ƒ ƒqA Wn  d S(   s?   File was renamed in file explorer widget or in project exploreri    t   new_filenameN(   RK   R  R)   R  Rë  RS   RË  (   R_   t   sourcet   destRO   R‰   Rg  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   renamed+  s    c         C   s   t  j t | ƒ ƒ } t | ƒ } xW |  j ƒ  D]I } t  j | ƒ j | ƒ r. | j | | ƒ } |  j d | d | ƒ q. q. Wd S(   s>   Directory was renamed in file explorer or in project explorer.Rƒ  R„  N(   RK   R  R)   Rê  R€  R›  R…  (   R_   Rƒ  R„  R  t   tofileRÌ  R‚  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   renamed_tree4  s    c         C   s)   |  j  ƒ  } | d k	 r% | j ƒ  n  d S(   s    Indent current line or selectionN(   RG  RS   RÀ  (   R_   Rö   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRÀ  >  s    c         C   s)   |  j  ƒ  } | d k	 r% | j ƒ  n  d S(   s"   Unindent current line or selectionN(   RG  RS   RÂ  (   R_   Rö   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRÂ  E  s    c         C   s)   |  j  ƒ  } | d k	 r% | j ƒ  n  d S(   s.   Change current line or selection to uppercase.N(   RG  RS   t   transform_to_uppercase(   R_   Rö   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR  L  s    c         C   s)   |  j  ƒ  } | d k	 r% | j ƒ  n  d S(   s.   Change current line or selection to lowercase.N(   RG  RS   t   transform_to_lowercase(   R_   Rö   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR  S  s    c         C   s)   |  j  ƒ  } | d k	 r% | j ƒ  n  d S(   s!   Comment current line or selectionN(   RG  RS   Rÿ  (   R_   Rö   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRÿ  Z  s    c         C   s)   |  j  ƒ  } | d k	 r% | j ƒ  n  d S(   s'   Block comment current line or selectionN(   RG  RS   R  (   R_   Rö   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR  a  s    c         C   s)   |  j  ƒ  } | d k	 r% | j ƒ  n  d S(   s*   Un-block comment current line or selectionN(   RG  RS   R  (   R_   Rö   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR  h  s    c         C   sB   |  j  ƒ  |  j ƒ  } | j ƒ  } |  j ƒ  } |  j | | ƒ d  S(   N(   R\  RG  Rì  RH  RJ  (   R_   Rö   RV  RO   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRì  n  s
    
c         C   sB   |  j  ƒ  |  j ƒ  } | j ƒ  } |  j ƒ  } |  j | | ƒ d  S(   N(   R\  RG  Rò  RH  RJ  (   R_   Rö   RV  RO   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRò  v  s
    
c         C   sB   |  j  ƒ  |  j ƒ  } | j ƒ  } |  j ƒ  } |  j | | ƒ d  S(   N(   R\  RG  Rö  RH  RJ  (   R_   Rö   RV  RO   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRö  ~  s
    
c         C   s‡   |  j  ƒ  rƒ |  j ƒ  } t | ƒ } | d k r? g  } d } n | j ƒ  j ƒ  } | j ƒ  } t j t	 | g | d | p| d ƒn  d S(   s    Run winpdb to debug current filet   cwdN(
   RÒ  RH  RA   RS   t   get_argumentst   splitt   get_working_directoryR,   t   run_programRä  (   R_   RÌ  t   runconft   argst   wdir(    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRâ  †  s    	c         C   sE   | rA |  j  ƒ  } |  j rA |  j ƒ  | j t j | ƒ ƒ qA n  d  S(   N(   RG  R  R\  t   set_eol_charsR-   t   get_eol_chars_from_os_name(   R_   R  RÄ  Rö   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRÃ  ˜  s
    	
c         C   s'   |  j  ƒ  |  j ƒ  } | j | ƒ d  S(   N(   R\  RG  Rm  (   R_   RÄ  Rö   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR  Ÿ  s    
c         C   s$   |  j  ƒ  |  j ƒ  } | j ƒ  d  S(   N(   R\  Rx  R  (   R_   Rg  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR  ¥  s    
c         C   s$   |  j  ƒ  |  j ƒ  } | j ƒ  d  S(   N(   R\  Rx  R  (   R_   Rg  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR  «  s    
c         C   sz   |  j  j |  j d  k	 ƒ |  j j |  j d  k	 o= |  j d k ƒ |  j j |  j d  k	 or |  j t |  j ƒ d k  ƒ d  S(   Ni    i   (	   Rú  R…   R&  RS   Rü  R(  Rþ  RŒ  R'  (   R_   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRK  ²  s    		c         C   s#  |  j  r d  Sx° t |  j ƒ D]ž \ } \ } } | | k r | | k sT | d k r¼ | r„ | | f |  j | <| |  _ |  j ƒ  d  S|  j | k r¥ |  j d 8_ n  |  j j | ƒ Pq¼ q q W|  j d  k	 ré |  j |  j d  |  _ n  |  j j | | f ƒ t |  j ƒ d |  _ |  j ƒ  d  S(   Ni    i   (	   R)  RW  R'  R(  RK  RM   RS   R‹  RŒ  (   R_   RO   RV  t   fcR‰   RÌ  t   pos(    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRJ  º  s&    	#	
c         C   s3   | d k	 r |  j | | ƒ n  |  j | | ƒ d S(   s   Cursor was just moved: 'go to'N(   RS   RJ  (   R_   R`  R_  t	   filename1t	   position1(    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR[  Ñ  s    c         C   s   t  | ƒ | f |  _ d  S(   N(   R)   R&  (   R_   RO   RV  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR¶  ×  s    c         C   s    |  j  t | ƒ | d t ƒd  S(   NR”  (   RJ  R)   R†   (   R_   RO   RV  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR·  Ú  s    c         C   s‚   |  j  d  k	 r~ |  j  \ } } t j | ƒ s: d  |  _  d  S|  j | ƒ |  j ƒ  } | | j ƒ  j ƒ  k  r~ | j | ƒ q~ n  d  S(   N(	   R&  RS   RK   RL   Rc  RG  Rô  t   characterCountt   set_cursor_position(   R_   RO   RV  Rö   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRù  Þ  s    	c         C   sM  |  j  d  k r d  S|  j |  j  \ } } | |  j ƒ  j d ƒ f |  j |  j  <t |  _ |  j  } t t |  j ƒ d t	 d |  j  | g ƒ g ƒ |  _  |  j |  j  \ } } t
 j | ƒ sõ |  j j |  j  ƒ |  j  | k  ré | d 8} n  | |  _  nA |  j | ƒ |  j ƒ  } | | j ƒ  j ƒ  k  r6| j | ƒ n  t |  _ |  j ƒ  d  S(   NR  i   i    (   R(  RS   R'  RG  RI  R†   R)  t   minRŒ  t   maxRK   RL   RM   Rc  Rô  R˜  R™  Rˆ   RK  (   R_   t
   index_moveRO   t	   _positiont	   old_indexRV  Rö   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   __move_cursor_positionë  s,    "		"	c         C   s   |  j  ƒ  |  j d ƒ d  S(   Niÿÿÿÿ(   R\  t   _Editor__move_cursor_position(   R_   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRû  	  s    
c         C   s   |  j  ƒ  |  j d ƒ d  S(   Ni   (   R\  R   (   R_   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRý  
	  s    
c         C   s,   |  j  ƒ  } | d k	 r( | j | ƒ n  d S(   s   Open 'go to line' dialogN(   Rx  RS   R  (   R_   t   lineRg  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR  	  s    c         C   s3   |  j  ƒ  } | d k	 r/ |  j ƒ  | j ƒ  n  d S(   s   Set/Clear breakpointN(   Rx  RS   R\  Rà  (   R_   Rg  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRà  	  s    
c         C   s3   |  j  ƒ  } | d k	 r/ |  j ƒ  | j ƒ  n  d S(   s   Set/Edit conditional breakpointN(   Rx  RS   R\  Rá  (   R_   Rg  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRá  	  s    
c         C   sh   |  j  ƒ  t ƒ  |  j j ƒ  |  j ƒ  } | d k	 rZ x! | j D] } | j j ƒ  q@ Wn  |  j	 ƒ  d S(   s   Clear breakpoints in all filesN(
   R\  RX   R  Rv  Rx  RS   R‚  Rö   t   clear_breakpointsRt  (   R_   Rg  R‚  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRX   &	  s    
c         C   sn   t  | | ƒ |  j j ƒ  |  j ƒ  } | d k	 rj |  j | ƒ } | d k	 rj | j | j j | ƒ qj n  d S(   s   Remove a single breakpointN(	   R[   R  Rv  Rx  RS   Rî  R‚  Rö   t   add_remove_breakpoint(   R_   RO   RT   Rg  R‰   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR[   2	  s    c         C   sF   |  j  ƒ  |  j j j | ƒ |  j j j ƒ  } | rB | j ƒ  n  d S(   s   Debug actionsN(   R\  R÷   t
   ipyconsolet   write_to_stdinRr  RS  (   R_   t   commandRd  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR£  <	  s
    
c            s«   t  ˆ  ƒ } | j j ‡  f d †  ƒ ˆ  j d  k	 rG | j ˆ  j ƒ n  t j ˆ  j ƒ  ƒ } | j	 | ƒ | j
 ƒ  r§ | j } | d  k	 r§ ˆ  j | ƒ ˆ  j ƒ  q§ n  d  S(   Nc            s   ˆ  j  |  ƒ S(   N(   t   set_dialog_size(   RŠ  (   R_   (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR  H	  Rj   (   RB   t   size_changeRŸ   R  RS   Rå  RK   R  RH  t   setupRQ  t   file_to_runRc  Ræ  (   R_   Rc  RÌ  (    (   R_   s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRè  E	  s    	c            sF  ˆ  j  ƒ  } | j ƒ  rBˆ  j ƒ  } t j ˆ  j ƒ  ƒ } t j | ƒ } | j d d ƒ j d d ƒ } | j d d ƒ j d d ƒ } t | ƒ } | d k r]t
 ˆ  ƒ } | j j ‡  f d †  ƒ ˆ  j d k	 rã | j ˆ  j ƒ n  | j | ƒ t j d d t ƒ  ƒ r%t } t j d d t ƒ n t j d t ƒ } | rN| j ƒ  rNd S| j ƒ  } n  | j ƒ  }	 | j ƒ  }
 | j } | j } | j } | j } | j } | j  r´| } n6 | j! rÆd	 } n$ t j" | j# ƒ rä| j# } n d	 } t } | | |	 | | | |
 | | | | f ˆ  _$ ˆ  j% ƒ  | rB| rB| j& ƒ  qBn  d S(
   s5   Run script inside current interpreter or in a new onet   's   \'t   "s   \"c            s   ˆ  j  |  ƒ S(   N(   R§  (   RŠ  (   R_   (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR  g	  Rj   RF   t   open_at_least_onceNRj   ('   Rx  RÒ  RG  RK   R  RH  R  R›  RA   RS   RC   R¨  RŸ   R  Rå  R©  R!   RH   R    R†   RV   Rˆ   R@   RQ  t   get_configurationR‹  t   get_python_argumentst   interactt   post_mortemt   currentt   systermt   clear_namespacet   file_dirt   cw_dirt   isdirt   dirRD  Ré  RS  (   R_   RŸ  Rg  Rö   RÌ  R  R  Rc  t   show_dlgR  t   python_argsR°  R±  R²  R³  R´  R‘  t   python(    (   R_   s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRæ  S	  sV    									
c         C   s   | |  _  d  S(   N(   R  (   R_   Ræ  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR§  ˜	  s    c         C   s   |  j  ƒ  |  j d t ƒ d S(   s   Debug current scriptRŸ  N(   R\  Ræ  R†   (   R_   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRå  ›	  s    
c         C   s°   |  j  d ƒ r |  j ƒ  n  |  j d k r/ d S|  j \ } } } } } } } } }	 }
 } |	 s„ |  j j | | | | |
 | | ƒ n( |  j j | | | | | | | |	 |
 ƒ	 d S(   s   Re-run last scriptRu   N(   R¡   R“  RD  RS   t   run_in_current_ipyclientRv  R÷   t   open_external_console(   R_   RÌ  R‘  R  R°  RŸ  R»  Rº  R²  R³  R±  R´  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRé  ¡	  s    *	c         C   s   |  j  ƒ  } | j ƒ  d S(   s1   Run selection or current line in external consoleN(   Rx  R®  (   R_   Rg  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR®  ´	  s    c         C   s   |  j  ƒ  } | j ƒ  d S(   s   Run current cellN(   Rx  R¯  (   R_   Rg  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR¯  º	  s    c         C   s   |  j  ƒ  } | j ƒ  d S(   s,   Run current cell and advance to the next oneN(   Rx  Rê  (   R_   Rg  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRê  À	  s    c         C   s   |  j  ƒ  } | j ƒ  d S(   s   Run last executed cell.N(   Rx  Rë  (   R_   Rg  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyRë  Æ	  s    c         C   s   |  j  ƒ  j ƒ  } | d k r: |  j ƒ  } | j | ƒ nE | j ƒ  } | j ƒ  | } | d k r | j | ƒ | j | ƒ n  | j ƒ  d S(   s   Zoom in/out/reseti    N(   Rx  RG  RS  t   set_fontRX  t	   pointSizet   setPointSizet   update_tab_stop_width_spaces(   R_   t   factorRö   RX  Ræ  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR‰  Í	  s    c   D      C   së  |  j  d$ k	 rçd } |  j ƒ  } d } |  j | ƒ } d } |  j | ƒ } d } |  j | ƒ }	 d }
 |  j |
 ƒ } d } |  j | ƒ } x¹ |  j  D]® } | | k r¶ | j | ƒ n  | | k rÒ | j | ƒ n  | | k rî | j | ƒ n  | | k r
| j |	 ƒ n  |
 | k r&| j | ƒ n  | | k r” | j	 | ƒ q” q” Wd } |  j | ƒ } d } |  j | ƒ } d	 } |  j | ƒ } d
 } |  j | ƒ } d } |  j | ƒ } d } |  j | ƒ } d } |  j | ƒ } d } |  j | ƒ } d } |  j | ƒ }  d }! |  j |! ƒ }" d }# |  j |# ƒ }$ d }% |  j |% ƒ }& d }' |  j |' ƒ }( d }) |  j |) ƒ }* d }+ |  j |+ ƒ }, d }- |  j |- ƒ }. d }/ |  j |/ ƒ }0 d }1 |  j |1 ƒ }2 d }3 |  j |3 ƒ }4 d }5 |  j |5 ƒ }6 d }7 t
 j d d ƒ }8 d }9 |  j |9 ƒ }: d }; |  j |; ƒ }< d  }= |  j |= ƒ }> d! }? |  j |? ƒ }@ d" }A |  j |A ƒ }B |  j ƒ  }C x|  j  D]} | | k r£| j | ƒ n  | | k rÅ| j | d# |C ƒn  | | k rñ| j | ƒ |  j j | ƒ n  | | k r| j | ƒ n  | | k r)| j | ƒ n  | | k rE| j | ƒ n  | | k ra| j | ƒ n  | | k r}| j | ƒ n  | | k r™| j |  ƒ n  |! | k rµ| j |" ƒ n  |# | k rÑ| j |$ ƒ n  |% | k rí| j |& ƒ n  |' | k r	| j |( ƒ n  |) | k r%| j |* ƒ n  |+ | k rA| j |, ƒ n  |- | k r]| j |. ƒ n  |/ | k ry| j |0 ƒ n  |1 | k r•| j  |2 ƒ n  |3 | k r±| j! |4 ƒ n  |5 | k rÍ| j" |6 ƒ n  |7 | k ré| j# |8 ƒ n  |9 | k r| j$ |: d# |C ƒn  |; | k r-| j% |< d# |C ƒn  |= | k rO| j& |> d# |C ƒn  |? | k rk| j' |@ ƒ n  |A | k r| j( |B ƒ qqW|C d$ k	 rç|9 | k r¶|: r¶|C j) ƒ  n  |; | k sÎ|= | k rä|C j* |< |> ƒ qäqçn  d$ S(%   s*   Apply configuration file's plugin settingst   color_scheme_nameRm   Rn   Ro   s   occurrence_highlighting/timeoutRv   Rf   Rg   Rh   Ri   Rl   Rs   RŒ   RŽ   R   s   codecompletion/autos   codecompletion/case_sensitives   codecompletion/enter_keyRy   Rz   R|   R}   R~   R   R   Rƒ   t   connect_to_oiR  s   connect/editorR’   s   code_analysis/pyflakess   code_analysis/pep8R“   s   realtime_analysis/timeoutt   current_finfoN(+   R  RS   RT  R¡   t   set_color_schemeR€  R  R‚  Rƒ  Rv  R!   RH   Rí  R…  Rn  Rm  R  R  Ro  Rp  R}  R~  R  R†  Rq  Rr  Rs  Rt  Ru  Rw  Rx  Ry  Rz  R{  R|  Rž  Rj  Rh  Ri  Rk  Rl  t   run_todo_findert   run_code_analysis(D   R_   RI  t   color_scheme_nt   color_scheme_ot   currentline_nt   currentline_ot   currentcell_nt   currentcell_ot   occurrence_nt   occurrence_ot   occurrence_timeout_nt   occurrence_timeout_ot   focus_to_editor_nt   focus_to_editor_oRg  t   tabbar_nt   tabbar_ot   linenb_nt   linenb_ot   blanks_nt   blanks_ot
   edgeline_nt
   edgeline_ot   edgelinecol_nt   edgelinecol_ot   wrap_nt   wrap_ot   tabindent_nt   tabindent_ot   ibackspace_nt   ibackspace_ot   removetrail_nt   removetrail_ot
   autocomp_nt
   autocomp_ot   case_comp_nt   case_comp_ot   enter_key_nt   enter_key_ot
   calltips_nt
   calltips_ot	   gotodef_nt	   gotodef_ot
   closepar_nt
   closepar_ot   close_quotes_nt   close_quotes_ot   add_colons_nt   add_colons_ot   autounindent_nt   autounindent_ot   indent_chars_nt   indent_chars_ot   tab_stop_width_spaces_nt   tab_stop_width_spaces_ot   help_nt   help_ot   todo_nt   todo_ot
   pyflakes_nt
   pyflakes_ot   pep8_nt   pep8_ot   rt_analysis_nt   rt_analysis_ot   rta_timeout_nt   rta_timeout_oR‰  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   apply_plugin_settingsÜ	  s    





c         C   s:   |  j  d } g  } | g  | j D] } | j ^ q  7} | S(   s/   Get the list of open files in the current stacki    (   R  R‚  RO   (   R_   Rg  R_  R‰  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   get_open_filenamesy
  s    #c         C   sD   |  j  d k	 r@ |  j  j ƒ  s@ |  j ƒ  } |  j d | ƒ q@ n  d S(   sá   
        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.
        R_  N(   R  RS   R8  R
  R~  (   R_   R_  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR€  €
  s    c         C   sT  |  j  t ƒ d } |  j d k	 r4 |  j j ƒ  } n  | rL |  j j ƒ  } n |  j d d g  ƒ} |  j ƒ  | r9t g  | D] } t	 j
 | ƒ ^ q{ ƒ r9|  j | ƒ |  j rCt |  _ |  j d d ƒ } | d k	 ré |  j j | ƒ n  |  j d g  ƒ } x | D] } |  j j | ƒ qW|  j |  |  j d ƒ qCn
 |  j ƒ  |  j  t ƒ d S(   s(   Open the list of saved files per projectR_  R   R{  R|  i    N(   t   set_create_new_file_if_emptyRˆ   RS   R  R  t   get_project_filenamesR¡   RÜ  Rø  RK   RL   Rc  R  R9  RÛ  R  R‹  Ra  R  RO  R†   (   R_   Rˆ  R_  t   fRQ  t
   win_layoutR{  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   setup_open_filesŒ
  s*    
.		
c         C   s   |  j  d |  j ƒ  ƒ d S(   s   Save the list of open filesR_  N(   R~  R
  (   R_   (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   save_open_files¨
  s    c         C   s!   x |  j  D] } | | _ q
 Wd S(   s,   Change the value of create_new_file_if_emptyN(   R  t   create_new_file_if_empty(   R_   t   valueRg  (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR  ¬
  s    (š   Rô   Rõ   t   __doc__t   CONF_SECTIONR]   t   CONFIGWIDGET_CLASSR   R›  R  Rˆ   t   DISABLE_ACTIONS_WHEN_HIDDENR   R@  t   boolR¼  RH  RJ  RL  R  t   run_in_current_extconsoleR  R  RW  R   R^  Rd  Rh  Rl  Rp  Rq  Rr  R6  Rt  R‹  RE  RR  R\  Rf  Ra  RS   Rb  Re  Rg  RÀ  RÁ  RÃ  R©  R«  R­  R¢  R1  R®  Rç  Rß  Rê  Rì  Rx  RG  Rí  RH  Rî  Rï  R3  Rò  R´  Rz  Rõ  R°  Rñ  R±  Rµ  R¯  R²  R³  Rÿ   RW   RO  R  RZ  R&  RÊ  R™   R  R  R  RR   t   objectR†   Rc  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â  RÃ  R  R  R  RK  RJ  R[  R¶  R·  Rù  R   Rû  Rý  R  Rà  Rá  RX   R[   R£  Rè  Ræ  R§  Rå  Ré  R®  R¯  Rê  Rë  R‰  R	  R
  R€  R  R  R  (    (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyR^   q  s2  	ˆ										 	ÿ ÿ 								z																														
		S		
	€							
							
		D							(m   R  R	  t   os.pathRð  RK   R/  R3  t   qtpyR    R   t   qtpy.compatR   R   R   t   qtpy.QtCoreR   R   R   R   t
   qtpy.QtGuiR	   Rs  R
   R   R   t   qtpy.QtWidgetsR   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   t   spyderR   t   spyder.config.baseR   R   R    t   spyder.config.mainR!   R"   R#   t   spyder.config.utilsR$   R%   R&   t   spyder.py3compatR'   R(   R)   t   spyder.utilsR*   R+   R,   R-   R.   Rb   t"   spyder.utils.introspection.managerR/   t   spyder.utils.qthelpersR0   R1   R2   t   spyder.utils.miscR3   t   spyder.widgets.findreplaceR4   t   spyder.widgets.editorR5   R6   R7   R8   t$   spyder.widgets.sourcecode.codeeditorR9   t   spyder.widgets.statusR:   R;   R<   R=   t   spyder.pluginsR>   t   spyder.plugins.configdialogR?   t   spyder.plugins.runconfigR@   RA   RB   RC   t   NBCONVERT_REQVERt   addRP   RU   RW   RX   R[   t   find_programRä  R]   R^   (    (    (    s4   lib/python2.7/site-packages/spyder/plugins/editor.pyt   <module>   sN   "j""""						ÿ 