
    Je                          d Z ddl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
      Z G d d      Z G d de      Zy)zOutline explorer main widget.    )QtSignalSlot)QHBoxLayout)PluginMainWidget_)OutlineExplorerTreeWidgetc                       e Zd ZdZy)OutlineExplorerToolbuttonsgo_to_cursorN)__name__
__module____qualname__
GoToCursor     L/usr/lib/python3/dist-packages/spyder/plugins/outlineexplorer/main_widget.pyr   r      s    Jr   r   c                       e Zd ZdZdZy)OutlineExplorerSectionsmain_sectiondisplay_optionsN)r   r   r   MainDisplayOptionsr   r   r   r   r      s    D&Nr   r   c                   ,    e Zd ZdZdZdZdZdZdZdZ	dZ
y	)
OutlineExplorerActionsr   show_fullpathshow_all_filesshow_commentsgroup_code_cellsdisplay_variablesfollow_cursorsort_files_alphabeticallyN)r   r   r   r   ShowFullPathShowAllFilesShowSpecialCommentsGroupCodeCellsDisplayVariablesFollowCursor	SortFilesr   r   r   r   r      s,    J"L#L)'N*"L+Ir   r   c                        e Zd ZdZ eeee      Z ee      Z e       Z	 e       Z
dZdZd fd	Zd Zd Zd Zd Zd fd		Z fd
Zd Zd Zd Zd Zd Zd Zd Zd Zd Z ee      d        Z xZ S )OutlineExplorerWidgetzClass browserToutline_explorerc                 0   ||| _         t        | 	  |||       t        |       | _        | j                  j
                  j                  | j                         | j                  j                  j                  | j                         | j                  j                  j                  | j                         | j                  j                         j                          t               }|j                  | j                         | j                  |       y N)CONTEXT_NAMEsuper__init__r
   
treewidgetsig_display_spinnerconnectstart_spinnersig_hide_spinnerstop_spinnersig_update_configurationheaderhider   	addWidget	setLayout)selfnamepluginparentcontextlayout	__class__s         r   r2   zOutlineExplorerWidget.__init__3   s     'Dvv.3D9++33D4F4FG((001B1BC0088))	+ 	 %%')vr   c                     | j                   S )zDefine the widget to focus.)r3   r>   s    r   get_focus_widgetz&OutlineExplorerWidget.get_focus_widgetG   s    r   c                     t        d      S )z#Return the title of the plugin tab.Outliner   rF   s    r   	get_titlezOutlineExplorerWidget.get_titleK   s    |r   c                 t   | j                         }| j                  t        j                  | j	                  d      t        d      | j                  j                        }|| j                  j                  | j                  j                  | j                  j                  | j                  j                  | j                  j                  fD ]$  }| j                  ||t        j                         & | j!                  t"        j                  t        d      | j	                  d      | j                  j                        }| j!                  t"        j$                  t        d      dd	      }| j!                  t"        j&                  t        d
      dd	      }| j!                  t"        j(                  t        d      dd	      }| j!                  t"        j*                  t        d      dd	      }| j!                  t"        j,                  t        d      dd	      }	| j!                  t"        j.                  t        d      dd	      }
| j!                  t"        j0                  t        d      dd	      }||||	|
|||g}| j3                         }|D ]$  }| j5                  ||t        j6                         & y)z0Performs the setup of plugin's menu and actions.
fromcursorzGo to cursor position)icontip	triggered)toolbarsection)textrM   rO   zShow absolute pathTr   )rR   toggledoptionzShow all filesr   zShow special commentsr   zGroup code cellsgroup_cellsz Display variables and attributesr!   zFollow cursor positionr"   zSort files alphabeticallyr#   )rQ   N)get_main_toolbarcreate_toolbuttonr   r   create_iconr	   r3   go_to_cursor_positioncollapse_all_actionexpand_all_actionrestore_actioncollapse_selection_actionexpand_selection_actionadd_item_to_toolbarr   r   create_actionr   r$   r%   r&   r'   r(   r)   r*   get_options_menuadd_item_to_menur   )r>   rP   fromcursor_btnitemfromcursor_actfullpath_actallfiles_actcomment_actgroup_cells_actdisplay_variables_actfollow_cursor_actsort_files_alphabetically_actactionsoption_menuactions                  r   setupzOutlineExplorerWidget.setupO   s    '')//&11!!,/)*oo;;	 0 = $__88__66__33__>>__<<> 	KD $$T7-D-I-I % K	K ++"--*+!!,/oo;;	 , = ))"//'("	 * $ ))"//#$#	 * % (("66*+"	 ) $ ,,"11%& 	 - " !% 2 2"3356&	 !3 !
 !.."//+,"	 / 
 )-(:(:",,./.	 ); )
%  (*;[0.B ++- 	F!!/>> " 	r   c                      y r/   r   rF   s    r   update_actionsz$OutlineExplorerWidget.update_actions   s    r   c                     t         |   ||       | j                  | j                  d       y| j                  | j                         y)z>Reimplemented to tell treewidget what the visibility state is.NT)r1   change_visibilitywindowwidgetchange_tree_visibility
is_visible)r>   enableforce_focusrD   s      r   rt   z'OutlineExplorerWidget.change_visibility   s@    !&+6( ''-''8r   c                     t         |           | j                  j                  j	                  | j
                         y)zi
        Reimplemented to tell treewidget what the visibility of the undocked
        plugin is.
        N)r1   create_windowru   sig_window_state_changedr5   _handle_undocked_window_state)r>   rD   s    r   r{   z#OutlineExplorerWidget.create_window   s3    
 	22::..	0r   c                 h    |r| j                  |       || j                  j                  ||       y y r/   )remove_editorr3   set_current_editor)r>   editorupdateclears       r   r   z(OutlineExplorerWidget.set_current_editor   s2    v&OO..vv> r   c                 :    | j                   j                  |       y r/   )r3   r   r>   r   s     r   r   z#OutlineExplorerWidget.remove_editor   s    %%f-r   c                 :    | j                   j                  |       y r/   )r3   register_editorr   s     r   r   z%OutlineExplorerWidget.register_editor   s    ''/r   c                 <    | j                   j                  ||       y r/   )r3   file_renamed)r>   r   new_filenames      r   r   z"OutlineExplorerWidget.file_renamed   s    $$V\:r   c                 :    | j                   j                  |       y)z!Enable LSP symbols functionality.N)r3   start_symbol_servicesr>   languages     r   r   z+OutlineExplorerWidget.start_symbol_services   s    --h7r   c                 :    | j                   j                  |       y)z"Disable LSP symbols functionality.N)r3   stop_symbol_servicesr   s     r   r   z*OutlineExplorerWidget.stop_symbol_services   s    ,,X6r   c                 8    | j                   j                          y)z1Update all editors with an associated LSP server.N)r3   update_all_editorsrF   s    r   r   z(OutlineExplorerWidget.update_all_editors   s    **,r   c                 .    | j                   j                  S )z'List of languages with symbols support.)r3   
_languagesrF   s    r   get_supported_languagesz-OutlineExplorerWidget.get_supported_languages   s    )))r   c                 :    | j                   j                  |       y)zChange treewidget's visibility.N)r3   rt   )r>   rw   s     r   rv   z,OutlineExplorerWidget.change_tree_visibility   s    ))*5r   c                 p    |t         j                  k(  r| j                  d       y| j                  d       y)zp
        Change treewidget visibility when the plugin is undocked and its
        window state changes.
        FTN)r   WindowMinimizedrv   )r>   window_states     r   r}   z3OutlineExplorerWidget._handle_undocked_window_state   s0     2--- ''.''-r   )NNr/   )!r   r   r   __doc__r   strint	edit_gotoeditrw   r9   ENABLE_SPINNERCONF_SECTIONr2   rG   rJ   rp   rr   rt   r{   r   r   r   r   r   r   r   r   rv   r   objectr}   __classcell__)rD   s   @r   r,   r,   )   s    sC%I#;DJ%xN%L(Qf90?.0;87-*6 
&\
. 
.r   r,   N)r   qtpy.QtCorer   r   r   qtpy.QtWidgetsr   spyder.api.widgets.main_widgetr   spyder.api.translationsr	   &spyder.plugins.outlineexplorer.widgetsr
   r   r   r   r,   r   r   r   <module>r      sI    $ ( ( & ; % L
   ' '
, ,E., E.r   