B
    nb\'                 @   sb   d Z ddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ ddlmZ G dd	 d	ee	ZdS )
z%Files and Directories Explorer Plugin    N)Signal)_)SpyderPluginMixin)to_text_string)ExplorerWidgetc               @   s   e Zd ZdZdZeeZeeZeeZ	eeZ
eeeZeeeZeeZeeZeeZdddZdd Zdd	 Zd
d Zdd ZdddZdddZdd ZdS )Explorerz(File and Directories Explorer DockWidgetZexplorerNc             C   s>   t j| || d| d| dd t| | |   d S )Nname_filtersshow_allshow_icontext)parentr   r	   r
   )r   __init__Z
get_optionr   Zinitialize_plugin)selfr    r   6lib/python3.7/site-packages/spyder/plugins/explorer.pyr   *   s    zExplorer.__init__c             C   s   t dS )zReturn widget titlezFile explorer)r   )r   r   r   r   get_plugin_title5   s    zExplorer.get_plugin_titlec             C   s   | j S )zq
        Return the widget to give focus to when
        this plugin's dockwidget is raised on top-level
        )
treewidget)r   r   r   r   get_focus_widget9   s    zExplorer.get_focus_widgetc             C   s   g S )z*Return a list of actions related to pluginr   )r   r   r   r   get_plugin_actions@   s    zExplorer.get_plugin_actionsc                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 jj  j jj fdd  j
 fdd  j j j  j fdd dS )z'Register plugin in Spyder's main windowc                s    j | ddS )NT)new_pathforce_current)refresh_plugin)	directory)r   r   r   <lambda>Q   s   z*Explorer.register_plugin.<locals>.<lambda>c                s    j jj| dddS )NFT)Zrefresh_explorerZrefresh_console)mainworkingdirectorychdir)dirname)r   r   r   r   T   s    
c                s    j jj| dS )N)text)r   editornew)t)r   r   r   r   Z   s    N)r   Zadd_dockwidgeteditZconnectr   loadremovedremoved_treerenamedrenamed_treeopen_dirr   create_moduler   r   Zset_explorer_cwdZsig_open_fileZ	open_fileZsig_new_file)r   r   )r   r   register_pluginD   s    
zExplorer.register_pluginTc             C   s    | j | | j j||d dS )zRefresh explorer widget)r   N)r   Zupdate_historyZrefresh)r   r   r   r   r   r   r   \   s    zExplorer.refresh_pluginFc             C   s   dS )z3Perform actions before parent main window is closedTr   )r   Z
cancelabler   r   r   closing_plugina   s    zExplorer.closing_pluginc             C   s   | j | dS )zSet working directoryN)r   r   )r   r   r   r   r   r   f   s    zExplorer.chdir)N)NT)F)__name__
__module____qualname____doc__ZCONF_SECTIONr   strZopen_interpreterr!   r#   r$   r%   r&   r(   runr'   r   r   r   r   r)   r   r*   r   r   r   r   r   r      s&   




r   )r.   os.pathpathZospZqtpy.QtCorer   Zspyder.config.baser   Zspyder.pluginsr   Zspyder.py3compatr   Zspyder.widgets.explorerr   r   r   r   r   r   <module>   s   