U
    f»{jÂs  ã                   @   sL  d Z ddlmZmZmZ ddlmZ ddlZddlm	Z	 G dd„ deƒZ
G d	d
„ d
eƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd „ d eƒZG d!d"„ d"eƒZG d#d$„ d$eƒZG d%d&„ d&eƒZG d'd(„ d(eƒZdS ))zABCs.é    )ÚABCÚabstractmethodÚabstractclassmethod)ÚnullcontextNé   )Útight_layoutc                   @   s2  e Zd ZedBdd„ƒZeedd	„ ƒƒZed
d„ ƒZedd„ ƒZ	edd„ ƒZ
edCdd„ƒZedDdd„ƒZedEdd„ƒZedFdd„ƒZedGd d!„ƒZedHd%d&„ƒZedId)d*„ƒZedJd,d-„ƒZedKd.d/„ƒZedLd1d2„ƒZed3d4„ ƒZed5d6„ ƒZedMd7d8„ƒZed9d:„ ƒZedNd<d=„ƒZed>d?„ ƒZed@dA„ ƒZdS )OÚ_AbstractRendererN©éX  r
   ©ç        r   r   F©é   r   c                 C   s   dS )zSet up the scene.N© ©ÚselfÚfigÚsizeÚbgcolorÚnameÚshowÚshapeZsplashr   r   úY/var/www/html/bwave/python/venv/lib/python3.8/site-packages/mne/viz/backends/_abstract.pyÚ__init__   s    z_AbstractRenderer.__init__c                 C   s   d S ©Nr   ©r   r   r   r   Ú_kind   s    z_AbstractRenderer._kindc                 C   s   dS )zSet the active subplot.Nr   )r   ÚxÚyr   r   r   Úsubplot   s    z_AbstractRenderer.subplotc                 C   s   dS )zReturn scene handle.Nr   r   r   r   r   Úscene!   s    z_AbstractRenderer.scenec                 C   s   dS )zSet interaction mode.Nr   )r   Zinteractionr   r   r   Úset_interaction&   s    z!_AbstractRenderer.set_interactionçš™™™™™¹?Útriangleú
upper leftc                 C   s   dS )aK  Add a legend to the scene.

        Parameters
        ----------
        labels : list of tuples
            Each entry must contain two strings, (label, color),
            where ``label`` is the name of the item to add, and
            ``color`` is the color of the label to add.
        border : bool
            Controls if there will be a border around the legend.
            The default is False.
        size : float
            The size of the entire figure window.
        loc : str
            The location of the legend.
        face : str
            Face shape of legend face.  One of the following:

            * None: ``None``
            * Line: ``"-"`` or ``"line"``
            * Triangle: ``"^"`` or ``'triangle'``
            * Circle: ``"o"`` or ``'circle'``
            * Rectangle: ``"r"`` or ``'rectangle'``
        Nr   )r   ÚlabelsÚborderr   ZfaceÚlocr   r   r   Úlegend+   s    z_AbstractRenderer.legendç      ð?TÚsurfacec                 K   s   dS )av  Add a mesh in the scene.

        Parameters
        ----------
        x : array, shape (n_vertices,)
           The array containing the X component of the vertices.
        y : array, shape (n_vertices,)
           The array containing the Y component of the vertices.
        z : array, shape (n_vertices,)
           The array containing the Z component of the vertices.
        triangles : array, shape (n_polygons, 3)
           The array containing the indices of the polygons.
        color : tuple | str
            The color of the mesh as a tuple (red, green, blue) of float
            values between 0 and 1 or a valid color name (i.e. 'white'
            or 'w').
        opacity : float
            The opacity of the mesh.
        shading : bool
            If True, enable the mesh shading.
        backface_culling : bool
            If True, enable backface culling on the mesh.
        scalars : ndarray, shape (n_vertices,)
            The scalar valued associated to the vertices.
        vmin : float | None
            vmin is used to scale the colormap.
            If None, the min of the data will be used
        vmax : float | None
            vmax is used to scale the colormap.
            If None, the max of the data will be used
        colormap :
            The colormap to use.
        interpolate_before_map :
            Enabling makes for a smoother scalars display. Default is True.
            When False, OpenGL will interpolate the mapped colors which can
            result is showing colors that are not present in the color map.
        representation : str
            The representation of the mesh: either 'surface' or 'wireframe'.
        line_width : int
            The width of the lines when representation='wireframe'.
        normals : array, shape (n_vertices, 3)
            The array containing the normal of each vertex.
        polygon_offset : float
            If not None, the factor used to resolve coincident topology.
        kwargs : args
            The arguments to pass to triangular_mesh

        Returns
        -------
        surface :
            Handle of the mesh in the scene.
        Nr   )r   r   r   ÚzZ	trianglesÚcolorÚopacityZshadingÚbackface_cullingÚscalarsÚcolormapÚvminÚvmaxZinterpolate_before_mapZrepresentationÚ
line_widthZnormalsÚpolygon_offsetÚkwargsr   r   r   ÚmeshH   s    :z_AbstractRenderer.meshÚlinec                 C   s   dS )aÅ  Add a contour in the scene.

        Parameters
        ----------
        surface : surface object
            The mesh to use as support for contour.
        scalars : ndarray, shape (n_vertices,)
            The scalar valued associated to the vertices.
        contours : int | list
             Specifying a list of values will only give the requested contours.
        width : float
            The width of the lines or radius of the tubes.
        opacity : float
            The opacity of the contour.
        vmin : float | None
            vmin is used to scale the colormap.
            If None, the min of the data will be used
        vmax : float | None
            vmax is used to scale the colormap.
            If None, the max of the data will be used
        colormap :
            The colormap to use.
        normalized_colormap : bool
            Specify if the values of the colormap are between 0 and 1.
        kind : 'line' | 'tube'
            The type of the primitives to use to display the contours.
        color :
            The color of the mesh as a tuple (red, green, blue) of float
            values between 0 and 1 or a valid color name (i.e. 'white'
            or 'w').
        Nr   )r   r*   r/   ZcontoursÚwidthr-   r1   r2   r0   Únormalized_colormapÚkindr,   r   r   r   Úcontour„   s    #z_AbstractRenderer.contourc                 C   s   dS )a
  Add a surface in the scene.

        Parameters
        ----------
        surface : surface object
            The information describing the surface.
        color : tuple | str
            The color of the surface as a tuple (red, green, blue) of float
            values between 0 and 1 or a valid color name (i.e. 'white'
            or 'w').
        opacity : float
            The opacity of the surface.
        vmin : float | None
            vmin is used to scale the colormap.
            If None, the min of the data will be used
        vmax : float | None
            vmax is used to scale the colormap.
            If None, the max of the data will be used
        colormap :
            The colormap to use.
        scalars : ndarray, shape (n_vertices,)
            The scalar valued associated to the vertices.
        backface_culling : bool
            If True, enable backface culling on the surface.
        polygon_offset : float
            If not None, the factor used to resolve coincident topology.
        Nr   )r   r*   r,   r-   r1   r2   r0   r9   r/   r.   r4   r   r   r   r*   ©   s     z_AbstractRenderer.surfaceé   c                 C   s   dS )a§  Add sphere in the scene.

        Parameters
        ----------
        center : ndarray, shape(n_center, 3)
            The list of centers to use for the sphere(s).
        color : tuple | str
            The color of the sphere as a tuple (red, green, blue) of float
            values between 0 and 1 or a valid color name (i.e. 'white'
            or 'w').
        scale : float
            The scaling applied to the spheres. The given value specifies
            the maximum size in drawing units.
        opacity : float
            The opacity of the sphere(s).
        resolution : int
            The resolution of the sphere created. This is the number
            of divisions along theta and phi.
        backface_culling : bool
            If True, enable backface culling on the sphere(s).
        radius : float | None
            Replace the glyph scaling by a fixed radius value for each
            sphere.
        Nr   )r   Úcenterr,   Úscaler-   Ú
resolutionr.   Úradiusr   r   r   ÚsphereË   s    z_AbstractRenderer.sphereçü©ñÒMbP?ÚwhiteÚRdBuc                 C   s   dS )a+  Add tube in the scene.

        Parameters
        ----------
        origin : array, shape(n_lines, 3)
            The coordinates of the first end of the tube(s).
        destination : array, shape(n_lines, 3)
            The coordinates of the other end of the tube(s).
        radius : float
            The radius of the tube(s).
        color : tuple | str
            The color of the tube as a tuple (red, green, blue) of float
            values between 0 and 1 or a valid color name (i.e. 'white'
            or 'w').
        scalars : array, shape (n_quivers,) | None
            The optional scalar data to use.
        vmin : float | None
            vmin is used to scale the colormap.
            If None, the min of the data will be used
        vmax : float | None
            vmax is used to scale the colormap.
            If None, the max of the data will be used
        colormap :
            The colormap to use.
        opacity : float
            The opacity of the tube(s).
        backface_culling : bool
            If True, enable backface culling on the tube(s).
        reverse_lut : bool
            If True, reverse the lookup table.

        Returns
        -------
        actor :
            The actor in the scene.
        surface :
            Handle of the tube in the scene.
        Nr   )r   ÚoriginZdestinationr@   r,   r/   r1   r2   r0   r9   Zreverse_lutr   r   r   Útubeé   s    *z_AbstractRenderer.tubeÚnoneç       @c                 C   s   dS )a»	  Add quiver3d in the scene.

        Parameters
        ----------
        x : array, shape (n_quivers,)
            The X component of the position of the quiver.
        y : array, shape (n_quivers,)
            The Y component of the position of the quiver.
        z : array, shape (n_quivers,)
            The Z component of the position of the quiver.
        u : array, shape (n_quivers,)
            The last X component of the quiver.
        v : array, shape (n_quivers,)
            The last Y component of the quiver.
        w : array, shape (n_quivers,)
            The last Z component of the quiver.
        color : tuple | str
            The color of the quiver as a tuple (red, green, blue) of float
            values between 0 and 1 or a valid color name (i.e. 'white'
            or 'w').
        scale : float
            The scaling applied to the glyphs. The size of the glyph
            is by default calculated from the inter-glyph spacing.
            The given value specifies the maximum glyph size in drawing units.
        mode : 'arrow', 'cone' or 'cylinder'
            The type of the quiver.
        resolution : int
            The resolution of the glyph created. Depending on the type of
            glyph, it represents the number of divisions in its geometric
            representation.
        glyph_height : float
            The height of the glyph used with the quiver.
        glyph_center : tuple
            The center of the glyph used with the quiver: (x, y, z).
        glyph_resolution : float
            The resolution of the glyph used with the quiver.
        opacity : float
            The opacity of the quiver.
        scale_mode : 'vector', 'scalar' or 'none'
            The scaling mode for the glyph.
        scalars : array, shape (n_quivers,) | None
            The optional scalar data to use.
        backface_culling : bool
            If True, enable backface culling on the quiver.
        colormap :
            The colormap to use.
        vmin : float | None
            vmin is used to scale the colormap.
            If None, the min of the data will be used
        vmax : float | None
            vmax is used to scale the colormap.
            If None, the max of the data will be used
        line_width : float
            The width of the 2d arrows.

        Returns
        -------
        actor :
            The actor in the scene.
        surface :
            Handle of the quiver in the scene.
        Nr   )r   r   r   r+   ÚuÚvÚwr,   r>   Úmoder?   Zglyph_heightZglyph_centerZglyph_resolutionr-   Z
scale_moder/   r.   r0   r1   r2   r3   r   r   r   r   Úquiver3d  s    Dz_AbstractRenderer.quiver3dé   c                 C   s   dS )a©  Add 2d text in the scene.

        Parameters
        ----------
        x : float
            The X component to use as position of the text in the
            window coordinates system (window_width, window_height).
        y : float
            The Y component to use as position of the text in the
            window coordinates system (window_width, window_height).
        text : str
            The content of the text.
        size : int
            The size of the font.
        color : tuple | str
            The color of the text as a tuple (red, green, blue) of float
            values between 0 and 1 or a valid color name (i.e. 'white'
            or 'w').
        Nr   )r   Zx_windowZy_windowÚtextr   r,   r   r   r   Útext2d[  s    z_AbstractRenderer.text2dc                 C   s   dS )ae  Add 2d text in the scene.

        Parameters
        ----------
        x : float
            The X component to use as position of the text.
        y : float
            The Y component to use as position of the text.
        z : float
            The Z component to use as position of the text.
        text : str
            The content of the text.
        width : float
            The width of the text.
        color : tuple | str
            The color of the text as a tuple (red, green, blue) of float
            values between 0 and 1 or a valid color name (i.e. 'white'
            or 'w').
        Nr   )r   r   r   r+   rO   r8   r,   r   r   r   Útext3dr  s    z_AbstractRenderer.text3dé   c                 C   s   dS )aÊ  Add a scalar bar in the scene.

        Parameters
        ----------
        source :
            The object of the scene used for the colormap.
        color :
            The color of the label text.
        title : str | None
            The title of the scalar bar.
        n_labels : int | None
            The number of labels to display on the scalar bar.
        bgcolor :
            The color of the background when there is transparency.
        Nr   )r   Úsourcer,   ÚtitleZn_labelsr   r   r   r   Ú	scalarbar‰  s    z_AbstractRenderer.scalarbarc                 C   s   dS )zRender the scene.Nr   r   r   r   r   r   �  s    z_AbstractRenderer.showc                 C   s   dS )zClose the scene.Nr   r   r   r   r   Úclose¢  s    z_AbstractRenderer.closec                 C   s   dS )a  Configure the camera of the scene.

        Parameters
        ----------
        azimuth : float
            The azimuthal angle of the camera.
        elevation : float
            The zenith angle of the camera.
        distance : float
            The distance to the focal point.
        focalpoint : tuple
            The focal point of the camera: (x, y, z).
        roll : float
            The rotation of the camera along its axis.
        reset_camera : bool
           If True, reset the camera properties beforehand.
        Nr   )r   ZazimuthZ	elevationZdistanceZ
focalpointZrollÚreset_camerar   r   r   Ú
set_camera§  s    z_AbstractRenderer.set_camerac                 C   s   dS )zReset the camera properties.Nr   r   r   r   r   rW   ½  s    z_AbstractRenderer.reset_cameraÚrgbc                 C   s   dS )a  Take a screenshot of the scene.

        Parameters
        ----------
        mode : str
            Either 'rgb' or 'rgba' for values to return.
            Default is 'rgb'.
        filename : str | None
            If not None, save the figure to the disk.
        Nr   )r   rL   Úfilenamer   r   r   Ú
screenshotÂ  s    z_AbstractRenderer.screenshotc                 C   s   dS )zðConvert 3d points to a 2d perspective.

        Parameters
        ----------
        xyz : array, shape(n_points, 3)
            The points to project.
        ch_names : array, shape(_n_points,)
            Names of the channels.
        Nr   )r   ZxyzZch_namesr   r   r   ÚprojectÐ  s    z_AbstractRenderer.projectc                 C   s   dS )z™Remove the given mesh from the scene.

        Parameters
        ----------
        mesh_data : tuple | Surface
            The mesh to remove.
        Nr   )r   Z	mesh_datar   r   r   Úremove_meshÝ  s    	z_AbstractRenderer.remove_mesh)Nr	   r   NFr   F)Fr"   r#   r$   )r)   FFNNNNTr*   r)   NN)r)   r)   NNNFr7   N)	Nr)   NNNFNFN)r)   r<   FN)rB   rC   NNNrD   FF)r<   NNNr)   rG   NFNNNrH   N)rN   rC   )rC   )rC   NrR   N)NNNNNT)rY   N)Ú__name__Ú
__module__Ú__qualname__r   r   Úpropertyr   r   r   r    r!   r(   r6   r;   r*   rA   rF   rM   rP   rQ   rU   r   rV   rX   rW   r[   r\   r]   r   r   r   r   r      sØ           ÿ


  ÿ                 ü;           þ$            ý!     þ           þ+                     üE  ÿ

      ÿ

r   c                   @   sv   e Zd Zeddd„ƒZedddœdd„ƒZedd	„ ƒZed
d„ ƒZedd„ ƒZeddœdd„ƒZ	eddœdd„ƒZ
dS )Ú_AbstractToolBarÚdefaultNc                 C   s   d S r   r   )r   r   Úwindowr   r   r   Ú_tool_bar_initializeê  s    z%_AbstractToolBar._tool_bar_initialize)Ú	icon_nameÚshortcutc                C   s   d S r   r   )r   r   ÚdescÚfuncrf   rg   r   r   r   Ú_tool_bar_add_buttonî  s    z%_AbstractToolBar._tool_bar_add_buttonc                 C   s   d S r   r   )r   r   rf   r   r   r   Ú_tool_bar_update_button_iconó  s    z-_AbstractToolBar._tool_bar_update_button_iconc                 C   s   d S r   r   )r   r   ÚvalueÚplaceholderr   r   r   Ú_tool_bar_add_text÷  s    z#_AbstractToolBar._tool_bar_add_textc                 C   s   d S r   r   r   r   r   r   Ú_tool_bar_add_spacerû  s    z%_AbstractToolBar._tool_bar_add_spacer)rg   c                C   s   d S r   r   ©r   r   rh   ri   rg   r   r   r   Ú_tool_bar_add_file_buttonÿ  s    z*_AbstractToolBar._tool_bar_add_file_buttonc                C   s   d S r   r   rp   r   r   r   Ú_tool_bar_add_play_button  s    z*_AbstractToolBar._tool_bar_add_play_button)rc   N)r^   r_   r`   r   re   rj   rk   rn   ro   rq   rr   r   r   r   r   rb   é  s    ÿ


rb   c                	   @   sR  e Zd Zed4dd„ƒZedd„ ƒZedd	„ ƒZed
d„ ƒZed5dd„ƒZed6dd„ƒZ	eddddœdd„ƒZ
edddddœdd„ƒZedddœdd„ƒZedddddœdd„ƒZedddœd d!„ƒZedddddd"œd#d$„ƒZedddd%œd&d'„ƒZeddd(œd)d*„ƒZeddd+œd,d-„ƒZeddd.œd/d0„ƒZedddddddd1œd2d3„ƒZdS )7Ú_AbstractDockNÚControlsÚleftc                 C   s   d S r   r   )r   rd   r   ZareaÚ	max_widthr   r   r   Ú_dock_initialize	  s    z_AbstractDock._dock_initializec                 C   s   d S r   r   r   r   r   r   Ú_dock_finalize  s    z_AbstractDock._dock_finalizec                 C   s   d S r   r   r   r   r   r   Ú
_dock_show  s    z_AbstractDock._dock_showc                 C   s   d S r   r   r   r   r   r   Ú
_dock_hide  s    z_AbstractDock._dock_hidec                 C   s   d S r   r   )r   Úlayoutr   r   r   Ú_dock_add_stretch  s    z_AbstractDock._dock_add_stretchTc                 C   s   d S r   r   )r   Úverticalr   r   r   Ú_dock_add_layout  s    z_AbstractDock._dock_add_layoutF)Úalignr{   Ú
selectablec                C   s   d S r   r   )r   rl   r   r{   r€   r   r   r   Ú_dock_add_label"  s    z_AbstractDock._dock_add_labelZ
pushbutton)ÚstyleÚiconÚtooltipr{   c                C   s   d S r   r   )r   r   Úcallbackr‚   rƒ   r„   r{   r   r   r   Ú_dock_add_button(  s    z_AbstractDock._dock_add_button)r{   Úcompactc                C   s   d S r   r   )r   r   r{   r‡   r   r   r   Ú_dock_named_layout/  s    z _AbstractDock._dock_named_layout)r‡   Údoubler„   r{   c          	      C   s   d S r   r   )	r   r   rl   Úrngr…   r‡   r‰   r„   r{   r   r   r   Ú_dock_add_slider3  s    z_AbstractDock._dock_add_slider)r„   r{   c                C   s   d S r   r   )r   r   rl   r…   r„   r{   r   r   r   Ú_dock_add_check_box9  s    z!_AbstractDock._dock_add_check_box)r‡   r‰   Ústepr„   r{   c          
      C   s   d S r   r   )
r   r   rl   rŠ   r…   r‡   r‰   r�   r„   r{   r   r   r   Ú_dock_add_spin_box>  s    z _AbstractDock._dock_add_spin_box)r‡   r„   r{   c                C   s   d S r   r   )r   r   rl   rŠ   r…   r‡   r„   r{   r   r   r   Ú_dock_add_combo_boxD  s    z!_AbstractDock._dock_add_combo_box)r}   r{   c                C   s   d S r   r   )r   rl   rŠ   r…   r}   r{   r   r   r   Ú_dock_add_radio_buttonsI  s    z%_AbstractDock._dock_add_radio_buttons)Úcollapser{   c                C   s   d S r   r   )r   r   r‘   r{   r   r   r   Ú_dock_add_group_boxN  s    z!_AbstractDock._dock_add_group_box)r…   r{   c                C   s   d S r   r   )r   r   rl   rm   r…   r{   r   r   r   Ú_dock_add_textR  s    z_AbstractDock._dock_add_text)ÚfilterÚinitial_directoryÚsaveÚis_directoryrƒ   r„   r{   c                C   s   d S r   r   )r   r   rh   ri   r”   r•   r–   r—   rƒ   r„   r{   r   r   r   Ú_dock_add_file_buttonW  s    z#_AbstractDock._dock_add_file_button)Nrt   ru   N)N)T)r^   r_   r`   r   rw   rx   ry   rz   r|   r~   r�   r†   rˆ   r‹   rŒ   rŽ   r�   r�   r’   r“   r˜   r   r   r   r   rs     sŠ       ÿ


  ÿ  þ  þÿ   þ ÿÿÿ     þrs   c                   @   s2   e Zd Zeddd„ƒZedd„ ƒZedd„ ƒZdS )	Ú_AbstractMenuBarNc                 C   s   d S r   r   ©r   rd   r   r   r   Ú_menu_initialize`  s    z!_AbstractMenuBar._menu_initializec                 C   s   d S r   r   )r   r   rh   r   r   r   Ú_menu_add_submenud  s    z"_AbstractMenuBar._menu_add_submenuc                 C   s   d S r   r   )r   Z	menu_namer   rh   ri   r   r   r   Ú_menu_add_buttonh  s    z!_AbstractMenuBar._menu_add_button)N)r^   r_   r`   r   r›   rœ   r�   r   r   r   r   r™   _  s   
r™   c                   @   sF   e Zd Zeddd„ƒZeddœdd„ƒZeddd	„ƒZed
d„ ƒZdS )Ú_AbstractStatusBarNc                 C   s   d S r   r   rš   r   r   r   Ú_status_bar_initializen  s    z)_AbstractStatusBar._status_bar_initializer   )Ústretchc                C   s   d S r   r   )r   rl   r    r   r   r   Ú_status_bar_add_labelr  s    z(_AbstractStatusBar._status_bar_add_labelc                 C   s   d S r   r   )r   r    r   r   r   Ú_status_bar_add_progress_barv  s    z/_AbstractStatusBar._status_bar_add_progress_barc                 C   s   d S r   r   r   r   r   r   Ú_status_bar_updatez  s    z%_AbstractStatusBar._status_bar_update)N)r   )r^   r_   r`   r   rŸ   r¡   r¢   r£   r   r   r   r   rž   m  s   rž   c                   @   s   e Zd Zedd„ ƒZdS )Ú_AbstractPlaybackc                 C   s   d S r   r   )r   ri   Útimeoutrl   rŠ   Ztime_widgetZplay_widgetr   r   r   Ú_playback_initialize€  s    z&_AbstractPlayback._playback_initializeN)r^   r_   r`   r   r¦   r   r   r   r   r¤     s   r¤   c                   @   s2   e Zd Zeddd„ƒZedd„ ƒZedd„ ƒZdS )	Ú_AbstractKeyPressNc                 C   s   d S r   r   ©r   Úwidgetr   r   r   Ú_keypress_initialize‡  s    z&_AbstractKeyPress._keypress_initializec                 C   s   d S r   r   )r   rg   r…   r   r   r   Ú_keypress_add‹  s    z_AbstractKeyPress._keypress_addc                 C   s   d S r   r   )r   rg   r   r   r   Ú_keypress_trigger�  s    z#_AbstractKeyPress._keypress_trigger)N)r^   r_   r`   r   rª   r«   r¬   r   r   r   r   r§   †  s   
r§   c                   @   s$   e Zd Zedg dddœdd„ƒZdS )Ú_AbstractDialogÚWarningTN)rƒ   ÚbuttonsÚmodalrd   c          	      C   s   d S r   r   )	r   rT   rO   Z	info_textr…   rƒ   r¯   r°   rd   r   r   r   Ú_dialog_create•  s    z_AbstractDialog._dialog_create)r^   r_   r`   r   r±   r   r   r   r   r­   ”  s      ÿr­   c                   @   s<   e Zd Zedd„ ƒZeddddœdd„ƒZedd	d
„ƒZdS )Ú_AbstractLayoutc                 C   s   d S r   r   )r   rv   r   r   r   Ú_layout_initializeœ  s    z"_AbstractLayout._layout_initializer   N)ÚrowÚcolc                C   s   d S r   r   )r   r{   r©   r    r´   rµ   r   r   r   Ú_layout_add_widget   s    z"_AbstractLayout._layout_add_widgetr}   c                 C   s   d S r   r   )r   Zorientationr   r   r   Ú_layout_create¥  s    z_AbstractLayout._layout_create)r   )r}   )r^   r_   r`   r   r³   r¶   r·   r   r   r   r   r²   ›  s   
 ÿr²   c                   @   s0   e Zd Zedd„ ƒZedd„ ƒZedd„ ƒZdS )Ú_AbstractWidgetListc                 C   s   d S r   r   ©r   Ústater   r   r   Úset_enabled«  s    z_AbstractWidgetList.set_enabledc                 C   s   d S r   r   )r   Úidxr   r   r   Ú	get_value¯  s    z_AbstractWidgetList.get_valuec                 C   s   d S r   r   )r   r¼   rl   r   r   r   Ú	set_value³  s    z_AbstractWidgetList.set_valueN)r^   r_   r`   r   r»   r½   r¾   r   r   r   r   r¸   ª  s   

r¸   c                   @   s¬   e Zd Zdd„ Zedd„ ƒZedd„ ƒZedd„ ƒZed	d
„ ƒZ	edd„ ƒZ
edd„ ƒZedd„ ƒZedd„ ƒZeddd„ƒZedd„ ƒZeedœdd„ƒZedd„ ƒZdS )Ú_AbstractWidgetc                 C   s
   || _ d S r   ©Z_widgetr¨   r   r   r   r   ¹  s    z_AbstractWidget.__init__c                 C   s   | j S r   rÀ   r   r   r   r   r©   ¼  s    z_AbstractWidget.widgetc                 C   s   d S r   r   )r   rl   r   r   r   r¾   À  s    z_AbstractWidget.set_valuec                 C   s   d S r   r   r   r   r   r   r½   Ä  s    z_AbstractWidget.get_valuec                 C   s   d S r   r   )r   rŠ   r   r   r   Ú	set_rangeÈ  s    z_AbstractWidget.set_rangec                 C   s   d S r   r   r   r   r   r   r   Ì  s    z_AbstractWidget.showc                 C   s   d S r   r   r   r   r   r   ÚhideÐ  s    z_AbstractWidget.hidec                 C   s   d S r   r   r¹   r   r   r   r»   Ô  s    z_AbstractWidget.set_enabledc                 C   s   d S r   r   r   r   r   r   Ú
is_enabledØ  s    z_AbstractWidget.is_enabledTc                 C   s   d S r   r   )r   Zrepaintr   r   r   ÚupdateÜ  s    z_AbstractWidget.updatec                 C   s   d S r   r   r   r   r   r   Úget_tooltipà  s    z_AbstractWidget.get_tooltip)r„   c                 C   s   d S r   r   )r   r„   r   r   r   Úset_tooltipä  s    z_AbstractWidget.set_tooltipc                 C   s   d S r   r   )r   r‚   r   r   r   Ú	set_styleè  s    z_AbstractWidget.set_styleN)T)r^   r_   r`   r   ra   r©   r   r¾   r½   rÁ   r   rÂ   r»   rÃ   rÄ   rÅ   ÚstrrÆ   rÇ   r   r   r   r   r¿   ¸  s2   








r¿   c                   @   s8   e Zd Zdd„ Zedd„ ƒZedd„ ƒZedd„ ƒZd	S )
Ú_AbstractActionc                 C   s
   || _ d S r   )Ú_action)r   Úactionr   r   r   r   î  s    z_AbstractAction.__init__c                 C   s   d S r   r   r   r   r   r   Útriggerñ  s    z_AbstractAction.triggerc                 C   s   d S r   r   r   r   r   r   Úset_iconõ  s    z_AbstractAction.set_iconc                 C   s   d S r   r   r   r   r   r   Úset_shortcutù  s    z_AbstractAction.set_shortcutN)r^   r_   r`   r   r   rÌ   rÍ   rÎ   r   r   r   r   rÉ   í  s   

rÉ   c                   @   s   e Zd Zedd„ ƒZdS )Ú_AbstractMplInterfacec                   C   s   d S r   r   r   r   r   r   Ú_mpl_initializeÿ  s    z%_AbstractMplInterface._mpl_initializeN)r^   r_   r`   r   rÐ   r   r   r   r   rÏ   þ  s   rÏ   c                   @   s`   e Zd Zdd„ Zdd„ Zddd„Zddd	„Zd
d„ Zdd„ Zdd„ Z	dd„ Z
dd„ Zdd„ ZdS )Ú_AbstractMplCanvasc              	   C   s˜   ddl m} ddlm} t}d| _z|ddiƒ}d| _W n tk
rL   Y nX |� |||f|d�| _W 5 Q R X | j d	¡| _	| j	j
d
dd� d| _dS )úInitialize the MplCanvas.r   )Ú
rc_context)ÚFigure)Úresizezfigure.constrained_layout.useTr   )ZfigsizeÚdpiéo   z
Time (sec)zActivation (AU))ZxlabelZylabelN)Z
matplotlibrÓ   Zmatplotlib.figurerÔ   r   Ú_extra_eventsÚKeyErrorr   Zadd_subplotÚaxesÚsetÚmanager)r   r8   ÚheightrÖ   rÓ   rÔ   Úcontextr   r   r   r     s    
z_AbstractMplCanvas.__init__c                 C   s0   d| j  D ] }| j |d t| d| ƒ¡ q
d S )N)Zbutton_pressZmotion_notifyZ_eventZon_)rØ   ÚcanvasZmpl_connectÚgetattr©r   Úeventr   r   r   Ú_connect  s
     ÿz_AbstractMplCanvas._connectTc                 K   s,   | j j||fd|i|—Ž\}|r(|  ¡  |S )zPlot a curve.Úlabel)rÚ   ÚplotÚupdate_plot)r   r   r   rä   rÄ   r5   r7   r   r   r   rå     s     ÿÿÿz_AbstractMplCanvas.plotc                 K   s(   | j j|fd|i|—Ž}|r$|  ¡  |S )zPlot the vertical line.rä   )rÚ   Zaxvlineræ   )r   r   rä   rÄ   r5   r7   r   r   r   Úplot_time_line$  s    z!_AbstractMplCanvas.plot_time_linec              	   C   s2   t jdd�� t  dd¡ | j ¡  W 5 Q R X dS )úUpdate the plot.T)ÚrecordÚignoreZconstrained_layoutN)ÚwarningsÚcatch_warningsÚfilterwarningsrß   Zdrawr   r   r   r   ræ   +  s    z_AbstractMplCanvas.update_plotc                 C   s¦   | j  |¡ | j jj |¡ | j jj |¡ | j jd  |¡ | j jd  |¡ | j jd  |¡ | j jd  |¡ | j jd|d� | j jd|d� | jj	 |¡ dS )	zSet the widget colors.ÚtopÚbottomru   Úrightr   )ZaxisÚcolorsr   N)
rÚ   Zset_facecolorZxaxisrä   Ú	set_colorZyaxisZspinesZtick_paramsr   Úpatch)r   Zbg_colorZfg_colorr   r   r   rò   1  s    z_AbstractMplCanvas.set_colorc                 C   s$   | j dkr| j ¡  n
| j  ¡  dS )zShow the canvas.N)rÜ   rß   r   r   r   r   r   r   >  s    
z_AbstractMplCanvas.showc                 C   s   | j  ¡  dS )zClose the canvas.N)rß   rV   r   r   r   r   rV   E  s    z_AbstractMplCanvas.closec                 C   s,   |   ¡  | j ¡  | j ¡  d| _d| _dS ©zClear internal variables.N)rV   rÚ   Úclearr   rß   rÜ   r   r   r   r   rõ   I  s
    

z_AbstractMplCanvas.clearc                 C   s   t | jjd� dS )zHandle resize events.)r   N)r   rÚ   Zfigurerá   r   r   r   Ú	on_resizeQ  s    z_AbstractMplCanvas.on_resizeN)T)T)r^   r_   r`   r   rã   rå   rç   ræ   rò   r   rV   rõ   rö   r   r   r   r   rÑ     s   

rÑ   c                       s@   e Zd Z‡ fdd„Z‡ fdd„Zdd„ ZeZ‡ fdd„Z‡  ZS )	Ú_AbstractBrainMplCanvasc                    s&   t ƒ  |||¡ || _|jd | _dS )rÒ   ÚtimeN)Úsuperr   ÚbrainÚ	callbacksÚ	time_func)r   rú   r8   rÝ   rÖ   ©Ú	__class__r   r   r   W  s    z _AbstractBrainMplCanvas.__init__c                    sH   | j jdddœdd| jjd�}| ¡ D ]}| | jj¡ q&tƒ  ¡  dS )rè   Z	monospaceZsmall)Úfamilyr   g      à?r)   )ÚpropZ
framealphaZhandlelengthZ	facecolorN)	rÚ   r(   rú   Z	_bg_colorZ	get_textsrò   Z	_fg_colorrù   ræ   )r   ÚlegrO   rý   r   r   ræ   ]  s     ýz#_AbstractBrainMplCanvas.update_plotc                 C   s0   |j | jks|jdkrdS | j|jddd� dS )zHandle button presses.r   NTF)Zupdate_widgetZtime_as_index)ZinaxesrÚ   Zbuttonrü   Zxdatará   r   r   r   Úon_button_pressg  s    ÿ  ÿz'_AbstractBrainMplCanvas.on_button_pressc                    s   t ƒ  ¡  d| _dS rô   )rù   rõ   rú   r   rý   r   r   rõ   r  s    
z_AbstractBrainMplCanvas.clear)	r^   r_   r`   r   ræ   r  Zon_motion_notifyrõ   Ú__classcell__r   r   rý   r   r÷   V  s
   
	r÷   c                   @   sÖ   e Zd Zddddœdd„Zedd„ ƒZedd	œd
d„ƒZed&dd„ƒZedd„ ƒZedd„ ƒZ	dd„ Z
edd„ ƒZedd„ ƒZedd„ ƒZedd„ ƒZedd„ ƒZedd„ ƒZed d!„ ƒZed"d#„ ƒZed$d%„ ƒZdS )'Ú_AbstractWindowNF)rd   Úcentral_layoutÚ
fullscreenc                C   s0   t ƒ | _d | _d | _d | _d | _d | _d | _d S r   )ÚdictZ_iconsZ_windowZ_interactorZ
_mplcanvasZ_show_tracesZ_separate_canvasZ_interactor_fraction)r   rd   r  r  r   r   r   Ú_window_initializey  s    z"_AbstractWindow._window_initializec                 C   s   d S r   r   r   r   r   r   Ú_window_load_icons„  s    z"_AbstractWindow._window_load_iconsT)Úafterc                C   s   d S r   r   )r   ri   r
  r   r   r   Ú_window_close_connectˆ  s    z%_AbstractWindow._window_close_connectc                 C   s   d S r   r   )r   r
  r   r   r   Ú_window_close_disconnectŒ  s    z(_AbstractWindow._window_close_disconnectc                 C   s   d S r   r   r   r   r   r   Ú_window_get_dpi�  s    z_AbstractWindow._window_get_dpic                 C   s   d S r   r   r   r   r   r   Ú_window_get_size”  s    z _AbstractWindow._window_get_sizec                 C   s8   d| | }|   ¡ }|  ¡ \}}|| }|| || fS )Nr   )r  r  )r   ZfractionÚratiorÖ   rK   Úhr   r   r   Ú_window_get_mplcanvas_size˜  s
    z*_AbstractWindow._window_get_mplcanvas_sizec                 C   s   d S r   r   )r   r8   rÝ   rÖ   r   r   r   Ú_window_get_simple_canvasŸ  s    z)_AbstractWindow._window_get_simple_canvasc                 C   s   d S r   r   )r   rú   Zinteractor_fractionZshow_tracesZseparate_canvasr   r   r   Ú_window_get_mplcanvas£  s    z%_AbstractWindow._window_get_mplcanvasc                 C   s   d S r   r   r   r   r   r   Ú_window_adjust_mplcanvas_layout¨  s    z/_AbstractWindow._window_adjust_mplcanvas_layoutc                 C   s   d S r   r   r   r   r   r   Ú_window_get_cursor¬  s    z"_AbstractWindow._window_get_cursorc                 C   s   d S r   r   )r   Úcursorr   r   r   Ú_window_set_cursor°  s    z"_AbstractWindow._window_set_cursorc                 C   s   d S r   r   )r   r   r   r   r   Ú_window_new_cursor´  s    z"_AbstractWindow._window_new_cursorc                 C   s   d S r   r   r   r   r   r   Ú_window_ensure_minimum_sizes¸  s    z,_AbstractWindow._window_ensure_minimum_sizesc                 C   s   d S r   r   )r   Úthemer   r   r   Ú_window_set_theme¼  s    z!_AbstractWindow._window_set_themec                 C   s   d S r   r   r   r   r   r   Ú_window_createÀ  s    z_AbstractWindow._window_create)T)r^   r_   r`   r  r   r	  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r   r   r   r  x  sB     ÿ










r  c                   @   s*   e Zd ZdZeddd„ƒZed	d
„ ƒZdS )ÚFigure3Dz¨Class that refers to a 3D figure.

    .. note::
        This class is not meant to be instantiated directly, use
        :func:`mne.viz.create_3d_figure` instead.
    Nr	   r   Fr   c                 C   s   d S r   r   r   r   r   r   Ú_initÒ  s    zFigure3D._initc                 C   s   | j S )zÂThe native 3D plotting widget.

        Returns
        -------
        plotter : instance of pyvista.Plotter
            The plotter. Useful for interacting with the native 3D library.
        )Z_plotterr   r   r   r   Úplotter×  s    	zFigure3D.plotter)Nr	   r   NFr   F)r^   r_   r`   Ú__doc__r   r  ra   r  r   r   r   r   r  Å  s           ÿr  )r   Úabcr   r   r   Ú
contextlibr   rë   Úutilsr   r   rb   rs   r™   rž   r¤   r§   r­   r²   r¸   r¿   rÉ   rÏ   rÑ   r÷   r  r  r   r   r   r   Ú<module>   s0      ]W5R"M