
    G@d                          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dS )zOutline explorer main widget.    )QtSignalSlot)QHBoxLayout)PluginMainWidget_)OutlineExplorerTreeWidgetc                       e Zd ZdZdS )OutlineExplorerToolbuttonsgo_to_cursorN)__name__
__module____qualname__
GoToCursor     Jlib/python3.11/site-packages/spyder/plugins/outlineexplorer/main_widget.pyr   r      s        JJJr   r   c                       e Zd ZdZdZdS )OutlineExplorerSectionsmain_sectiondisplay_optionsN)r   r   r   MainDisplayOptionsr   r   r   r   r      s        D&NNNr   r   c                   .    e Zd ZdZdZdZdZdZdZdZ	dZ
d	S )
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      s8        J"L#L)'N*"L+IIIr   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_explorerNc                 0   ||| _         t                                          |||           t          |           | _        | j        j                            | j                   | j        j                            | j	                   | j        j
                            | j
                   | j                                                                         t                      }|                    | j                   |                     |           d S 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9+33D4FGGG(001BCCC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                 J   |                                  }|                     t          j        |                     d          t          d          | j        j                  }|| j        j        | j        j	        | j        j
        | j        j        | j        j        fD ]$}|                     ||t          j                   %|                     t"          j        t          d          |                     d          | j        j                  }|                     t"          j        t          d          dd	          }|                     t"          j        t          d
          dd	          }|                     t"          j        t          d          dd	          }|                     t"          j        t          d          dd	          }|                     t"          j        t          d          dd	          }	|                     t"          j        t          d          dd	          }
|                     t"          j        t          d          dd	          }||||	|
|||g}|                                 }|D ]$}|                     ||t          j                   %dS )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!!,//)**o;	 0 = = $_8_6_3_>_<> 	K 	KD $$T7-D-I % K K K K ++"-*++!!,//o;	 , = = ))"/'(("	 * $ $ ))"/#$$#	 * % % (("6*++"	 ) $ $ ,,"1%&& 	 - " " !% 2 2"3566&	 !3 !
 !
 !.."/+,,"	 / 
 
 )-(:(:",.//.	 ); )
 )
%  (*;[0.B ++-- 	 	F!!/> "    	 	r   c                     d S r/   r   rF   s    r   update_actionsz$OutlineExplorerWidget.update_actions   s    r   c                     t                                          ||           | j        |                     d           dS |                     | j                   dS )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66( ''-----''88888r   c                     t                                                       | j        j                            | j                   dS )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   sI    
 	2::.	0 	0 	0 	0 	0r   c                 r    |r|                      |           || j                            ||           d S d S r/   )remove_editorr3   set_current_editor)r>   editorupdateclears       r   r   z(OutlineExplorerWidget.set_current_editor   sJ     	'v&&&O..vv>>>>> r   c                 :    | j                             |           d S r/   )r3   r   r>   r   s     r   r   z#OutlineExplorerWidget.remove_editor   s    %%f-----r   c                 :    | j                             |           d S r/   )r3   register_editorr   s     r   r   z%OutlineExplorerWidget.register_editor   s    ''/////r   c                 <    | j                             ||           d S r/   )r3   file_renamed)r>   r   new_filenames      r   r   z"OutlineExplorerWidget.file_renamed   s     $$V\:::::r   c                 :    | j                             |           dS )z!Enable LSP symbols functionality.N)r3   start_symbol_servicesr>   languages     r   r   z+OutlineExplorerWidget.start_symbol_services   s    --h77777r   c                 :    | j                             |           dS )z"Disable LSP symbols functionality.N)r3   stop_symbol_servicesr   s     r   r   z*OutlineExplorerWidget.stop_symbol_services   s    ,,X66666r   c                 8    | j                                          dS )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                             |           dS )zChange treewidget's visibility.N)r3   rt   )r>   rw   s     r   rv   z,OutlineExplorerWidget.change_tree_visibility   s    ))*55555r   c                 ~    |t           j        k    r|                     d           dS |                     d           dS )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   sH     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6#;;DJ%vxxN%L     (    Q Q Qf  9 9 9 9 9 90 0 0 0 0? ? ?. . .0 0 0; ; ;8 8 87 7 7- - -* * *6 6 6 
T&\\
. 
. \
. 
. 
. 
. 
.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      s*   $ # ( ( ( ( ( ( ( ( ( ( & & & & & & ; ; ; ; ; ; % % % % % % L L L L L L
               ' ' ' ' ' ' ' '
, , , , , , , ,E. E. E. E. E., E. E. E. E. E.r   