ó
‹²,]c           @   s7  d  Z  d d l m Z 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 d d l m Z d d	 l m Z d d
 l m Z d Z e j d e d ƒ d e d e ƒd Z e j d e d ƒ d e d e ƒd e f d „  ƒ  YZ d e	 e f d „  ƒ  YZ d S(   s   Variable Explorer Pluginiÿÿÿÿ(   t   QTimert   Signalt   Slot(   t	   QGroupBoxt   QStackedWidgett   QVBoxLayoutt   QWidget(   t   REMOTE_SETTINGS(   t   dependencies(   t   _(   t   SpyderPluginMixin(   t   PluginConfigPage(   t   icon_manager(   t   NamespaceBrowsers   >=0.13.1t   pandass<   View and edit DataFrames and Series in the Variable Explorert   required_versiont   optionals   >=1.7t   numpysG   View and edit two and three dimensional arrays in the Variable Explorert   VariableExplorerConfigPagec           B   s   e  Z d  „  Z RS(   c         C   s†  t  t d ƒ ƒ } d t d ƒ f d t d ƒ f d t d ƒ f d t d	 ƒ f g } g  | D] \ } } |  j | | ƒ ^ q[ } t  t d
 ƒ ƒ } d t d ƒ d f g } g  | D]' \ } } } |  j | | d | ƒ^ q° }	 t ƒ  }
 x | D] } |
 j | ƒ qí W| j |
 ƒ t ƒ  } x |	 D] } | j | ƒ q!W| j | ƒ t ƒ  } | j | ƒ | j | ƒ | j d ƒ |  j | ƒ d  S(   Nt   Filtert   exclude_privates   Exclude private referencest   exclude_capitalizeds   Exclude capitalized referencest   exclude_uppercases    Exclude all-uppercase referencest   exclude_unsupporteds   Exclude unsupported data typest   Displayt   minmaxs   Show arrays min/maxt    t   tipi   (   R   R	   t   create_checkboxR   t	   addWidgett	   setLayoutt
   addStretch(   t   selft   filter_groupt   filter_datat   optiont   textt   filter_boxest   display_groupt   display_dataR   t   display_boxest   filter_layoutt   boxt   display_layoutt   vlayout(    (    s>   lib/python2.7/site-packages/spyder/plugins/variableexplorer.pyt
   setup_page$   s0    (1			(   t   __name__t
   __module__R-   (    (    (    s>   lib/python2.7/site-packages/spyder/plugins/variableexplorer.pyR   "   s   t   VariableExplorerc           B   s  e  Z d  Z d Z e Z d Z d Z e e	 e
 ƒ Z d „  Z d „  Z e e	 e
 ƒ d „  ƒ Z e ƒ  d „  ƒ Z d	 „  Z d
 „  Z d „  Z d „  Z d „  Z 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(   s"   
    Variable Explorer Plugin
    t   variable_exploreri<   iè  i´   c         C   sl   t  j |  | ƒ t j |  | ƒ t |  ƒ |  _ i  |  _ t ƒ  } | j |  j ƒ |  j | ƒ |  j	 ƒ  d  S(   N(
   R   t   __init__R
   R   t   stackt   shellwidgetsR   R   R   t   initialize_plugin(   R    t   parentt   layout(    (    s>   lib/python2.7/site-packages/spyder/plugins/variableexplorer.pyR2   O   s    		c         C   sP   i  } x! t  D] } |  j | ƒ | | <q Wd } d j |  j | ƒ ƒ | | <| S(   s  
        Retrieve all Variable Explorer configuration settings.
        
        Specifically, return the settings in CONF_SECTION with keys in 
        REMOTE_SETTINGS, and the setting 'dataframe_format'.
        
        Returns:
            dict: settings
        t   dataframe_formats   %{0}(   R   t
   get_optiont   format(   R    t   settingst   name(    (    s>   lib/python2.7/site-packages/spyder/plugins/variableexplorer.pyt   get_settings_   s    
c         C   sE   | d k r. | j  d ƒ s! t ‚ | d } n  |  j j | | ƒ d S(   sn  
        Change a config option.

        This function is called if sig_option_changed is received. If the
        option changed is the dataframe format, then the leading '%' character
        is stripped (because it can't be stored in the user config). Then,
        the signal is emitted again, so that the new value is saved in the
        user config.
        R8   t   %i   N(   t
   startswitht   AssertionErrort   sig_option_changedt   emit(   R    t   option_namet	   new_value(    (    s>   lib/python2.7/site-packages/spyder/plugins/variableexplorer.pyt   change_options   s    c            sI   ˆ  j  j ƒ  t j ˆ  j ‡  f d †  ƒ t j ˆ  j ‡  f d †  ƒ d S(   s   Free memory signal.c              s   ˆ  j  j ƒ  S(   N(   t   maint   free_memory(    (   R    (    s>   lib/python2.7/site-packages/spyder/plugins/variableexplorer.pyt   <lambda>ˆ   R   c              s   ˆ  j  j ƒ  S(   N(   RF   RG   (    (   R    (    s>   lib/python2.7/site-packages/spyder/plugins/variableexplorer.pyRH   Š   R   N(   RF   RG   R    t
   singleShott    INITIAL_FREE_MEMORY_TIME_TRIGGERt"   SECONDARY_FREE_MEMORY_TIME_TRIGGER(   R    (    (   R    s>   lib/python2.7/site-packages/spyder/plugins/variableexplorer.pyRG   ƒ   s
    c         C   s   |  j  j | ƒ d  S(   N(   R3   t   setCurrentWidget(   R    t   nsb(    (    s>   lib/python2.7/site-packages/spyder/plugins/variableexplorer.pyt   set_current_widget   s    c         C   s   |  j  j ƒ  S(   N(   R3   t   currentWidget(   R    (    (    s>   lib/python2.7/site-packages/spyder/plugins/variableexplorer.pyt   current_widget   s    c         C   s   |  j  j ƒ  S(   N(   R3   t   count(   R    (    (    s>   lib/python2.7/site-packages/spyder/plugins/variableexplorer.pyRQ   “   s    c         C   s   |  j  j | ƒ d  S(   N(   R3   t   removeWidget(   R    RM   (    (    s>   lib/python2.7/site-packages/spyder/plugins/variableexplorer.pyt   remove_widget–   s    c         C   s   |  j  j | ƒ d  S(   N(   R3   R   (   R    RM   (    (    s>   lib/python2.7/site-packages/spyder/plugins/variableexplorer.pyt
   add_widget™   s    c         C   sœ   t  | ƒ } | |  j k r˜ t |  ƒ } | j | ƒ | j |  j ƒ    | j j |  j ƒ | j	 j |  j
 ƒ |  j | ƒ | |  j | <|  j | ƒ | Sd S(   s   
        Register shell with variable explorer.

        This function opens a new NamespaceBrowser for browsing the variables
        in the shell.
        N(   t   idR4   R   t   set_shellwidgett   setupR=   RA   t   connectRE   t   sig_free_memoryRG   RT   t   set_shellwidget_from_id(   R    t   shellwidgett   shellwidget_idRM   (    (    s>   lib/python2.7/site-packages/spyder/plugins/variableexplorer.pyt   add_shellwidget   s    c         C   s?   | |  j  k r; |  j  j | ƒ } |  j | ƒ | j ƒ  n  d  S(   N(   R4   t   popRS   t   close(   R    R\   RM   (    (    s>   lib/python2.7/site-packages/spyder/plugins/variableexplorer.pyt   remove_shellwidget°   s    c         C   s0   | |  j  k r, |  j  | } |  j | ƒ n  d  S(   N(   R4   RN   (   R    R\   RM   (    (    s>   lib/python2.7/site-packages/spyder/plugins/variableexplorer.pyRZ   ¸   s    c         C   sl   |  j  ƒ  rh |  j ƒ  } | j ƒ  | j d | ƒ |  j rh |  j rh |  j j t ƒ |  j j ƒ  qh n  d S(   s    Import data in current namespacet	   filenamesN(	   RQ   RP   t   refresh_tablet   import_datat
   dockwidgett   ismaximizedt
   setVisiblet   Truet   raise_(   R    t   fnameRM   (    (    s>   lib/python2.7/site-packages/spyder/plugins/variableexplorer.pyRc   ½   s    
c         C   s
   t  d ƒ S(   s   Return widget titles   Variable explorer(   R	   (   R    (    (    s>   lib/python2.7/site-packages/spyder/plugins/variableexplorer.pyt   get_plugin_titleÈ   s    c         C   s   t  j d ƒ S(   s   Return plugin icont   dictedit(   t   imat   icon(   R    (    (    s>   lib/python2.7/site-packages/spyder/plugins/variableexplorer.pyt   get_plugin_iconÌ   s    c         C   s
   |  j  ƒ  S(   sq   
        Return the widget to give focus to when
        this plugin's dockwidget is raised on top-level
        (   RP   (   R    (    (    s>   lib/python2.7/site-packages/spyder/plugins/variableexplorer.pyt   get_focus_widgetÐ   s    c         C   s   t  S(   s3   Perform actions before parent main window is closed(   Rg   (   R    t
   cancelable(    (    s>   lib/python2.7/site-packages/spyder/plugins/variableexplorer.pyt   closing_plugin×   s    c         C   s   d S(   s   Refresh widgetN(    (   R    (    (    s>   lib/python2.7/site-packages/spyder/plugins/variableexplorer.pyt   refresh_pluginÛ   s    c         C   s   g  S(   s*   Return a list of actions related to plugin(    (   R    (    (    s>   lib/python2.7/site-packages/spyder/plugins/variableexplorer.pyt   get_plugin_actionsß   s    c         C   s   |  j  j |  ƒ d S(   s'   Register plugin in Spyder's main windowN(   RF   t   add_dockwidget(   R    (    (    s>   lib/python2.7/site-packages/spyder/plugins/variableexplorer.pyt   register_pluginã   s    c         C   s7   x0 t  |  j j ƒ  ƒ D] } | j |  j ƒ    q Wd S(   s*   Apply configuration file's plugin settingsN(   t   listR4   t   valuesRW   R=   (   R    t   optionsRM   (    (    s>   lib/python2.7/site-packages/spyder/plugins/variableexplorer.pyt   apply_plugin_settingsç   s    i`ê  i ¿ (#   R.   R/   t   __doc__t   CONF_SECTIONR   t   CONFIGWIDGET_CLASSRJ   RK   R   t   strt   objectRA   R2   R=   R   RE   RG   RN   RP   RQ   RS   RT   R]   R`   RZ   Rc   Rj   Rn   Ro   t   FalseRq   Rr   Rs   Ru   Ry   (    (    (    s>   lib/python2.7/site-packages/spyder/plugins/variableexplorer.pyR0   E   s6   		
															N(   Rz   t   qtpy.QtCoreR    R   R   t   qtpy.QtWidgetsR   R   R   R   t   spyder_kernels.utils.nsviewR   t   spyderR   t   spyder.config.baseR	   t   spyder.pluginsR
   t   spyder.plugins.configdialogR   t   spyder.utilsR   Rl   t0   spyder.widgets.variableexplorer.namespacebrowserR   t   PANDAS_REQVERt   addRg   t   NUMPY_REQVERR   R0   (    (    (    s>   lib/python2.7/site-packages/spyder/plugins/variableexplorer.pyt   <module>   s"   "#