ó
‹²,]c           @   sƒ   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 d e e f d	 „  ƒ  YZ d
 S(   sä   Outline Explorer Plugin

Data for outline are provided by method .get_outlineexplorer_data() of
highlighter of assigned editor. For example, for Python files code editor uses
highlighter spyder.utils.syntaxhighlighters.PythonSH
iÿÿÿÿ(   t   Signal(   t   _(   t   SpyderPluginMixin(   t   is_text_string(   t   icon_manager(   t   OutlineExplorerWidgett   OutlineExplorerc           B   s   e  Z d  Z e e e ƒ Z d 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 RS(   t   outline_explorerc      
   C   s   |  j  d ƒ } |  j  d ƒ } |  j  d ƒ } t j |  d | d | d | d | ƒt j |  | ƒ |  j ƒ  |  j j ƒ  j ƒ  |  j ƒ  d  S(   Nt   show_fullpatht   show_all_filest   show_commentst   parent(	   t
   get_optionR   t   __init__R   t   initialize_plugint
   treewidgett   headert   hidet   load_config(   t   selfR   R   R	   R
   (    (    s=   lib/python2.7/site-packages/spyder/plugins/outlineexplorer.pyR      s    
c         C   s
   t  d ƒ S(   s   Return widget titlet   Outline(   R   (   R   (    (    s=   lib/python2.7/site-packages/spyder/plugins/outlineexplorer.pyt   get_plugin_title.   s    c         C   s   t  j d ƒ S(   s   Return widget iconR   (   t   imat   icon(   R   (    (    s=   lib/python2.7/site-packages/spyder/plugins/outlineexplorer.pyt   get_plugin_icon2   s    c         C   s   |  j  S(   sq   
        Return the widget to give focus to when
        this plugin's dockwidget is raised on top-level
        (   R   (   R   (    (    s=   lib/python2.7/site-packages/spyder/plugins/outlineexplorer.pyt   get_focus_widget6   s    c         C   s   g  S(   s*   Return a list of actions related to plugin(    (   R   (    (    s=   lib/python2.7/site-packages/spyder/plugins/outlineexplorer.pyt   get_plugin_actions=   s    c         C   s*   |  j  j j |  j ƒ |  j  j |  ƒ d S(   s'   Register plugin in Spyder's main windowN(   t   maint   restore_scrollbar_positiont   connectt   add_dockwidget(   R   (    (    s=   lib/python2.7/site-packages/spyder/plugins/outlineexplorer.pyt   register_pluginA   s    
c         C   s   d S(   s   Refresh project explorer widgetN(    (   R   (    (    s=   lib/python2.7/site-packages/spyder/plugins/outlineexplorer.pyt   refresh_pluginG   s    c         C   s   |  j  ƒ  t S(   s3   Perform actions before parent main window is closed(   t   save_configt   True(   R   t
   cancelable(    (    s=   lib/python2.7/site-packages/spyder/plugins/outlineexplorer.pyt   closing_pluginK   s    
c         C   s*   t  j |  | ƒ | r& |  j j ƒ  n  d S(   s!   DockWidget visibility has changedN(   R   t   visibility_changedt   outlineexplorer_is_visiblet   emit(   R   t   enable(    (    s=   lib/python2.7/site-packages/spyder/plugins/outlineexplorer.pyR%   Q   s    c         C   s5   |  j  d d ƒ } | d k	 r1 |  j j | ƒ n  d S(   s9   Restoring scrollbar position after main window is visiblet   scrollbar_positionN(   R   t   NoneR   t   set_scrollbar_position(   R   t   scrollbar_pos(    (    s=   lib/python2.7/site-packages/spyder/plugins/outlineexplorer.pyR   X   s    c         C   so   x6 t  |  j ƒ  j ƒ  ƒ D] \ } } |  j | | ƒ q W|  j d |  j j ƒ  ƒ |  j d |  j j ƒ  ƒ d S(   s%   Save configuration: tree widget statet   expanded_stateR)   N(   t   listt   get_optionst   itemst
   set_optionR   t   get_expanded_statet   get_scrollbar_position(   R   t   optiont   value(    (    s=   lib/python2.7/site-packages/spyder/plugins/outlineexplorer.pyR!   ^   s
    %	c         C   sJ   |  j  d d ƒ } t | ƒ r' d } n  | d k	 rF |  j j | ƒ n  d S(   s%   Load configuration: tree widget stateR-   N(   R   R*   R   R   t   set_expanded_state(   R   R-   (    (    s=   lib/python2.7/site-packages/spyder/plugins/outlineexplorer.pyR   f   s
    	N(   t   __name__t
   __module__t   CONF_SECTIONR    t   strt   objectt   sig_option_changedR*   R   R   R   R   R   R   R    t   FalseR$   R%   R   R!   R   (    (    (    s=   lib/python2.7/site-packages/spyder/plugins/outlineexplorer.pyR      s   									N(   t   __doc__t   qtpy.QtCoreR    t   spyder.config.baseR   t   spyder.pluginsR   t   spyder.py3compatR   t   spyder.utilsR   R   t   spyder.widgets.editortoolsR   R   (    (    (    s=   lib/python2.7/site-packages/spyder/plugins/outlineexplorer.pyt   <module>   s   