
    G@d                         d Z ddlmZ ddlmZmZ ddl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
e          ZdS )z
Console History Plugin.
    )Signal)PluginsSpyderDockablePlugin)on_plugin_availableon_plugin_teardown_)get_conf_path)HistoryConfigPage)HistoryWidgetc                        e Zd ZdZdZej        ej        gZej	        gZ
ej	        ZeZeZeZdZ e            Z	 d fd	Zed             Zd Zd Zd	 Z eej        
          d             Z eej        
          d             Z eej	        
          d             Z eej        
          d             Z eej        
          d             Z  eej	        
          d             Z!d Z"d Z#d Z$d Z% xZ&S )
HistoryLogz
    History log plugin.
    
historylogFNc                     t                                          ||           |                     t          d                     dS )zInitialization.z
history.pyN)super__init__add_historyr
   )selfparentconfiguration	__class__s      =lib/python3.11/site-packages/spyder/plugins/history/plugin.pyr   zHistoryLog.__init__.   s?    ///|4455555    c                       t          d          S )NHistoryr    r   r   get_namezHistoryLog.get_name5   s    ||r   c                      t          d          S )Nz,Provide command history for IPython Consolesr   r   s    r   get_descriptionzHistoryLog.get_description9   s    ?@@@r   c                 ,    |                      d          S )Nhistory)create_iconr   s    r   get_iconzHistoryLog.get_icon<   s    	***r   c                 l    |                                  }|j                            | j                   d S N)
get_widgetsig_focus_changedconnect)r   widgets     r   on_initializezHistoryLog.on_initialize?   s1    "" (()?@@@@@r   )pluginc                 n    |                      t          j                  }|                    |            d S r&   )
get_pluginr   Preferencesregister_plugin_preferencesr   preferencess     r   on_preferences_availablez#HistoryLog.on_preferences_availableC   s0    oog&9:://55555r   c                     |                      t          j                  }|j                            | j                   d S r&   )r.   r   Consolesig_refreshedr)   refreshr   consoles     r   on_console_availablezHistoryLog.on_console_availableH   s4    //'/22%%dl33333r   c                     |                      t          j                  }|j                            | j                   d S r&   )r.   r   IPythonConsolesig_append_to_history_requestedr)   append_to_historyr   
ipyconsoles     r   on_ipyconsole_availablez"HistoryLog.on_ipyconsole_availableM   sA    __W%;<<
2::"	$ 	$ 	$ 	$ 	$r   c                 n    |                      t          j                  }|                    |            d S r&   )r.   r   r/   deregister_plugin_preferencesr1   s     r   on_preferences_teardownz"HistoryLog.on_preferences_teardownS   s0    oog&9::11$77777r   c                     |                      t          j                  }|j                            | j                   d S r&   )r.   r   r5   r6   
disconnectr7   r8   s     r   on_console_teardownzHistoryLog.on_console_teardownX   s4    //'/22((66666r   c                     |                      t          j                  }|j                            | j                   d S r&   )r.   r   r<   r=   rF   r>   r?   s     r   on_ipyconsole_teardownz!HistoryLog.on_ipyconsole_teardown]   sA    __W%;<<
2=="	$ 	$ 	$ 	$ 	$r   c                     |                                  }|                                 }|                                                     ||           d S r&   )get_color_schemeget_fontr'   update_font)r   color_schemefonts      r   rM   zHistoryLog.update_fontc   sF    ,,..}}%%dL99999r   c                 R    |                                                                   dS )z&
        Refresh main widget.
        N)r'   r7   r   s    r   r7   zHistoryLog.refreshj   s&     	!!#####r   c                 T    |                                                      |           dS )z}
        Create history file.

        Parameters
        ----------
        filename: str
            History file.
        N)r'   r   )r   filenames     r   r   zHistoryLog.add_historyp   s(     	%%h/////r   c                 V    |                                                      ||           dS )z
        Append command to history file.

        Parameters
        ----------
        filename: str
            History file.
        command: str
            Command to append to history file.
        N)r'   r>   )r   rR   commands      r   r>   zHistoryLog.append_to_history{   s*     	++Hg>>>>>r   )NN)'__name__
__module____qualname____doc__NAMEr   r/   r5   REQUIRESr<   OPTIONALTABIFYr   WIDGET_CLASSCONF_SECTIONr   CONF_WIDGET_CLASS	CONF_FILEr   r(   r   staticmethodr   r    r$   r+   r   r3   r:   rA   r   rD   rG   rI   rM   r7   r   r>   __classcell__)r   s   @r   r   r      s.         D#W_5H&'H#F LL)I 
6 6 6 6 6 6   \A A A+ + +A A A  34446 6 546 0004 4 104  6777$ $ 87$
 w23338 8 438 w///7 7 0/7 w5666$ $ 76$
: : :$ $ $	0 	0 	0? ? ? ? ? ? ?r   r   N)rX   qtpy.QtCorer   spyder.api.pluginsr   r   )spyder.api.plugin_registration.decoratorsr   r   spyder.api.translationsr	   spyder.config.baser
   spyder.plugins.history.confpager   spyder.plugins.history.widgetsr   r   r   r   r   <module>rj      s    
       = < < < < < < <- - - - - - - - % % % % % % , , , , , , = = = = = = 8 8 8 8 8 8n? n? n? n? n?% n? n? n? n? n?r   