a
    «ˆc�  ã                   @   sT   d Z ddlmZ ddlmZmZmZmZ ddlm	Z	 ddl
mZ G dd„ deƒZdS )	zA simple actor component.

é    )ÚInstance)ÚViewÚGroupÚItemÚInstanceEditor)Útvtk)Ú	Componentc                	       s  e Zd ZdZeejdd�Zeejdd�Z	eej
dd�Zeedd�edd�edd�ddd	�Zeeed
deeeƒd�d�ddd�eedddd�ddd�eedddd�ddd�dd�Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zd d!„ Zd"d#„ Zd$d%„ Z‡ fd&d'„Z‡  ZS )(ÚActor2Dr   T)ÚrecordZ
visibility)ÚnameÚheightÚwidthZActor)Zshow_borderÚlabelÚactorZcustom)Úview)r   ÚstyleZeditorF)Zshow_labelsr   Úmapper)r   r   Ú	resizableZMapperÚpropertyZProperty)r   c                 C   s,   | j du rt ¡ | _ t ¡ | _| jj| _dS )aÖ  Override this method so that it *creates* its tvtk
        pipeline.

        This method is invoked when the object is initialized via
        `__init__`.  Note that at the time this method is called, the
        tvtk data pipeline will *not* yet be setup.  So upstream data
        will not be available.  The idea is that you simply create the
        basic objects and setup those parts of the pipeline not
        dependent on upstream sources and filters.
        N)r   r   Z
TextMapperr	   r   r   ©Úself© r   ú\/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/mayavi/components/actor2d.pyÚsetup_pipelineA   s    


zActor2D.setup_pipelinec                 C   sF   t | jƒdks"t | jd jƒdkr&dS |  | j| jd ¡ |  ¡  dS )zâOverride this method so that it *updates* the tvtk pipeline
        when data upstream is known to have changed.

        This method is invoked (automatically) when the input fires a
        `pipeline_changed` event.
        r   N)ÚlenÚinputsÚoutputsÚconfigure_connectionr   Úrenderr   r   r   r   Úupdate_pipelineQ   s    ÿzActor2D.update_pipelinec                 C   s   |   ¡  dS )zÆOverride this method to do what is necessary when upstream
        data changes.

        This method is invoked (automatically) when any of the inputs
        sends a `data_changed` event.
        N)r   r   r   r   r   Úupdate_data^   s    zActor2D.update_datac                 C   s(   |d ur|j | jdd� |  | j¡ d S )NT)Úremove)Zon_trait_changer   ©r   ÚoldÚnewr   r   r   Ú_setup_handlersk   s    zActor2D._setup_handlersc                 C   s`   |   ||¡ t| jƒdkr@t| jd jƒdkr@|  || jd ¡ | j}|d urT||_|  ¡  d S )Nr   )r%   r   r   r   r   r   r   r   ©r   r#   r$   r   r   r   r   Ú_mapper_changedp   s    "zActor2D._mapper_changedc                 C   s@   |   ||¡ | j}|d ur ||_| j}|d ur4||_|g| _d S ©N)r%   r   r   Zactors)r   r#   r$   r   Úpropr   r   r   Ú_actor_changed|   s    zActor2D._actor_changedc                 C   s&   |   ||¡ | j}||jur"||_d S r(   )r%   r   r   r&   r   r   r   Ú_property_changedŠ   s    
zActor2D._property_changedc                 C   s   || j _|  ¡  d S r(   )r   Úcolorr   r"   r   r   r   Ú_foreground_changed_for_scene’   s    z%Actor2D._foreground_changed_for_scenec                    s$   t t| ƒ ||¡ |  d |j¡ d S r(   )Úsuperr	   Ú_scene_changedr-   Z
foregroundr"   ©Ú	__class__r   r   r/   —   s    zActor2D._scene_changed)Ú__name__Ú
__module__Ú__qualname__Ú__version__r   r   ZAbstractMapperr   ZPropr   Z
Property2Dr   r   r   Z_actor_groupr   r   r   r   r   r    r%   r'   r*   r+   r-   r/   Ú__classcell__r   r   r0   r   r	      sP   
ý
ÿýþüþüñr	   N)Ú__doc__Z
traits.apir   Ztraitsui.apir   r   r   r   Ztvtk.apir   Zmayavi.core.componentr   r	   r   r   r   r   Ú<module>   s
   