
    G@d<                     @    d Z ddlmZmZ ddlmZ  G d d          ZdS )z3
Mixin to connect a plugin to the IPython console.
    )on_plugin_availableon_plugin_teardown)Pluginsc                       e Zd ZdZ eej                  d             Z eej                  d             Z	d Z
d Zd Zd Zd	S )
ShellConnectMixinz
    Mixin to connect a plugin composed of stacked widgets to the shell
    widgets in the IPython console.

    It is assumed that self.get_widget() returns an instance of
    ShellConnectMainWidget
    )pluginc                 <   |                      t          j                  }|j                            | j                   |j                            | j                   |j                            | j	                   |j
                            | j                   dS )zConnect to the IPython console.N)
get_pluginr   IPythonConsolesig_shellwidget_changedconnectset_shellwidgetsig_shellwidget_createdadd_shellwidgetsig_shellwidget_deletedremove_shellwidget$sig_external_spyder_kernel_connected'on_connection_to_external_spyder_kernelself
ipyconsoles     >lib/python3.11/site-packages/spyder/api/shellconnect/mixins.pyon_ipython_console_availablez.ShellConnectMixin.on_ipython_console_available   s     __W%;<<
*2243GHHH*2243GHHH*2243JKKK7??8	: 	: 	: 	: 	:    c                 <   |                      t          j                  }|j                            | j                   |j                            | j                   |j                            | j	                   |j
                            | j                   dS )z$Disconnect from the IPython console.N)r
   r   r   r   
disconnectr   r   r   r   r   r   r   r   s     r   on_ipython_console_teardownz-ShellConnectMixin.on_ipython_console_teardown&   s     __W%;<<
*55d6JKKK*55d6JKKK*55d6MNNN7BB8	: 	: 	: 	: 	:r   c                 T    |                                                      |           dS )z
        Update the current shellwidget.

        Parameters
        ----------
        shellwidget: spyder.plugins.ipyconsole.widgets.shell.ShellWidget
            The shell widget.
        N)
get_widgetr   r   shellwidgets     r   r   z!ShellConnectMixin.set_shellwidget3   s(     	))+66666r   c                 T    |                                                      |           dS )a-  
        Add a new shellwidget to be registered.

        This function registers a new widget to display content that
        comes from shellwidget.

        Parameters
        ----------
        shellwidget: spyder.plugins.ipyconsole.widgets.shell.ShellWidget
            The shell widget.
        N)r   r   r    s     r   r   z!ShellConnectMixin.add_shellwidget>   s(     	))+66666r   c                 T    |                                                      |           dS )z
        Remove the registered shellwidget.

        Parameters
        ----------
        shellwidget: spyder.plugins.ipyconsole.widgets.shell.ShellWidget
            The shell widget.
        N)r   r   r    s     r   r   z$ShellConnectMixin.remove_shellwidgetL   s(     	,,[99999r   c                     dS )a4  
        Actions to take when the IPython console connects to an
        external Spyder kernel.

        Parameters
        ----------
        shellwidget: spyder.plugins.ipyconsole.widgets.shell.ShellWidget
            The shell widget that was connected to the external Spyder
            kernel.
        N r    s     r   r   z9ShellConnectMixin.on_connection_to_external_spyder_kernelW   s	     	r   N)__name__
__module____qualname____doc__r   r   r   r   r   r   r   r   r   r   r%   r   r   r   r      s           6777: : 87: w5666: : 76:	7 	7 	77 7 7	: 	: 	:    r   r   N)r)   )spyder.api.plugin_registration.decoratorsr   r   spyder.api.pluginsr   r   r%   r   r   <module>r,      s    - - - - - - - - & & & & & &R R R R R R R R R Rr   