a
    «ˆc  ã                   @   sš   d Z ddlmZmZ ddlmZmZmZmZ ddl	m
Z
 ddlmZ ddlmZ ddlmZ ddlmZ ee
d	ƒs†d
Zeeƒ eeƒ‚G dd„ deƒZdS )zÌCreates a small axes on the side that indicates the position of the
co-ordinate axes and thereby marks the orientation of the scene.  It
uses the OrientationMarkerWidget which requires VTK-4.5 and above.
é    )ÚInstanceÚProperty)ÚViewÚGroupÚItemÚInstanceEditor)Útvtk)Ústate_pickler)ÚModule)Úerror)ÚPipelineInfoÚOrientationMarkerWidgetz6The OrientationAxes module requires VTK version >= 4.5c                       s”  e Zd ZdZeejdd�Zeejddd�Z	e
dd�Zedgdgdgd�ZeejƒZeed	d
�edd
�ddd�Zeedd
�edd
�edd
�edd
�edd
�edd
�edd
�edd
�edd
�edd
�edd
�edd
�edd
�ddd�Zeeeddeeeƒd�d�ed deeeƒd�d�d!dd"�eed#ddd$�d%dd"�ƒZd&d'„ Zd(d)„ Zd*d+„ Zd,d-„ Zd.d/„ Zd0d1„ Zd2d3„ Zd4d5„ Z‡ fd6d7„Z‡ fd8d9„Z ‡  Z!S ):ÚOrientationAxesr   F)Ú
allow_noneT)r   Úrecord)r   Úany)ZdatasetsZattribute_typesÚ
attributesZenabled)ÚnameÚinteractiveZWidget)Zshow_borderÚlabelZaxis_labelsZ
visibilityZx_axis_label_textZy_axis_label_textZz_axis_label_textZcone_radiusZcone_resolutionZcylinder_radiusZcylinder_resolutionZnormalized_label_positionÚnormalized_shaft_lengthÚnormalized_tip_lengthÚtotal_lengthZAxesÚmarkerZcustom)Úview)r   ÚstyleZeditorÚaxeszWidget/Axes)r   Zshow_labelsÚ_text_property)r   r   Z	resizablezText Propertyc                 C   s(   dD ]}t | |ƒ}t ||| ¡ qd S )N)r   r   r   )Úgetattrr	   Z	set_state)ÚselfÚstateÚpropÚobj© r#   úb/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/mayavi/modules/orientation_axes.pyÚ__set_pure_state__X   s    
z"OrientationAxes.__set_pure_state__c                 C   s6   t jdddd�| _| jjdddd� t jdd�| _d	S )
a  Override this method so that it *creates* the 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.  You should also
        set the `actors` attribute up at this point.
        )çš™™™™™Ù?r&   r&   )ç333333ã?r'   r'   Zcylinder)r   r   Z
shaft_type)é   r(   r(   F)ÚcolorZshadowZitalic)Zkey_press_activationN)r   Ú	AxesActorr   Útext_propertyZ	trait_setr   r   ©r   r#   r#   r$   Úsetup_pipelinea   s    þzOrientationAxes.setup_pipelinec                 C   s
   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 any of the inputs
        sends a `pipeline_changed` event.
        TN)Zpipeline_changedr,   r#   r#   r$   Úupdate_pipelineu   s    zOrientationAxes.update_pipelinec                 C   s
   d| _ dS )zÌOverride this method so that it flushes the vtk pipeline if
        that is necessary.

        This method is invoked (automatically) when any of the inputs
        sends a `data_changed` event.
        TN)Zdata_changedr,   r#   r#   r$   Úupdate_data~   s    zOrientationAxes.update_datac                 C   s\   |d ur$|j | jdd� | j |¡ | j}|d ur8||_|  | j¡ | j |¡ |  ¡  d S ©NT)Úremove)Úon_trait_changeÚrenderZwidgetsr1   r   Úorientation_markerÚappend)r   ÚoldÚnewr   r#   r#   r$   Ú_marker_changed‹   s    zOrientationAxes._marker_changedc                 C   sˆ   |d ur*|j | jdd� | jj | jdd� | j}|d ur>||_|jj}||j_||j_|| _| 	¡  |  | j¡ |  | j¡ |  ¡  d S r0   )
r2   r3   r   r   r4   Zx_axis_caption_actor2dZcaption_text_propertyZy_axis_caption_actor2dZz_axis_caption_actor2dZteardown_observers)r   r6   r7   r   Úpr#   r#   r$   Ú_axes_changed—   s    
zOrientationAxes._axes_changedc                 C   s   | j S ©N)r   r,   r#   r#   r$   Ú_get_text_property³   s    z"OrientationAxes._get_text_propertyc                 C   s   || j _|  ¡  d S r;   )r+   r)   r3   ©r   r6   r7   r#   r#   r$   Ú_foreground_changed_for_scene¶   s    z-OrientationAxes._foreground_changed_for_scenec                    s0   t t| ƒ ||¡ |  d |j¡ |  | j¡ d S r;   )Úsuperr   Ú_scene_changedr>   Z
foregroundÚ_visible_changedZvisibler=   ©Ú	__class__r#   r$   r@   »   s    zOrientationAxes._scene_changedc                    s&   | j d ur"| jjr"tt| ƒ |¡ d S r;   )Zscener   Z
interactorr?   r   rA   )r   ÚvaluerB   r#   r$   rA   À   s    z OrientationAxes._visible_changed)"Ú__name__Ú
__module__Ú__qualname__Ú__version__r   r   r   r   r*   r   r   r+   r   Z
input_infoZTextPropertyr   r   r   Z_marker_groupZ_axes_groupr   r   r   r%   r-   r.   r/   r8   r:   r<   r>   r@   rA   Ú__classcell__r#   r#   rB   r$   r      sp   
þ

ý
ò
ÿÿûÿýú		r   N)Ú__doc__Z
traits.apir   r   Ztraitsui.apir   r   r   r   Ztvtk.apir   Zapptools.persistencer	   Zmayavi.core.moduler
   Zmayavi.core.commonr   Zmayavi.core.pipeline_infor   ÚhasattrÚmsgÚImportErrorr   r#   r#   r#   r$   Ú<module>   s   

