
,]c           @  s  d  Z  d d l m Z d d l Z d d l j Z d d l Z d d l Z d d l	 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 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  m! Z! m" Z" m# Z# m$ Z$ m% Z% m& Z& m' Z' m( Z( m) Z) d d l* m+ Z+ m, Z, d d	 l- m. Z. m/ Z/ m0 Z0 d d
 l1 m2 Z3 d d l1 m4 Z4 m5 Z5 m6 Z6 m7 Z7 d d l8 m9 Z9 m: Z: m; Z; m< Z< d d l= m> Z> y d d l? m@ ZA Wn eB ZA n Xd   ZC eB d  ZD d   ZE d   ZF d d eG eG d  ZH d   ZI d e  f d     YZJ d e' f d     YZK d e f d     YZL d eK f d     YZM d eK f d      YZN d! e) f d"     YZO d# e) f d$     YZP d% e) f d&     YZQ d'   ZR eS d( k reR d) eT  eR d) eG  n  d S(*   s   Files and Directories Exploreri(   t   with_statementN(   t   getsavefilenamet   getexistingdirectory(
   t   QDirt	   QFileInfot	   QMimeDatat   QSizet   QSortFilterProxyModelt   Qtt   QTimert   QUrlt   Signalt   Slot(   t   QDrag(   t   QFileSystemModelt   QHBoxLayoutt   QFileIconProvidert   QInputDialogt   QLabelt	   QLineEditt   QMenut   QMessageBoxt   QToolButtont	   QTreeViewt   QVBoxLayoutt   QWidget(   t   _t   get_home_dir(   t	   str_lowert   to_binary_stringt   to_text_string(   t   icon_manager(   t   encodingt   misct   programst   vcs(   t   add_actionst   create_actiont   file_urit   create_plugin_layout(   t   getcwd_or_home(   t   PythonExporterc         C  sp   t  j d k r( t j d d |  g  nD t j j |   }  t j d k rY t j |   n t j d |  g  d  S(   Nt   darwint   opens   -Rt   nts   xdg-open(	   t   syst   platformt
   subprocesst   callt   ost   patht   dirnamet   namet	   startfile(   t   filename(    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   open_file_in_external_explorer1   s    c         C  s@   t  |  t t f  s! |  g }  n  x |  D] } t |  q( Wd S(   sc   Show files in external file explorer

    Args:
        fnames (list): Names of files to show.
    N(   t
   isinstancet   tuplet   listR7   (   t   fnamest   fname(    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   show_in_external_file_explorer;   s    c         C  s=   t  j d k r t j n t j } | t j t j |     S(   sA   Normalize path fixing case, making absolute and removing symlinksR,   (   R1   R4   t   ospt   normcaset   normpatht   abspatht   realpath(   R2   t   norm(    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   fixpathF   s    !c         C  s   t  j j d d d g  } y t j t |  |  d  WnH t k
 r } t j t	 d  t	 d  t
 j |   t |  f  n Xd S(   s   Create a new Python scripts   # -*- coding: utf-8 -*-t    s   utf-8s
   Save Errors;   <b>Unable to save file '%s'</b><br><br>Error message:<br>%sN(   R1   t   linesept   joinR    t   writeR   t   EnvironmentErrorR   t   criticalR   R>   t   basenamet   str(   R<   t   textt   error(    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   create_scriptL   s    	t   .s
   \.pyc$|^\.c         C  s   g  } t  t j  g } x t j t  |    D] } t j | |  rS | rS q. n  t j t j |  |   r~ | j	 |  q. | r q. q. t j | |  s | r. | j	 |  q. q. Wt
 | d t t
 | d t S(   s   List files and directoriest   key(   R   R>   t   pardirR1   t   listdirt   ret   searcht   isdirRG   t   appendt   sortedR   (   R2   t   includet   excludet   show_allt   folders_onlyt   namelistt   dirlistt   item(    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyRS   W   s    c         C  sH   y) t  t |  | | | d t  d k SWn t t f k
 rC t SXd S(   s&   Return True if path has subdirectoriesR\   i   N(   t   lenRS   t   Truet   IOErrort   OSErrort   False(   R2   RY   RZ   R[   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   has_subdirectoriesi   s
    t   IconProviderc           B  s   e  Z d    d d d d g D Z i d d 6d d 6d d	 6d d
 6d d 6d d 6d d 6Z i d d 6d d 6d d 6Z d   Z e e  e e  d     Z	 RS(   c         C  s   i  |  ] } d  |  q S(   t   ArchiveFileIcon(    (   t   .0t   x(    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pys
   <dictcomp>t   s   	 t   zips   x-tars   x-7z-compressedt   rart   PowerpointFileIcons   vnd.ms-powerpoints=   vnd.openxmlformats-officedocument.presentationml.presentationt   WordFileIcont   mswords;   vnd.openxmlformats-officedocument.wordprocessingml.documentt   ExcelFileIcons   vnd.ms-excels5   vnd.openxmlformats-officedocument.spreadsheetml.sheett   PDFIcont   pdfs   .xlsxs   .docxs   .pptxc         C  sO   t  t |   j   | |  _ i  |  _ |  j j |  j  |  j j |  j  d  S(   N(   t   superRf   t   __init__t   treeviewt   application_iconst   updatet	   BIN_FILESt   DOCUMENT_FILES(   t   selfRt   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyRs      s
    		c         C  s  t  | t j  r( t t |   j |  S| } t j t | j	     } t j
 |  re t j d  St j |  } t j |  \ } } t j |  \ } } t j d  } | |  j k r t j |  j |  } n  | d k	 ry | j d  \ }	 }
 Wn t k
 rd }	 n X|	 d k r2t j d  } q|	 d k rPt j d  } q|	 d k rnt j d	  } q|	 d
 k rt j d  } q|	 d k r|
 |  j k rt j |  j |
  } qqn  | Sd S(   s   Reimplement Qt methodt   DirOpenIcont   FileIcont   /RM   t   TextFileIcont   audiot   AudioFileIcont   videot   VideoFileIcont   imaget   ImageFileIcont   applicationN(   R8   R   t   IconTypeRr   Rf   t   iconR>   R@   R   t   absoluteFilePathRV   t   imaRK   t   splitextt   mimet
   guess_typet   OFFICE_FILESt   Nonet   splitt
   ValueErrorRu   (   Ry   t   icontype_or_qfileinfot	   qfileinfoR<   RK   R   t	   extensiont	   mime_typeR   t	   file_typet   bin_name(    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR      s:    
(
   t   __name__t
   __module__Rw   Rx   R   Rs   R   t   intR   R   (    (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyRf   s   s   


		t   DirViewc           B  s  e  Z d  Z d@ d  Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d   Z d	   Z d
   Z d d g e d  Z d   Z d   Z e   d    Z e e  d    Z d   Z 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$ e   d@ d!   Z% d"   Z& d#   Z' e   d@ d$   Z( d%   Z) d&   Z* e   d@ d'   Z+ d(   Z, e   d)    Z- d*   Z. e   d@ d+   Z/ e   d@ d,   Z0 e   d@ d@ d-   Z1 d.   Z2 d/   Z3 d0   Z4 d1   Z5 d2   Z6 d3   Z7 d4   Z8 d5   Z9 d6   Z: d7   Z; d8   Z< d9   Z= d:   Z> d;   Z? d<   Z@ d=   ZA d>   ZB d?   ZC RS(A   s   Base file/directory tree viewc         C  sx   t  t |   j |  d g |  _ | |  _ d  |  _ d  |  _ d  |  _ d  |  _	 d  |  _
 d  |  _ |  j   d  |  _ d  S(   Ns   *.py(   Rr   R   Rs   t   name_filterst   parent_widgetR   R[   t   menut   common_actionst   _DirView__expanded_statet   _to_be_loadedt   fsmodelt   setup_fs_modelt   _scrollbar_positions(   Ry   t   parent(    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyRs      s    							
c         C  sQ   t  j t  j Bt  j Bt  j B} t |   |  _ |  j j |  |  j j t	  d S(   s   Setup filesystem modelN(
   R   t   AllDirst   Filest   Drivest   NoDotAndDotDotR   R   t	   setFiltert   setNameFilterDisablesRd   (   Ry   t   filters(    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR      s    c         C  s   |  j  |  j  d S(   s   Install filesystem modelN(   t   setModelR   (   Ry   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   install_model   s    c           s     j      j j j   f d      j t    j t    j d t	 j
    j j j   j    j     j   d S(   s
   Setup viewc             s     j  d  S(   Ni    (   t   resizeColumnToContents(    (   Ry   (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   <lambda>   RE   i    N(   R   R   t   directoryLoadedt   connectt   setAnimatedRd   t   setSortingEnabledRa   t   sortByColumnR   t   AscendingOrdert
   modelResett   reset_icon_providert   filter_directories(   Ry   (    (   Ry   s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt
   setup_view   s    

c         C  s   | |  _  |  j j |  d S(   s   Set name filtersN(   R   R   t   setNameFilters(   Ry   R   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   set_name_filters   s    	c         C  s0   | r |  j  j g   n |  j  j |  j  d S(   s   Toggle 'show all files' stateN(   R   R   R   (   Ry   t   state(    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   set_show_all   s    c         C  s)   | r% t  j t |  j j |    Sd S(   s'   Return filename associated with *index*N(   R>   R@   R   R   t   filePath(   Ry   t   index(    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   get_filename   s    c         C  s   |  j  j |  S(   s%   Return index associated with filename(   R   R   (   Ry   R6   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt	   get_index   s    c         C  sU   |  j    |  j k r; g  |  j   D] } |  j |  ^ q" S|  j |  j    g Sd S(   s   Return selected filenamesN(   t   selectionModet   ExtendedSelectiont   selectedIndexesR   t   currentIndex(   Ry   t   idx(    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   get_selected_filenames   s    &c         C  s<   |  j  |  } | r8 t j |  r( | St j |  Sn  d S(   s&   Return dirname associated with *index*N(   R   R>   RV   R3   (   Ry   R   R<   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   get_dirname   s
    s   *.pys   *.pywc         C  sB   |  j    |  j |  | |  _ t |   |  _ |  j   |  _ d S(   s   Setup tree widgetN(   R   R   R[   R   R   t   setup_common_actionsR   (   Ry   R   R[   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   setup  s
    
	c         C  s   |  j  j t |    d S(   sg   Reset file system model icon provider
        The purpose of this is to refresh files/directories iconsN(   R   t   setIconProviderRf   (   Ry   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR     s    c         C  su   t  |  t d  d t j d  d |  j } t  |  t d  d |  j } | j |  j  |  j |  j  | | g S(   s!   Setup context menu common actionss   Edit filename filters...t   filtert	   triggereds   Show all filest   toggledN(	   R%   R   R   R   R   t   edit_filtert
   toggle_allt
   setCheckedR[   (   Ry   t   filters_actiont
   all_action(    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR     s    c         C  s   t  j |  t d  t d  t j d j |  j   \ } } | r g  t |  j d  D] } | j	   ^ qX } |  j
 j j d |  |  j |  n  d S(   s   Edit name filterss   Edit filename filterss   Name filters:s   , t   ,R   N(   R   t   getTextR   R   t   NormalRG   R   R   R   t   stripR   t   sig_option_changedt   emitR   (   Ry   R   t   validt   f(    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR   %  s    	.c         C  s0   |  j  j j d |  | |  _ |  j |  d S(   s   Toggle all files modeR[   N(   R   R   R   R[   R   (   Ry   t   checked(    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR   1  s    	c           s     s
 g  St   t d  d t j d  d    f d   } t   t d  d t j d  d    f d   } t   t d	  d t j d
  d    f d   } t   t d  d t j d  d    f d   } | | d | | g S(   s#   Return actions for submenu 'New...'s   File...R   t   filenewR   c             s    j    d  S(   Ni(   t   new_file(    (   R;   Ry   (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR   >  s    s	   Module...t   spyderc             s    j    d  S(   Ni(   t
   new_module(    (   R;   Ry   (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR   B  s    s	   Folder...t
   folder_newc             s    j    d  S(   Ni(   t
   new_folder(    (   R;   Ry   (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR   F  s    s
   Package...t   package_newc             s    j    d  S(   Ni(   t   new_package(    (   R;   Ry   (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR   J  s    N(   R%   R   R   R   R   (   Ry   R;   t   new_file_actt   new_module_actt   new_folder_actt   new_package_act(    (   R;   Ry   s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   create_file_new_actions8  s     	c         C  s   g  S(   s&   Return actions for submenu 'Import...'(    (   Ry   R;   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   create_file_import_actionsO  s    c           s  t  g  | D] } t j |  ^ q
  } t  g  | D] } t j |  d d k ^ q2  } t  g  | D] } t j |  d d k ^ qd  } t  g  | D] } t j |  ^ q  } t  t d  d t j	 d  d	  j
 } t  t d
  d t j	 d  d	  j } t  t d  d d d	  j }	 t  t d  d t j	 d  d	  j }
 t  t d  d t j	 d  d	  j } t  t d  d	  j } t  t d  d t j	 d  d	  j } g  } | r| j |  n  | r| r| j |  n | j |  t j d k r:t d  } n t d  } t  | d	  j } | j |  | |
 | g 7} t t j | d   } t  g  | D]! } t t j |   | k ^ q r| j |	  n  | d  g 7} | rt d  k	 r| j |  n  t j | d  r$| d n t j | d    t |  d k rt j    r   f d   }    f d   } t  t d  d t j	 d  d	 | } t  t d  d t j	 d  d	 | } | d  | | g 7} n  | S(!   s   Return file management actionsi   s   .pys   .pyws   .ipys   .ipynbt   RunR   t   runR   t   Editt   edits   Move...s   move.pngs	   Delete...t
   editdeletes	   Rename...t   renamet   Opens   Convert to Python scriptt   pythonR*   s   Show in Finders   Show in external file exploreri    c             s    j    g d  S(   Nt   commit(   t   vcs_command(    (   R3   Ry   (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR     RE   c             s    j    g d  S(   Nt   browse(   R   (    (   R3   Ry   (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR     RE   t   Committ
   vcs_commits   Browse repositoryt
   vcs_browse(   s   .pys   .pyws   .ipyN(   t   allR>   t   isfileR   R    t   is_text_fileR%   R   R   R   R   t   clickedt   movet   deleteR   R+   t   convert_notebooksRW   R-   R.   R=   RD   R3   R   t
   nbexporterRV   R`   R#   t   is_vcs_repository(   Ry   R;   t   _fnt
   only_filest   only_modulest   only_notebookst
   only_validt
   run_actiont   edit_actiont   move_actiont   delete_actiont   rename_actiont   open_actiont   ipynb_convert_actiont   actionsRM   t   external_fileexp_actiont   basedirt   commit_slott   browse_slott   vcs_cit   vcs_log(    (   R3   Ry   s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   create_file_manage_actionsS  sl    (,,(!!40!		c           sn   g  } t  j d k r$ t d  } n t d  } t d  } t  | d    f d   } | j |  | S(   s    Return folder management actionsR,   s   Open command prompt heres   Open terminal heres   Open IPython console hereR   c             s    j     S(   N(   t   open_interpreter(    (   R;   Ry   (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR     s    (   R1   R4   R   R%   RW   (   Ry   R;   R  t   _titlet   action(    (   R;   Ry   s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   create_folder_manage_actions  s    c         C  s  g  } |  j    } |  j |  } t |  d k re t t d  |   } t | |  | j |  n
 | | 7} |  j |  } t |  d k r t t d  |   } t | |  | j |  n
 | | 7} | r | j d  n  | r | |  j	 |  7} n  | r| j d  n  | rXt
 g  | D] } t j |  ^ q$ rX| |  j |  7} n  | rn| j d  n  | |  j 7} | S(   s   Create context menu actionsi   t   Newt   ImportN(   R   R   R`   R   R   R$   RW   R   R   R  R   R>   RV   R  R   (   Ry   R  R;   t   new_actionst   new_act_menut   import_actionst   import_act_menuR  (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   create_context_menu_actions  s4    

.c         C  s'   |  j  j   t |  j  |  j    d S(   s   Update context menuN(   R   t   clearR$   R  (   Ry   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   update_menu  s    c         C  s   |  j    t j |  |  S(   s   Reimplement Qt method(   t   executeDelayedItemsLayoutR   t   viewportEvent(   Ry   t   event(    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR#    s    
c         C  s<   y$ |  j    |  j j | j    Wn t k
 r7 n Xd S(   s   Override Qt methodN(   R!  R   t   popupt	   globalPost   AttributeError(   Ry   R$  (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   contextMenuEvent  s
    
c         C  s   | j    t j t j f k r+ |  j   nv | j    t j k rM |  j   nT | j    t j k ro |  j   n2 | j    t j	 k r |  j
   n t j |  |  d S(   s   Reimplement Qt methodN(   RQ   R   t	   Key_Entert
   Key_ReturnR   t   Key_F2R   t
   Key_DeleteR   t   Key_Backspacet   go_to_parent_directoryR   t   keyPressEvent(   Ry   R$  (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR/    s    c         C  s   t  j |  |  |  j   d S(   s   Reimplement Qt methodN(   R   t   mouseDoubleClickEventR   (   Ry   R$  (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR0    s    c         C  sP   |  j    } x= | D]5 } t j |  r8 |  j |  q |  j | g  q Wd S(   s<   Selected item was double-clicked or enter/return was pressedN(   R   R>   RV   t   directory_clickedR+   (   Ry   R;   R<   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR     s
    c         C  s   d S(   s   Directory was just clickedN(    (   Ry   R3   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR1    s    c         C  s    | j  | j   j d   d S(   s   Drag and Drop - Enter events
   text/plainN(   t   setAcceptedt   mimeDatat	   hasFormat(   Ry   R$  (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   dragEnterEvent  s    c         C  s@   | j    j d  r2 | j t j  | j   n
 | j   d S(   s   Drag and Drop - Move events
   text/plainN(   R3  R4  t   setDropActionR   t
   MoveActiont   acceptt   ignore(   Ry   R$  (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   dragMoveEvent  s    c         C  s\   t    } | j g  |  j   D] } t |  ^ q  t |   } | j |  | j   d S(   s)   Reimplement Qt Method - handle drag eventN(   R   t   setUrlsR   R
   R   t   setMimeDatat   exec_(   Ry   t   dropActionst   dataR<   t   drag(    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt	   startDrag  s
    	,c         C  st   | d k r |  j   } n  xR | D]J } t j |  r\ t j |  r\ |  j j j |  q" |  j	 | g  q" Wd S(   s+   Open files with the appropriate applicationN(
   R   R   R>   R   R    R   R   t   sig_open_fileR   t   open_outside_spyder(   Ry   R;   R<   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR+     s    c         C  sR   xK t  |  D]= } t |  } t j |  } | s |  j j j |  q q Wd S(   s   Open file outside Spyder with the appropriate application
        If this does not work, opening unknown file in Spyder, as text fileN(   RX   R&   R"   t
   start_fileR   R   R   (   Ry   R;   R2   t   ok(    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyRC  #  s
    c         C  s.   x' t  |  D] } |  j j j |  q Wd S(   s   Open interpreterN(   RX   R   R  R   (   Ry   R;   R2   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR  ,  s    c         C  sC   | d k r |  j   } n  x! | D] } |  j j j |  q" Wd S(   s   Run Python scriptsN(   R   R   R   R   R   (   Ry   R;   R<   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR   1  s    c         C  s   t  j | d t j d S(   sL   Remove whole directory tree
        Reimplemented in project explorer widgett   onerrorN(   t   shutilt   rmtreeR!   RF  (   Ry   R3   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   remove_tree9  s    c         C  sg  | r' t  j t  j Bt  j Bt  j B} n t  j t  j B} | d k r t  j |  t d  t d  t j	 |  |  } | t  j k r | S| t  j k r t
 S| t  j k r t } q n  yZ t j |  r t j |  |  j j j |  n  |  j |  |  j j j |  | SWnQ t k
 rb} t d  } t  j |  t d  t d  | | t |  f  n Xt
 S(   s   Delete filet   Deletes'   Do you really want to delete <b>%s</b>?R   s   Project Explorers9   <b>Unable to %s <i>%s</i></b><br><br>Error message:<br>%sN(   R   t   Yest   YesAllt   Not   CancelR   t   warningR   R>   RK   Rd   Ra   R   R!   t   remove_fileR   t   removedR   RI  t   removed_treeRI   RJ   R   (   Ry   R<   t   multiplet
   yes_to_allt   buttonst   answerRN   t
   action_str(    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   delete_file>  s4    !		c         C  s   | d k r |  j   } n  t |  d k } d } x | D] } t j | d  } t j |  r t j |  r t j |  t	 d  t	 d   q: |  j
 | | |  } | d k	 r: | r: Pq: q: Wd S(   s   Delete filesi   s   .spyprojects   File Explorers   The current directory contains a project.<br><br>If you want to delete the project, please go to <b>Projects</b> &raquo; <b>Delete Project</b>N(   R   R   R`   R>   RG   RV   t   existsR   t   informationR   RX  (   Ry   R;   RS  RT  R<   t   spyproject_path(    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR   `  s    c         C  sq   y t    j |  d } Wn= t k
 rY } t j |  t d  t d  t |   d SX|  j j j	 |  d S(   s8   Convert an IPython notebook to a Python script in editori    s   Conversion errors=   It was not possible to convert this notebook. The error is:

N(
   R   t   from_filenamet	   ExceptionR   RJ   R   R   R   t   sig_new_fileR   (   Ry   R<   t   scriptt   e(    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   convert_notebookw  s    	c         C  sO   |  j    } t | t t f  s- | g } n  x | D] } |  j |  q4 Wd S(   s5   Convert IPython notebooks to Python scripts in editorN(   R   R8   R9   R:   Ra  (   Ry   R;   R<   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR     s
    c         C  s  t  j |  t d  t d  t j t j |   \ } } | rt j t j |  t	 |   } | | k rp d St j
 |  r t j |  t d  t d  t j |  t j |  f t j t j B t j k r d Sn  yV t j | |  t j |  r|  j j j | |  n |  j j j | |  | SWqt k
 r|} t j |  t d  t d  t j |  t	 |  f  qXn  d S(   s   Rename filet   Renames	   New name:NsQ   Do you really want to rename <b>%s</b> and overwrite the existing file <b>%s</b>?sB   <b>Unable to rename file <i>%s</i></b><br><br>Error message:<br>%s(   R   R   R   R   R   R>   RK   RG   R3   R   RY  R   RO  RK  RM  R!   t   rename_fileR   R   t   renamedR   t   renamed_treeRI   RJ   (   Ry   R<   R2   R   RN   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyRc    s.    !		c         C  s)   | d k r |  j   } n  t |  d S(   s#   Show file in external file explorerN(   R   R   R=   (   Ry   R;   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR=     s    c         C  s^   | d k r |  j   } n  t | t t f  s< | g } n  x | D] } |  j |  qC Wd S(   s   Rename filesN(   R   R   R8   R9   R:   Rc  (   Ry   R;   R<   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR     s    c         C  sF  | d k r |  j   } n  t t j | d   } x t r |  j j j t	  | d k rw t
 |  t d  |  } n | } |  j j j t  | r t |  } | | k r Pq q7 d Sq7 Wx | D]z } t j |  } y  t j | t j | |   Wq t k
 r=} t j |  t d  t d  | t |  f  q Xq Wd S(   s   Move files/directoriesi    s   Select directoryNt   Errors;   <b>Unable to move <i>%s</i></b><br><br>Error message:<br>%s(   R   R   RD   R>   R3   Ra   R   t   redirect_stdioR   Rd   R   R   RK   R!   t	   move_fileRG   RI   R   RJ   R   (   Ry   R;   t	   directoryt   origt   folderR<   RK   RN   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR     s.    	 	c      
   C  sd  | d k r d } n  t j |  r6 t j |  } n  t j |  | | t j d  \ } } | r`t j | t	 |   } zT y t
 j |  Wn< t k
 r } t j |  | t d  | t	 |  f  n XWd | r\t j | d  }	 y3 t |	 d   }
 |
 j t d   Wd QX| SWq\t k
 rX} t j |  | t d  |	 t	 |  f  q\Xn  Xn  d S(   s   Create new folderRE   sD   <b>Unable to create folder <i>%s</i></b><br><br>Error message:<br>%sNs   __init__.pyt   wbt   #sB   <b>Unable to create file <i>%s</i></b><br><br>Error message:<br>%s(   R   R>   R   R3   R   R   R   R   RG   R   R1   t   mkdirRI   R   RJ   R   R+   RH   R   (   Ry   t   current_patht   titlet   subtitlet
   is_packageR4   R   R3   RN   R<   R   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   create_new_folder  s4    	 		c         C  s5   t  d   } t  d  } |  j | | | d t d S(   s
   New folders   Folder name:Rr  N(   R   Rs  Rd   (   Ry   R  Rp  Rq  (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR     s    c         C  s5   t  d   } t  d  } |  j | | | d t d S(   s   New packages   Package name:Rr  N(   R   Rs  Ra   (   Ry   R  Rp  Rq  (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR     s    c         C  s   | d k r d } n  t j |  r6 t j |  } n  |  j j j t  t |  | | |  \ } } |  j j j t	  | r y | |  | SWq t
 k
 r } t j |  t d  t d  | t |  f  q Xn  d S(   s2   Create new file
        Returns True if successfulRE   s   New filesB   <b>Unable to create file <i>%s</i></b><br><br>Error message:<br>%sN(   R   R>   R   R3   R   Rg  R   Rd   R   Ra   RI   R   RJ   R   R   (   Ry   Ro  Rp  R   t   create_funcR<   t
   _selfilterRN   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   create_new_file  s    	
	c         C  s`   t  d   } t  d  d } d   } |  j | | | |  } | d k	 r\ |  j | g  n  d S(   s   New files	   All filess    (*)c         S  sU   t  j |   d d k r& t |   n+ t |  d   } | j t d   Wd QXd S(	   s   File creation callbacki   s   .pys   .pyws   .ipyRl  RE   N(   s   .pys   .pyws   .ipy(   R>   R   RO   R+   RH   R   (   R<   R   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyRt    s    N(   R   Rv  R   R+   (   Ry   R  Rp  R   Rt  R<   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR     s    	c           sE   t  d   } t  d  d }   f d   }   j | | | |  d S(   s
   New modules   Python scriptss    (*.py *.pyw *.ipy)c           s     j  j j |   S(   N(   R   t   create_moduleR   (   R<   (   Ry   (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR   ,  RE   N(   R   Rv  (   Ry   R  Rp  R   Rt  (    (   Ry   s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR   (  s    c         C  s   d  S(   N(    (   Ry   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR.  /  s    c         C  s   y+ x$ t  |  D] } t j | |  q WWnd t j k
 r } t d  | j d j | j  f } t j	 |  t d  t d  t
 |   n Xd S(   s   VCS action (commit, browse)sM   For %s support, please install one of the<br/> following tools:<br/><br/>  %ss   , Rf  s1   <b>Unable to find external program.</b><br><br>%sN(   RX   R#   t   run_vcs_toolt   ActionToolNotFoundR   t   vcsnameRG   t   toolsR   RJ   R   (   Ry   R;   R  R2   RN   t   msg(    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR   3  s    		c         C  s"   |  j    j   |  j   j   f S(   s   Return scrollbar positions(   t   horizontalScrollBart   valuet   verticalScrollBar(   Ry   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   get_scrollbar_positionA  s    c         C  s>   | |  _  |  j d k	 r: t |  j  d k r: |  j   n  d S(   s   Set scrollbar positionsi    N(   R   R   R   R`   t   restore_scrollbar_positions(   Ry   t   position(    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   set_scrollbar_positionF  s    	$c         C  s9   |  j  \ } } |  j   j |  |  j   j |  d S(   s/   Restore scrollbar positions once tree is loadedN(   R   R}  t   setValueR  (   Ry   t   hort   ver(    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR  M  s    c         C  s   |  j    |  j S(   s   Return expanded state(   t   save_expanded_stateR   (   Ry   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   get_expanded_stateS  s    
c         C  s   | |  _  |  j   d S(   s   Set expanded stateN(   R   t   restore_expanded_state(   Ry   R   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   set_expanded_stateX  s    	c         C  sj   |  j    } | d k	 rf g  |  _ xB | j   D]1 } |  j |  r. |  j j |  j |   q. q. Wn  d S(   s   Save all items expanded stateN(   t   modelR   R   t   persistentIndexListt
   isExpandedRW   R   (   Ry   R  R   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR  ]  s    	c         C  s  t  j t |   } t  j |  s( d Sx t j |  D] } t  j t  j | |   } t  j |  r8 | |  j k r8 |  j j	 |  j j
 |   |  j d k r g  |  _ n  |  j j |  |  j |  j |  t  q8 q8 W|  j s |  j j j |  j  n  d S(   s    Restore directory expanded stateN(   R>   R@   R   RY  R1   RS   RG   RV   R   t   popR   R   R   RW   t   setExpandedR   Ra   R   R   t
   disconnectt   restore_directory_state(   Ry   R<   t   rootRK   R2   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR  h  s     	c         C  s   |  j  d k r d St j t |   } | |  j  k rJ |  j  j |  n  |  j  d k	 r t |  j   d k r |  j j j	 |  j
  |  j d k	 r t j d |  j  q n  d S(   s(   Follow directories loaded during startupNi    i2   (   R   R   R>   R@   R   t   removeR`   R   R   R  t   follow_directories_loadedR   R	   t
   singleShotR  (   Ry   R<   R2   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR  y  s    $
c         C  sW   |  j  d k	 rS t |  j  t  rS |  j j j |  j  |  j j j |  j  qS n  d S(   s    Restore all items expanded stateN(	   R   R   R8   R:   R   R   R   R  R  (   Ry   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR    s    
c         C  sA   |  j  d  } | d k	 r= |  j | j   | j   t  n  d S(   s   Filter the directories to shows   .spyprojectN(   R   R   t   setRowHiddent   rowR   Ra   (   Ry   R   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR     s    N(D   R   R   t   __doc__R   Rs   R   R   R   R   R   R   R   R   R   Rd   R   R   R   R   R   t   boolR   R   R   R  R  R  R!  R#  R(  R/  R0  R   R1  R5  R:  RA  R+   RC  R  R   RI  RX  R   Ra  R   Rc  R=   R   R   Rs  R   R   Rv  R   R   R.  R   R  R  R  R  R  R  R  R  R  R   (    (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR      s   									
					@		!			
		
					
					"					!																
t
   ProxyModelc           B  sA   e  Z d  Z d   Z d   Z e j d  Z d   Z d   Z	 RS(   s   Proxy model: filters tree viewc         C  s9   t  t |   j |  d  |  _ g  |  _ |  j t  d  S(   N(   Rr   R  Rs   R   t	   root_patht	   path_listt   setDynamicSortFilterRa   (   Ry   R   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyRs     s    		c         C  sQ   t  j t |   |  _ g  | D] } t  j t |   ^ q |  _ |  j   d S(   s#   Setup proxy model filter parametersN(   R>   R@   R   R  R  t   invalidateFilter(   Ry   R  R  t   p(    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   setup_filter  s    +c         C  s   |  j    j | |  d S(   s   Reimplement Qt methodN(   t   sourceModelt   sort(   Ry   t   columnt   order(    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR    s    c         C  s   |  j  d k r t S|  j   j | d |  } t j t |  j   j |    } |  j  j	 |  rh t Sx; |  j
 D], } | | k s | j	 | t j  rr t Sqr Wt Sd S(   s   Reimplement Qt methodi    N(   R  R   Ra   R  R   R>   R@   R   R   t
   startswithR  R1   t   sepRd   (   Ry   R  t   parent_indexR   R2   R  (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   filterAcceptsRow  s    $"c         C  sg   | t  j k rT |  j d j t j  d } | j   | k rT t j |  j |  Sn  t	 j |  | |  S(   s7   Show tooltip with full path only for the root directoryi    i(
   R   t   ToolTipRoleR  R   R>   R  R?  RG   R  R   (   Ry   R   t   rolet   root_dir(    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR?    s
    (
   R   R   R  Rs   R  R   R   R  R  R?  (    (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR    s   			t   FilteredDirViewc           B  sY   e  Z d  Z d	 d  Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d   Z RS(
   s!   Filtered file/directory tree viewc         C  s6   t  t |   j |  d  |  _ |  j   d  |  _ d  S(   N(   Rr   R  Rs   R   t
   proxymodelt   setup_proxy_modelR  (   Ry   R   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyRs     s    	
c         C  s&   t  |   |  _ |  j j |  j  d S(   s   Setup proxy modelN(   R  R  t   setSourceModelR   (   Ry   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR    s    c         C  s&   |  j  d k	 r" |  j |  j  n  d S(   s   Install proxy modelN(   R  R   R   R  (   Ry   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR     s    c         C  sB   | |  _  |  j   |  j j |  } |  j |  j j |   d S(   s   Set root pathN(   R  R   R   t   setRootPatht   setRootIndexR  t   mapFromSource(   Ry   R  R   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   set_root_path  s    	
c         C  sG   |  j  j |  } | j   rC | j   |  j  k rC |  j j |  Sd S(   s%   Return index associated with filenameN(   R   R   t   isValidR  R  R  (   Ry   R6   R   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR     s    !c         C  sW   |  j  d k	 s t  g  | D] } t j |  j  |  ^ q } |  j j |  j  |  d S(   s   Set folder namesN(   R  R   t   AssertionErrorR>   RG   R  R  (   Ry   t   folder_namesR3   R  (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   set_folder_names  s    %c         C  s;   | r7 |  j  j |  j j |   } t j t |   Sd S(   s   Return filename from indexN(   R   R   R  t   mapToSourceR>   R@   R   (   Ry   R   R2   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR     s    c         C  sB   x$ d d d g D] } |  j  |  q W|  j t  |  j   d S(   s   Setup view for projectsi   i   i   N(   t
   hideColumnt   setHeaderHiddenRa   R   (   Ry   t   i(    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   setup_project_view  s    N(   R   R   R  R   Rs   R  R   R  R   R  R   R  (    (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR    s   						t   ExplorerTreeWidgetc           B  s   e  Z d  Z e e  Z e e  Z d d d  Z d   Z	 e
 e  d    Z d   Z d   Z d e d  Z d   Z e
   d    Z e
   d	    Z e
   d
    Z d   Z d e d  Z RS(   s   File/directory explorer tree widget
    show_cd_only: Show current directory only
    (True/False: enable/disable the option
     None: enable the option and do not allow the user to disable it)c         C  s`   t  j |  |  g  |  _ d  |  _ | |  _ d  |  _ d  |  _ d  |  _ d  |  _	 |  j
 t  d  S(   N(   R   Rs   t   historyR   t	   histindext   show_cd_onlyt(   _ExplorerTreeWidget__original_root_indext    _ExplorerTreeWidget__last_folderR   R   t   setDragEnabledRa   (   Ry   R   R  (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyRs     s    							c         C  s   t  t |   j   } |  j d k r0 t |  _ nK t |  t d  d |  j } | j	 |  j  |  j |  j  | j
 |  | S(   s!   Setup context menu common actionss   Show current directory onlyR   N(   Rr   R  R   R  R   Ra   R%   R   t   toggle_show_cd_onlyR   RW   (   Ry   R  t   cd_only_action(    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR     s    c         C  sp   |  j  j j d |  | |  _ | rJ |  j d k	 rl |  j |  j  ql n" |  j d k	 rl |  j |  j  n  d S(   s'   Toggle show current directory only modeR  N(	   R   R   R   R  R  R   t   set_current_folderR  R  (   Ry   R   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR     s    	c         C  sY   |  j  j |  } | |  _ |  j rU |  j d k rE |  j   |  _ n  |  j |  n  | S(   s4   Set current folder and return associated model indexN(   R   R  R  R  R  R   t	   rootIndexR  (   Ry   Rk  R   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR  ,  s    		c         C  s   |  j  S(   N(   R  (   Ry   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   get_current_folder6  s    c         C  s   | d k r t   } n  | rJ |  j |  } |  j |  |  j |  n  |  j j |  j d k	 on |  j d k  |  j j |  j d k	 o |  j t	 |  j
  d k   |  j   d S(   sP   Refresh widget
        force=False: won't refresh widget if path has not changedi    i   N(   R   R(   R  t   expandt   setCurrentIndext   set_previous_enabledR   R  t   set_next_enabledR`   R  R   (   Ry   t   new_patht   force_currentR   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   refresh9  s    	c         C  s   |  j  d |  d S(   s   Directory was just clickedRi  N(   t   chdir(   Ry   R3   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR1  J  s    c         C  s,   |  j  t j t j t   t j    d S(   s   Go to parent directoryN(   R  R>   RA   RG   R(   R1   RR   (   Ry   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR.  O  s    c         C  s#   |  j  d 8_  |  j d t  d S(   s   Back to previous directoryi   t   browsing_historyN(   R  R  Ra   (   Ry   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   go_to_previous_directoryT  s    c         C  s#   |  j  d 7_  |  j d t  d S(   s   Return to next directoryi   R  N(   R  R  Ra   (   Ry   (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   go_to_next_directoryZ  s    c         C  sw   y@ t  j t |   } | |  j k r? |  j j |  |  _ n  Wn0 t k
 rr t   } |  j d | d t	  n Xd S(   s   Update browse historyRi  R  N(
   R>   RA   R   R  R   R  R]  R   R  Ra   (   Ry   Ri  t   user_directory(    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   update_history`  s    	c         C  s  | d	 k	 r$ t j t |   } n  | r= |  j |  j } n | |  j k rd |  j j |  |  _ n |  j d	 k r g  |  _ n |  j |  j d  |  _ t |  j  d k s |  j r |  j d | k r |  j j |  n  t |  j  d |  _ t |  } y | | Wn5 t	 k
 r?t
 } t j d k r6t } q@t } n Xy: t j |  |  j j j |  |  j d | d t  WnP | k
 rt j |  j d t d   n$ | k
 r|  j j |  j  n Xd	 S(
   s"   Set directory as working directoryi   i    iR,   R  R  Rf  s;   You don't have the right permissions to open this directoryN(   R   R>   RA   R   R  R  R   R`   RW   t	   NameErrorRc   R1   R4   t   WindowsErrorRb   R  R   t   open_dirR   R  Ra   R   RJ   R   R  (   Ry   Ri  R  t   PermissionErrort   FileNotFoundError(    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR  j  s>    	
N(   R   R   R  R   R  R  R  R   Rs   R   R   R  R  R  Rd   R  R1  R.  R  R  R  R  (    (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR    s   		
			
t   ExplorerWidgetc           B  s   e  Z d  Z e e e  Z e e  Z e e  Z e e	  Z
 e e  Z d d d g e d e d  Z e e	  d    Z RS(   s   Explorer widgets   *.pys   *.pywc         C  s  t  j |  |  t |  d | |  _ t |   } t |   } t |   } t |   |  _ t |   }	 | | | |  j g |  _ t |  t	 d  d |  j
 }
 t |  d t	 d  d t j d  d |  j j } t |  d t	 d	  d t j d
  d |  j j } t |  d t	 d  d t j d  d |  j j } t |  d d d t	 d  } |  j j d | d |  |  j j t    |  j j d  |
 g 7_ | j |  | j t  | j |  | j t  | j |  |  j j t j d   |  j j t j  |  j j |	  t |	 |  j j  | j |	  |  j
 |  |
 j |  x4 |  j D]) } | j t  | j  t! d d   qVWt"   } | j# |  | j# |  | j# |  | j$   | j# |  j  t% | |  j  } |  j& |  |  j j' j( | j  |  j j) j( | j  d  S(   NR  s   Show icons and textR   RM   t   PreviousR   t	   ArrowBackR   t   Nextt   ArrowForwardt   Parentt   ArrowUpRE   t   tipt   OptionsR   R[   t   tooloptionsi   (*   R   Rs   R  t
   treewidgetR   t   button_menuR   t   action_widgetsR%   R   t   toggle_icontextR   R   R  R  R.  R   R  R(   R   R   t   setDefaultActiont
   setEnabledRd   t   setIcont   setPopupModet   InstantPopupt   setMenuR$   R   t   setAutoRaiseRa   t   setIconSizeR   R   t	   addWidgett
   addStretchR'   t	   setLayoutR  R   R  (   Ry   R   R   R[   R  t   show_icontextt   button_previoust   button_nextt   button_parentR   t   icontext_actiont   previous_actiont   next_actiont   parent_actiont   options_actiont   widgett   blayoutt   layout(    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyRs     sd    		

c         C  sf   |  j  j d |  xL |  j D]A } | |  j k	 r | rK | j t j  q^ | j t j  q q Wd S(   s   Toggle icon textR  N(   R   R   R  R  t   setToolButtonStyleR   t   ToolButtonTextBesideIcont   ToolButtonIconOnly(   Ry   R   R  (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR    s    N(   R   R   R  R   RL   t   objectR   RB  R^  R  Rg  R  R   Rd   Ra   Rs   R   R  (    (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR    s   Ft   FileExplorerTestc           B  s   e  Z d    Z RS(   c           s  t  j    t   }   j |  t   d d    _ | j   j  t   } | j	 |  t
 d  } | j t j  | j |  t
     _ | j   j    j j j   j j  t   } | j	 |  t
 d  } | j t j  | j |  t
     _ | j   j    j j j   j j  t   } | j	 |  t
 d  } | j t j  | j |  t
     _ | j   j    j j j   f d      j j j   f d    d  S(   NR  s   <b>Open file:</b>s   <b>Open dir:</b>s   <b>Option changed:</b>c           s     j  j d |  | f  S(   Ns   option_changed: %r, %r(   t   label3t   setText(   Ri   t   y(   Ry   (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR     RE   c             s     j  j j d  S(   Ns   ..(   t   explorerR  R  (    (   Ry   (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR     RE   (   R   Rs   R   R  R  R   R  R  R   t	   addLayoutR   t   setAlignmentR   t
   AlignRightt   label1RB  R   R  t   label2R  R  R   (   Ry   t   vlayoutt   hlayout1t   labelt   hlayout2t   hlayout3(    (   Ry   s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyRs     s@    				(   R   R   Rs   (    (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR    s   t   ProjectExplorerTestc           B  s   e  Z d d   Z RS(   c         C  s   t  j |  |  t   } |  j |  t |   |  _ |  j j   |  j j t j	 t j
 t    |  j j d g  |  j j   | j |  j  d  S(   Nt   variableexplorer(   R   Rs   R   R  R  R  R   R  R>   R3   RA   t   __file__R  R  R  (   Ry   R   R  (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyRs     s    	"N(   R   R   R   Rs   (    (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR    s   c         C  s\   d d l  m } |   } |  r+ t   } n	 t   } | j d d  | j   | j   d  S(   Ni(   t   qapplicationi  i  (   t   spyder.utils.qthelpersR  R  R  t   resizet   showR=  (   t   file_explorerR  t   appt   test(    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyR  $  s    		
t   __main__R  (U   R  t
   __future__R    R1   t   os.pathR2   R>   RT   RG  R/   R-   t	   mimetypesR   t   qtpy.compatR   R   t   qtpy.QtCoreR   R   R   R   R   R   R	   R
   R   R   t
   qtpy.QtGuiR   t   qtpy.QtWidgetsR   R   R   R   R   R   R   R   R   R   R   R   t   spyder.config.baseR   R   t   spyder.py3compatR   R   R   t   spyder.utilsR   R   R    R!   R"   R#   R  R$   R%   R&   R'   t   spyder.utils.miscR(   t	   nbconvertR)   R   R   R7   R=   RD   RO   Rd   RS   Re   Rf   R   R  R  R  R  R  R  R  R   Ra   (    (    (    s6   lib/python2.7/site-packages/spyder/widgets/explorer.pyt   <module>   sV   FR""
	
				
E  *5^'	