
    G@d
                     J    d Z ddlmZ ddlmZ ddlmZ  G d de          ZdS )zU
Widget that handles communications between the IPython Console and
the Plots plugin
    )decodebytes)RichJupyterWidget)_c                   ,     e Zd ZdZdZd Z fdZ xZS )FigureBrowserWidgeta1  
    Widget with the necessary attributes and methods to intercept the figures
    sent by the kernel to the IPython Console and send it to the plots plugin.
    This widget can also block the plotting of inline figures in the IPython
    Console so that figures are only plotted in the plots plugin.
    Nc                 "    || _         d| _        dS )z/Set the namespace for the figurebrowser widget.FN)figurebrowsersended_render_message)selfr	   s     Slib/python3.11/site-packages/spyder/plugins/ipythonconsole/widgets/figurebrowser.pyset_figurebrowserz%FigureBrowserWidget.set_figurebrowser!   s    *%*"""    c                 P   d}|d         d         }d|v rd}|d         }ndd|v r+d}t          |d                             d                    }n5d|v r1| j        r*d}t          |d                             d                    }|y| j                            ||           | j        W| j        j        rK| j        sB|                     dd	
           | 	                    t          d          d	
           d	| _        dS t          t          |                               |          S )zl
        Reimplemented to handle communications between the figure explorer
        and the kernel.
        Ncontentdatazimage/svg+xmlz	image/pngasciiz
image/jpegz<br>T)before_promptzFigures are displayed in the Plots pane by default. To make them also appear inline in the console, you need to uncheck "Mute inline plotting" under the options menu of Plots.)r   encode_jpg_supportedsig_new_inline_figureemitr	   mute_inline_plottingr
   _append_htmlappend_html_messager   superr   _handle_display_data)r   msgimgr   fmt	__class__s        r   r   z(FigureBrowserWidget._handle_display_data'   s`   
 9~f%d""!C'CCD   Cd;/66w??@@CCT!!d&9!Cd<077@@AAC?&++C555".&; / 1 	6%%fD%AAA,, G H H '+ -    26D.($//DDSIIIr   )__name__
__module____qualname____doc__r	   r   r   __classcell__)r    s   @r   r   r      sa          M+ + +$J $J $J $J $J $J $J $J $Jr   r   N)r$   base64r   qtconsole.rich_jupyter_widgetr   spyder.config.baser   r    r   r   <module>r*      s    
       < ; ; ; ; ; !          6J 6J 6J 6J 6J+ 6J 6J 6J 6J 6Jr   