
,]c           @  sl  d  d l  m Z d  d l Z d  d l j Z d  d l m Z m Z m	 Z	 m
 Z
 m Z 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 d  d l m Z d  d l m Z m Z d  d l m  Z! d  d	 l" m# Z# d  d
 l$ m% Z% m& Z& d   Z' d   Z( d   Z) d e	 f d     YZ* d e f d     YZ+ d e f d     YZ, d S(   i(   t   print_functionN(   t   Signalt   QEventt   QObjectt   QRegExpt   QSizet   Qt(   t   QIcont   QRegExpValidatort   QTextCursor(   t   QDialogt   QHBoxLayoutt   QLabelt	   QLineEditt   QListWidgett   QListWidgetItemt   QVBoxLayoutt   QMainWindow(   t   _(   t	   iteritemst   to_text_string(   t   icon_manager(   t   get_search_scores(   t   HelperToolButtont   HTMLDelegatec         C  st   g  } xa |  D]Y } |  | } | r | d k r | j    rf | j | | j | j | j   f  qf q q Wt |  S(   sA   Returns a list with line number, definition name, fold and token.t   found_cell_separators(   t   is_class_or_functiont   appendt   def_namet
   fold_levelt	   get_tokent   sorted(   t   oedatat   symbol_listt   keyt   val(    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyt   process_python_symbol_data   s    
c         C  s4  t  j d  } t  j d  } t  j d  } t  j d  } t  j d  } t |   } t t t g  | D] } | d ^ qg    } d g t |  }	 d g t |  }
 g  } d } x{ | D]s } xj t |  D]\ \ } } | \ } } } } | | k rq n  | | k r$| j	 |  | } q | |	 | <q Wq Wx t |  D] \ } } |	 | } | d d k rv| |
 | <n* | d d k r| |
 | <n t
   |
 | <| d k	 rC| d d k r,| d d k r| d	 j d
  r| |
 | <q)| d d k r| d	 j d  r| |
 | <q)| |
 | <q,qCqCW|
 S(   s3   Return a list of icons for oedata of a python file.t   classt   methodt   functiont   private1t   private2i   it   defi   t   __R   N(   t   imat   iconR$   R   t   listt   sett   Nonet   lent	   enumerateR   R   t
   startswith(   R    t
   class_icont   method_icont   function_icont   private_icont   super_private_icont   symbolst   st   fold_levelst   parentst   iconst   indexest   parentt   levelt   indext   itemt   linet   nameR   t   token(    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyt   get_python_symbol_icons(   sF    /	
##c           s  |  }  g    x t  t |  |   D] \ } \ } } | r[   j t d   d |  | <q# t j t j |   \ } }   j | t j  g  | j	 t j  D] } | r | ^ q |  | <q# W   f d     d   t  |   D  g    D] } | j
 t j  ^ q S(   sL  
    Takes a list of paths and tries to "intelligently" shorten them all. The
    aim is to make it clear to the user where the paths differ, as that is
    likely what they care about. Note that this operates on a list of paths
    not on individual paths.

    If the path ends in an actual file name, it will be trimmed off.
    s   unsaved filec           s  t  j } t |  j    s d  St |  j    d   sD d  nF xC t   D]5 \   t   f d   |  j   D  sQ PqQ qQ W d k r d } n  d k r  d } n;  d k r  d |  d } n d |   d } x4 |  D], }  | c | | 7<|  |  |  | <q Wx|  rd |    } x t r  f d   | j   D } | r  d k r| } n  Pn  t	 t
 |   \ }     f d   | j   D } t |  t |  k s  d k r| }   d 7  qCPqCWt	 t
 |   \ }    d k r$d } n\   d k r= d } nC   d k rb d |  d } n  d d |    d } xA | j   D]3 }  | c |   d k r| n d 7<|  | =qW   f d	   | j   D  q-Wd  S(
   Ni    c         3  s1   |  ]' } t  |    k o( |    k Vq d  S(   N(   R1   (   t   .0t   toks(   R:   t
   sample_val(    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pys	   <genexpr>   s   t    i   i   s   ...c           s1   i  |  ]' \ } } t  |    k r | |  q S(    (   R1   (   RG   t   idxRH   (   t   k(    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pys
   <dictcomp>   s   	 	c           s3   i  |  ]) \ } } |      k r | |  q S(    (    (   RG   RK   RH   (   RL   t   sample_toks(    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pys
   <dictcomp>   s   	 	c           s#   i  |  ] \ } } |   |  q S(    (    (   RG   RK   RH   (   RL   (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pys
   <dictcomp>   s   	 (   t   ost   sept   anyt   valuesR.   R2   t   allt   Truet   itemst   nextR   R1   t   keys(   t	   level_idxRO   t
   short_formRK   t   groupt   prospective_groupR   (   t   new_path_listt   recurse_level(   RL   R:   RM   RI   s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyR\   u   s`    						$	&c         S  s%   i  |  ] \ } } | r | |  q S(    (    (   RG   t   it   pl(    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pys
   <dictcomp>   s   	 N(   R2   t   zipR   R   R0   t   ospt
   splitdrivet   dirnameRO   t   splitt   rstripRN   (   t	   path_listt
   is_unsavedt   iit   patht   is_unsavt   drivet   part(    (   R[   R\   s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyt   shorten_paths[   s    (3Ct   KeyPressFilterc           B  s6   e  Z d  Z d d Z Z e   Z e   Z d   Z RS(   sD   Use with `installEventFilter` to get up/down arrow key press signal.ii   c         C  s{   | j    t j k rb | j   t j k r: |  j j   qb | j   t j k rb |  j	 j   qb n  t
 t |   j | |  S(   N(   t   typeR   t   KeyPressR"   R   t   Key_Upt   sig_up_key_pressedt   emitt   Key_Downt   sig_down_key_pressedt   superRm   t   eventFilter(   t   selft   srct   e(    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyRv      s    (	   t   __name__t
   __module__t   __doc__t   UPt   DOWNR   Rq   Rt   Rv   (    (    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyRm      s
   		t   FilesFilterLinec           B  s   e  Z d  Z e Z d   Z RS(   s'   QLineEdit used to filter files by name.c         C  s   t  |  _ t t |   j |  S(   s   
        Detect when the focus goes out of this widget.

        This is used to make the file switcher leave focus on the
        last selected file by the user.
        (   RS   t   clicked_outsideRu   R   t   focusOutEvent(   Rw   t   event(    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyR      s    	(   Rz   R{   R|   t   FalseR   R   (    (    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyR      s   t   FileSwitcherc           B  s  e  Z d  Z e e e  Z d d Z Z d Z	 d   Z
 e d    Z e d    Z e d    Z e d    Z e d	    Z e d
    Z e d    Z e d    Z e d    Z e d    Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z  d   Z! d   Z" d   Z# d   Z$ d   Z% d) d) d) d  Z' d    Z( d!   Z) d"   Z* d#   Z+ d$   Z, d%   Z- d&   Z. d'   Z/ d(   Z0 RS(*   s   A Sublime-like file switcher.i   i   iX  c         C  sN  t  j |  |  g  |  _ g  |  _ g  |  _ |  j | | | |  d  |  _ |  j |  _	 d  |  _
 d  |  _ d  |  _ d  |  _ t |  _ t d  } t d d  } t |   |  _ t   |  _ t |   |  _ t   |  _ t | |  j  } |  j t j t j B |  j d  |  j j  |  j  |  j j! |  |  j j" |  |  j j# t$ |    t%   }	 |	 j& |  j  |	 j& |  j  t'   }
 |
 j( |	  |
 j& |  j  |  j) |
  |  j* j+ |  j,  |  j j- j+ |  j.  |  j j/ j+ |  j0  |  j j1 j+ |  j2  |  j j3 j+ |  j4  |  j j5 j+ |  j6  |  j j7 j+ |  j j8  d  S(   Ns+  Press <b>Enter</b> to switch files or <b>Esc</b> to cancel.<br><br>Type to filter filenames.<br><br>Use <b>:number</b> to go to a line, e.g. <b><code>main:42</code></b><br>Use <b>@symbol_text</b> to go to a symbol, e.g. <b><code>@init</code></b><br><br> Press <b>Ctrl+W</b> to close current tab.<br>s*   ([A-Za-z0-9_]{0,100}@[A-Za-z0-9_]{0,100})|s'   ([A-Za-z0-9_]{0,100}:{0,1}[0-9]{0,100})gffffff?(9   R
   t   __init__t   plugins_tabst   plugins_datat   plugins_instancest
   add_pluginR0   t   plugint	   FILE_MODEt   modet   initial_cursorst   initial_patht   initial_widgett   line_numberR   t
   is_visibleR   R   R   t   editR   t   helpR   R.   Rm   t   filterR   t   setWindowFlagsR   t   Popupt   FramelessWindowHintt   setWindowOpacityt   installEventFiltert   setValidatort
   setToolTipt   setItemDelegateR   R   t	   addWidgetR   t	   addLayoutt	   setLayoutt   rejectedt   connectt   restore_initial_stateRq   t   previous_rowRt   t   next_rowt   returnPressedt   acceptt   textChangedt   setupt   itemSelectionChangedt   item_selection_changedt   clickedt   setFocus(   Rw   R?   R   t   tabst   dataR-   t	   help_textt   regext   regex_validatort   edit_layoutt   layout(    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyR      sP    										
		c         C  se   g  } xX |  j  D]M } |  j |  } | g  t | j    D] } | j |  | f ^ q; 7} q W| S(   N(   R   t   get_plugin_tabwidgett   ranget   countt   widget(   Rw   t   widgetsR   R   RA   (    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyR   '  s    6c         C  sY   g  } xL |  j  D]A } y | d j   } Wn t k
 rC d } n X| j |  q W| S(   Ni    (   R   t   get_line_countt   AttributeErrorR   (   Rw   t
   line_countR   t   current_line_count(    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyR   0  s    
c         C  sM   g  } x@ |  j  D]5 \ } } | g  | D] } t | d t  ^ q& 7} q W| S(   Nt   newly_created(   R   t   getattrR   (   Rw   t   save_statust   daR-   t   td(    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyR   ;  s    -c         C  sV   g  } xI |  j  D]> } |  j |  } | g  | D] } t | d d   ^ q/ 7} q W| S(   Nt   filename(   R   t   get_plugin_dataR   R0   (   Rw   t   pathsR   R   R   (    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyR   B  s
    -c      	   C  sb   g  } xU |  j  D]J } |  j |  } | g  | D]$ } t j j t | d d    ^ q/ 7} q W| S(   NR   (   R   R   RN   Rh   t   basenameR   R0   (   Rw   t	   filenamesR   R   R   (    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyR   J  s    3c         C  sA   g  } x4 |  j  D]) \ } } | g  | D] } | ^ q& 7} q W| S(   N(   R   (   Rw   R=   R   R-   R   (    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyR=   T  s    !c         C  s   |  j  j |  j   d   S(   N(   t   paths_by_widgett   gett
   get_widgetR0   (   Rw   (    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyt   current_path[  s    c         C  s6   g  |  j  D] } | d ^ q
 } t t | |  j   S(   Ni    (   R   t   dictR_   R   (   Rw   t   wR   (    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyR   _  s     c         C  s6   g  |  j  D] } | d ^ q
 } t t |  j |   S(   Ni    (   R   R   R_   R   (   Rw   R   R   (    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyt   widgets_by_pathd  s     c         C  s   t  |  j j    j   S(   s9   Get the normalized (lowecase) content of the filter text.(   R   R   t   textt   lower(   Rw   (    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyt   filter_texti  s    c         C  s   |  j  j |  d  S(   N(   R   t   setText(   Rw   t   _str(    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyt   set_search_textn  s    c         C  s   |  j  } |  j   |  _ i  |  _ xk t |  j  D]Z \ } } | |  j k r\ | | |  _ n  y | j   |  j | | <Wq1 t k
 r q1 Xq1 Wd S(   s/   Save initial cursors and initial active widget.N(	   R   R   R   R   R2   R   R   t
   textCursorR   (   Rw   R   R]   t   editor(    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyt   save_initial_stateq  s    		c         C  s'   t  |  _ t j |   |  j j   d  S(   N(   R   R   R
   R   R.   t   clear(   Rw   (    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyR     s    	c         C  s   |  j  j   t |  _ |  j } |  j j s xA |  j D]6 } |  j | } | | k r5 |  j | | |  q5 q5 W|  j	 |  j
 k r |  j j |  j  } |  j j |  q n  d S(   s3   Restores initial cursors and initial active editor.N(   R.   R   R   R   R   R   R   R   t   set_editor_cursorR   R   R   RA   R   t   sig_goto_fileRr   (   Rw   R   Rh   t   cursorRA   (    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyR     s    		c         C  s  |  j    } | j   } |  j j   } | j   j   d | d } t | t  r | j j   j   | j   j   j   d } n' |  j	 d d j
   j   j   d } xB | r | j   } | | j   7} | | j   7} | j    } q W|  j | |  d S(   s#   Positions the file switcher dialog.i   i   i    N(   R?   t   geometryR.   t   widtht
   isinstanceR   t   toolbars_menut   heightt   menuBarR   t   tabBart   topt   leftt   move(   Rw   R?   t   geoR   R   R   (    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyt   set_dialog_position  s    2'	c         C  s   g  } | r xI | D]A } t  |  } | j t j  | j | j    | j   } q Wt g  | D] } | j |  d ^ qb  | j	   f Sd S(   sp   
        Get the max size (width and height) for the elements of a list of
        strings as a QLabel.
        g?N(
   R   t   setTextFormatR   t	   PlainTextR   R   t   fontMetricst   maxR   R   (   Rw   t   contentt   stringst	   rich_textt   labelt   fmR:   (    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyt   get_item_size  s    c         C  s   | r |  j  |  \ } } |  j   } | j   j   d } | |  j k rX |  j } n  |  j j |  t |  d k  r t |  } n d } | | d } |  j j |  |  j j	 | |  j j
    n  d S(   s   
        Adjusts the width and height of the file switcher
        based on the relative size of the parent and content.
        g?i   g      @N(   R   R?   R   R   t	   MAX_WIDTHR.   t   setMinimumWidthR1   t   setMinimumHeightt   resizeR   (   Rw   R   R   R   R?   t   relative_widtht   max_entriest
   max_height(    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyt   fix_size  s    c         C  s   |  j  j   S(   s'   Gets the item count in the list widget.(   R.   R   (   Rw   (    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyR     s    c         C  s   |  j  j   S(   s4   Returns the current selected row in the list widget.(   R.   t
   currentRow(   Rw   (    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyt   current_row  s    c         C  s   |  j  j |  S(   s1   Sets the current selected row in the list widget.(   R.   t   setCurrentRow(   Rw   t   row(    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyt   set_current_row  s    c         C  sF   |  j    | } d | k o- |  j   k  n rB |  j |  n  d S(   s   Select row in list widget based on a number of steps with direction.

        Steps can be positive (next rows) or negative (previous rows).
        i    N(   R   R   R   (   Rw   t   stepsR   (    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyt
   select_row  s    "c         C  s   |  j  |  j k r# |  j d  d S|  j   d } | d k rZ |  j j |  j   } n d } | d k r d | k r |  j j   n) d | k r |  j d  n |  j d  d S(   s#   Select previous row in list widget.iNi   i    RJ   s   </b></big><br>i(   R   t   SYMBOL_MODER   R   R.   RB   R   t   scrollToTop(   Rw   t   prev_rowt   title(    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyR     s    c         C  s   |  j  |  j k r$ |  j d 
 d S|  j   d } | |  j   k  r d |  j j |  j   k ru |  j d 
 q |  j d 
 n  d S(   s   Select next row in list widget.i   Ns   </b></big><br>i   (   R   R   R   R   R   R.   RB   R   (   Rw   R   (    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyR     s    c         C  s>   t  g  |  j |  D] } | d j   ^ q  } | | } | S(   s(   Get the real index of the selected item.i    (   t   sumR   R   (   Rw   t   stack_indext   plugin_indext
   other_tabst   other_plugins_countt
   real_index(    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyt   get_stack_index
  s    *
c         C  s:   y | j    j } Wn  t k
 r5 | j    j } n X| S(   s8   Get the data object of the plugin's current tab manager.(   t   get_current_tab_managerR   R   t   clients(   Rw   R   R   (    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyR     s
    c         C  s:   y | j    j } Wn  t k
 r5 | j    j } n X| S(   s6   Get the tabwidget of the plugin's current tab manager.(   R  R   R   t	   tabwidget(   Rw   R   R  (    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyR     s
    c         C  s]   | r | s | r% | r% | j  |  S|  j rD |  j |  j  j   S|  j d d j   Sd S(   sl   Get widget by index.

        If no tabs and index specified the current active widget is returned.
        i    N(   R   R   R   t   currentWidgetR   (   Rw   RA   Rh   R   (    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyR   *  s
    	c         C  sn   | j    } | j   } t   } | | k r= | j |  n  | j |  | j | t j  | j |  d S(   s   Set the cursor of an editor.N(   t   positiont   anchorR	   t   movePositiont
   KeepAnchort   setTextCursor(   Rw   R   R   t   posR  t
   new_cursor(    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyR   6  s    	c         C  sA   | r= t  |  } y |  j j |  Wq= t k
 r9 q= Xn  d S(   s5   Go to specified line number in current active editor.N(   t   intR   t
   go_to_lineR   (   Rw   R   (    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyt	   goto_lineC  s    c         C  s4   y |  j    j   } Wn t k
 r/ i  } n X| S(   s,   Get the list of symbols present in the file.(   R   t   get_outlineexplorer_dataR   (   Rw   R    (    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyt   get_symbol_listM  s
    
c         C  sb  |  j    } |  j   r^| d k r^d |  j j   j   k rX | d k rX |  j   n  |  j |  j k rAy |  j j	 |  j
 |  } |  j | d |  _ |  j j	 |  j  } |  j | |  } |  j j | |  j j    |  j |  j  y |  j j   |  j   Wn t k
 rn X|  j j   Wq[t k
 r=q[Xq^|  j | } |  j |  n  d S(   s*   List widget item selection change handler.i    s   </b></big><br>i   N(   R   R   R.   t   currentItemR   R   R   R   R   RA   t   filtered_pathR   R   R   R
  R   Rr   R  R  R   t   switch_to_plugint   raise_R   R   R   t
   ValueErrort   filtered_symbol_lines(   Rw   R   R  R  R	  R   (    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyR   V  s0    '		c         C  s  t  |  j |  j  } |  j } |  j } g  } d | k } | r | j d  \ } } | d k ri d } n  t d |  j d d }	 n d } t | |  j d d }	 |  j |  d }
 |  j	 |  x t
 |	  D] \ } } | \ } } } | d k r d | j d d  d	 } | r<| d
 j |  j | t d   7} n  |
 |  j j   k rk| d j | |  7} n | d j | |  7} | r|  j | d k s| r| j | | | f  qq q Wg  |  _ d } xZt |  D]L} | d } | | } | | } d } y |  j | d j   j d  } | | d k r| d } | d | d 7} t |  } | j |  | j t d d   | j t j  |  j j |  |  j j |  n  Wn n Xd } | | d 7} t | |  } | j |  | j t d d   |  j j |  |  j j |  qWt |  j _ | |  j k re|  j  |  j j! |   n |  j r~|  j  d  n  | |  _" |  j# |  d S(   s0   Setup list widget content for file list display.t   :RJ   t   templates
   <b>{0}</b>i    is   <big>t   &s   </big>s    [{0:} {1:}]t   linesu   <br><i>{0:}</i>i   s    - s   <br><big><b>s   </b></big><br>i   N($   Rl   R   R   R=   Rc   R0   R   R   R   R   R2   t   replacet   formatR   R   R.   R   R   R  R   R   t   get_plugin_titleR   R   t   setSizeHintR   t   setFlagsR   t   ItemIsEditablet   addItemRS   t
   files_listR   RA   R   R  (   Rw   R   R   t   short_pathsR   R=   t   resultst   trying_for_line_numberR   t   scorest	   max_widthRA   t   scoreR   R   t   score_valuet	   text_itemR   t   resultRh   R-   R  RB   (    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyt   setup_file_listu  s~    				 	


 
		c      	   C  s  | j  d  \ } } |  j   } t |  } |  j } |  j |  t |  } g  | D]! } | d | d | d f ^ qV }	 g  | D] } | d ^ q }
 t | |
 d d } g  } g  } g  |  _ x~ t |  D]p \ } } | \ } } } |	 | \ } } } | j	 |  | d k r | j	 | | | | | | | | f  q q Wd	 } x t
 |  D] \ } } } } } } } d
 | } | d } |  j j	 |  | j | |  } t | |  } | j t d d   |  j j |  qXWt |  j _ |  j j   d S(   s2   Setup list widget content for symbol list display.t   @i    i   i   i   R"  s
   <b>{0}</b>is   {0}{1}s   &nbsp;i   N(   Rc   R  RF   R   R   R$   R   R   R2   R   R   R&  R   R(  R   R.   R+  R   R,  R   R   (   Rw   R   R   t   symbol_textR    R=   R   R!   RB   t   line_fold_tokent   choicesR0  R.  R$  RA   R2  R   R   R3  RC   R   RE   R"  R-   t
   fold_spaceR   t   textline(    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyt   setup_symbol_list  s>    	.	%

c         C  s   t  |  j  d k r# |  j   d S|  j j   |  j } |  j } d |  j k } | rv |  j |  _ |  j	 | |  n |  j
 |  _ |  j | |  |  j   d S(   s   Setup list widget content.i    NR7  (   R1   R   t   closeR.   R   R   R   R   R   R=  R   R6  R   (   Rw   R   R   t   trying_for_symbol(    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyR     s    
		c         C  s!   |  j    t t |   j   d S(   s   
        Override Qt method to force an update of the fileswitcher before
        showing it. See Issue #5317 and PR #5389.
        N(   R   Ru   R   t   show(   Rw   (    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyR@    s    
c         C  s@   |  j  j | | f  |  j j | | f  |  j j |  d S(   s"   Add a plugin to display its files.N(   R   R   R   R   (   Rw   R   R   R   R-   (    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyR   '  s    N(1   Rz   R{   R|   R   R  t   objectR   R   R   R   R   t   propertyR   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   R0   R   R   R  R  R   R6  R=  R   R@  R   (    (    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyR      sR   	>	
															
				
				V	=		(-   t
   __future__R    RN   t   os.pathRh   R`   t   qtpy.QtCoreR   R   R   R   R   R   t
   qtpy.QtGuiR   R   R	   t   qtpy.QtWidgetsR
   R   R   R   R   R   R   R   t   spyder.config.baseR   t   spyder.py3compatR   R   t   spyder.utilsR   R,   t   spyder.utils.stringmatchingR   t   spyder.widgets.helperwidgetsR   R   R$   RF   Rl   Rm   R   R   (    (    (    s:   lib/python2.7/site-packages/spyder/widgets/fileswitcher.pyt   <module>   s    .:		3	b