
    JeG                         d Z ddlmZ ddl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 ddlmZ ddlmZ  G d	 d
      Z G d de      Z G d de      Zd Zedk(  r e        yy)Project Explorer    N)QtSignal)QHBoxLayoutQLabelQVBoxLayoutQWidget)PluginMainWidget_)DirViewActions)ProjectExplorerTreeWidgetc                       e Zd ZdZy)"ProjectExplorerOptionsMenuSectionsmainN)__name__
__module____qualname__Main     M/usr/lib/python3/dist-packages/spyder/plugins/projects/widgets/main_widget.pyr   r      s    Dr   r   c                   Z     e Zd ZdZ ee      Z	 d	 fd	Zd Zd Z	d Z
d Zd Zd Z xZS )
ProjectExplorerWidgetr   c                    t         |   |||       | j                  d      | _        | j                  d      | _        t        | | j                        | _        | j                  j                          | j                  j                          | j                  j                          | j                  j                  j                  | j                         t        |       | _        t               }|j                  | j                         |j                  | j                         | j                  |       | j!                  d       y )N)pluginparentname_filtersshow_hscrollbar   )super__init__get_confr   r   r   
treewidgetsetup
setup_viewhidesig_open_file_requestedconnectemptywidgetr   	addWidget	setLayoutsetMinimumWidth)selfnamer   r   layout	__class__s        r   r"   zProjectExplorerWidget.__init__+   s    fV< MM.9#}}->?3D$:N:NO""$//77((	* 5T:))*)vS!r   c                     | j                         }| j                  t        j                        }| j                  t        j                        }||fD ]$  }| j                  ||t        j                         & y)zSetup the widget.)menusectionN)get_options_menu
get_actionr   ToggleHiddenFilesToggleSingleClickadd_item_to_menur   r   )r.   r3   hidden_actionsingle_click_actionactions        r   r%   zProjectExplorerWidget.setup?   ss    $$&(H(HI"oon.N.NO$&9: 	AF!!:?? " A	Ar   c                      y Nr   r.   s    r   update_actionsz$ProjectExplorerWidget.update_actionsL   s    r   c                     t        d      S )NProjectr   r?   s    r   	get_titlezProjectExplorerWidget.get_titleO   s    |r   c                    |]| j                   j                  t        j                  |             | j                   j	                  t        j
                  |      g       | j                   j                          | j                   j                  |      }|6| j                   j                  | j                   j                  |      d       yy)zSet the project directoryNT)	r$   set_root_pathospdirnameset_folder_namesbasenamesetup_project_view	get_indexsetExpanded)r.   	directoryindexs      r   set_project_dirz%ProjectExplorerWidget.set_project_dirR   s     OO))#++i*@AOO,,cll9.E-FG**,)))4OO''(A(A)(L(,. r   c                 l    | j                   j                          | j                  j                          y)zShow an empty viewN)r$   r'   r*   showr?   s    r   clearzProjectExplorerWidget.clear^   s$    r   c                     | j                   j                          | j                  j                          | j	                  |       y)zSetup projectN)r*   r'   r$   rQ   rO   )r.   rM   s     r   setup_projectz#ProjectExplorerWidget.setup_projectc   s4     	Y'r   r>   )r   r   r   __doc__r   strr(   r"   r%   r@   rC   rO   rR   rT   __classcell__)r1   s   @r   r   r      s9    $Sk"(A
. 
(r   r   c                       e Zd ZddZy)ProjectExplorerTestNc                    t        j                  |        d| _        t               }| j	                  |       t        d | |       | _        ||| _        n1t        j                  t        j                  t                    | _        | 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                  | j0                         y )Nproject_explorerz<b>Open file:</b>z<b>Option changed:</b>)r	   r"   CONF_SECTIONr   r,   r   explorerrM   rF   rG   abspath__file__rT   r+   r   	addLayoutr   setAlignmentr   
AlignRightlabel1r(   r)   setTextlabel3)r.   rM   vlayouthlayout1labelhlayout3s         r   r"   zProjectExplorerTest.__init__p   sa   .-w-dD$? &DN [[X)>?DN##DNN3$--(=(#*+2==)5!h4;;'--55dkk6I6IJ=(#/02==)5!h4;;'r   r>   )r   r   r   r"   r   r   r   rY   rY   o   s    (r   rY   c                      ddl m}   |        }t               }|j                  dd       |j	                          |j                          y )Nr   )qapplication   i  )spyder.utils.qthelpersrk   rY   resizerQ   exec_)rk   apptests      r   rq   rq      s4    3
.C DKKSIIKIIKr   __main__)rU   os.pathpathrF   qtpy.QtCorer   r   qtpy.QtWidgetsr   r   r   r	   spyder.api.widgets.main_widgetr
   spyder.api.translationsr   spyder.plugins.explorer.apir   /spyder.plugins.projects.widgets.projectexplorerr   r   r   rY   rq   r   r   r   r   <module>r{      sj    
  # D D < % 6 K(, K(b(' (B zF r   