a
    «ˆc;4 ã                   @   sÂ   d Z ddlZddlZddlZddlZddlZddlZddlmZ ddl	m
Z
mZmZ ddlmZ ddlmZ ddlmZ zddlZW n ey–   Y n
0 e ¡  d	d
„ Zdd„ ZG dd„ dƒZdS )zOThis module generates the tvtk (Traited VTK) wrapper classes for
VTK classes.

é    N)Úchainé   )Úget_tvtk_nameÚcamel2enthoughtÚvtk_major_version)Ú
vtk_parser)Úindenter)Úspecial_genc           	      K   sP  d  dd„ | ¡ D ƒ¡}t| ƒ}tdtdi}||v rF|| t| ƒ|fS |tu rj| dkrZd} dd	 | ¡|fS |ttfv �r&t	| ƒf}t
d
d„ | D ƒƒ}t	|ƒdkrª| ¡ jnd}|dkrÈtj d¡rÈd}n|dkrÔd}|duræd |¡nd}t	| ƒ}|�r |d7 }|dj||| td|ƒd�7 }dd|fS |tu �r>dt| ƒ|fS td |¡ƒ‚dS )a}   Return the appropriate trait type, reformatted string and
    the associated traits meta data for a given `value`

    If a sequence is given, traits.Array is returned instead of
    traits.Tuple or traits.List

    Parameters
    ----------
    value
       can be anything

    kwargs : dict
       keyword arguments for the trait definition

    Returns
    -------
    tuple : (str, str, str)
       (trait_type, value, keyword_arguments)

    Raises
    ------
    TypeError
        if this function cannot find an appropriate Trait type for `value`

    Example
    -------
    >>> get_trait_def([100., 200.], enter_set=True, auto_set=False)
    ('traits.Array', '', 'auto_set=False, enter_set=True, shape=(2,), dtype=float, value=[100.0, 200.0], cols=2')
    >>> get_trait_def(100, enter_set=True, auto_set=False)
    ('traits.Int', '100', 'auto_set=False, enter_set=True')
    >>> get_trait_def(u'something', enter_set=True, auto_set=False)
    ('traits.Unicode', "u'something'", 'auto_set=False, enter_set=True')
    >>> get_trait_def(True, enter_set=True, auto_set=False)
    ('traits.Bool', 'True', 'auto_set=False, enter_set=True')
    ú, c                 s   s   | ]\}}d   ||¡V  qdS )z{0}={1}N)Úformat)Ú.0ÚkeyÚvalue© r   úS/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/tvtk/wrapper_gen.pyÚ	<genexpr>F   s   ÿz get_trait_def.<locals>.<genexpr>z
traits.Intztraits.Floatú Ú ztraits.Stringz{!r}c                 s   s   | ]}t |ƒV  qd S ©N)Útype)r   Úelementr   r   r   r   X   ó    r   NÚintÚwinÚint64Úlongz"{}"ÚNonez:shape={shape}, dtype={dtype}, value={value!r}, cols={cols}é   )ÚshapeÚdtyper   Úcolsztraits.Arrayztraits.BoolzCould not understand type: {})ÚjoinÚitemsr   r   ÚfloatÚstrr   ÚtupleÚlistÚlenÚsetÚpopÚ__name__ÚsysÚplatformÚ
startswithÚminÚboolÚ	TypeError)	r   ÚkwargsZkwargs_codeÚtype_Z
number_mapr   Zdtypesr   r    r   r   r   Úget_trait_def!   sB    %
ÿÿ

ý

r3   c           	   	   C   sü   g }t j | ¡}| t j |¡¡ |D ]L}|d du r8q&t|d ƒdkr`| tt |d ¡ƒ¡ | t|d ƒ¡ q&ddddœ}|D ]r}ztt	|ƒƒdk}W n t
y²   Y q„Y n0 |r„|d |v r„||d  }t|ƒdkrî|ft|ƒ   S |  S q„|S )a  Patch the initial default value for an attribute of
    a VTK class that does not initialise it properly.

    Parameters
    ----------
    vtk_get_meth : Method for getting the position attribute

    vtk_set_meth : Method for setting the position attribute

    default : initial default value

    Returns
    -------
    default
       If patching fails, the initial default is returned

    Examples
    --------
    >>> import vtk
    >>> vtk.vtkVersion.GetVTKVersion()
    '6.3.0'
    >>> obj = vtk.vtkXOpenGLRenderWindow()
    >>> obj.GetPosition()
    '_000000000351c458_p_void'

    >>> patch_default(vtk.vtkXOpenGLRenderWindow.GetPosition,
                      vtk.vtkXOpenGLRenderWindow.SetPosition,
                      '_000000000351c458_p_void')
    (0, 0)
    r   Nr   g        r   )r   r#   Ústring)r   ÚVTKMethodParserÚget_method_signatureÚextendr'   Úappendr%   r   Úfrom_iterabler(   r0   )	Úvtk_get_methÚvtk_set_methÚdefaultZarg_formatsZall_sigsÚsigZdefault_mappingsZ
arg_formatZall_same_typer   r   r   Úpatch_defaults   s4    $
ÿý

r>   c                   @   sÚ  e Zd Z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dd„ Zdd„ Zdd„ Zdd„ Zdxdd„Zdd„ Zdd „ Zd!d"„ Zd#d$„ Zd%d&„ Zd'd(„ Zdyd)d*„Zd+d,„ Zd-d.„ Zd/d0„ Zd1d2„ Zd3d4„ Zdzd6d7„Zd8d9„ Zd{d:d;„Zd|d<d=„Z d>d?„ Z!d@dA„ Z"dBdCdDdEdFdGdHdIdJdKdLdMdNdOdPdQœZ#e$dRdS„ ƒZ%e$dTdU„ ƒZ&e$dVdW„ ƒZ'dXdY„ Z(dZd[„ Z)d\d]„ Z*d^d_„ Z+d`da„ Z,dbdc„ Z-ddde„ Z.dfdg„ Z/dhdi„ Z0djdk„ Z1dldm„ Z2dndo„ Z3dpdq„ Z4drds„ Z5dtdu„ Z6dvdw„ Z7d5S )}ÚWrapperGeneratorz:Generates the wrapper code for all the TVTK classes.

    c                 C   s0   t  ¡ | _t ¡ | _t | j¡| _t  	¡ | _
d S r   )r   ZIndentÚindentr   r5   Úparserr	   ZSpecialGeneratorÚspecialZVTKDocMassagerÚdm©Úselfr   r   r   Ú__init__Ì   s    

zWrapperGenerator.__init__c                 C   s
   | j  ¡ S )z Returns the parser's class tree.)rA   Úget_treerD   r   r   r   rG   Ö   s    zWrapperGenerator.get_treec                 C   sJ   | j  ¡  |  ||¡ |  ||¡ |  ||¡ | j ||¡ | d¡ dS )a1  Generates the code for the given node in the parse tree
        along with an opened file-like object.

        Parameters
        ----------

        - node

          A node in the ClassTree.

        - out :  file-like object.

          Must support a `write` method.  Code is written to it.

        Ú
N)r@   ÚresetÚ_write_prelimsÚ_gen_class_initÚ_gen_methodsrB   Úgenerate_codeÚwrite)rE   ÚnodeÚoutr   r   r   rM   Ú   s    
zWrapperGenerator.generate_codec                 C   s   d}|  | j |¡¡ dS )z}Write preliminary information given the node in the class
        tree, `node`, and output file-like object, `out`.

        a¹  
        # Automatically generated code: EDIT AT YOUR OWN RISK
        from traits import api as traits
        from traitsui.item import Item, spring
        from traitsui.group import HGroup
        from traitsui.view import View

        from tvtk import vtk_module as vtk
        from tvtk import tvtk_base
        from tvtk.tvtk_base_handler import TVTKBaseHandler
        from tvtk import messenger
        from tvtk.tvtk_base import deref_vtk
        from tvtk import array_handler
        from tvtk.array_handler import deref_array
        from tvtk.tvtk_classes.tvtk_helper import wrap_vtk

        nan = float('nan')


        def InstanceEditor(*args, **kw):
            from traitsui.editors.api import InstanceEditor as Editor
            return Editor(view_name="handler.view")

        try:
            long
        except NameError:
            # Silly workaround for Python3.
            long = int

        inf = float('inf')

        N)rN   r@   r   )rE   rO   rP   Zprelimr   r   r   rJ   ý   s     zWrapperGenerator._write_prelimsc                 C   s  | j }|  ¡  |j¡}|j}|  |¡}|jdks:|jdkr@d}nD|  |j¡d }|dkr„t|ƒ}dt	ƒ  }	| 
| |	¡¡ | 
d¡ dt	ƒ  }
| 
| |
¡¡ | j |j||¡ | ¡  dt	ƒ  }| 
| |¡¡ d	d
d„ | ¡ D ƒv �rdt	ƒ  }| 
| |¡¡ d S )Nr   ÚvtkObjectBaseztvtk_base.TVTKBaseÚobjectz:from tvtk.tvtk_classes.%(base_fname)s import %(base_name)sz

z6
        class %(class_name)s(%(base_name)s):
        z¤
        def __init__(self, obj=None, update=True, **traits):
            tvtk_base.TVTKBase.__init__(self, vtk.%(vtk_class_name)s, obj, update, **traits)

        Zvtk3DWidgetc                 S   s   g | ]
}|j ‘qS r   )Úname©r   Úxr   r   r   Ú
<listcomp>F  r   z4WrapperGenerator._gen_class_init.<locals>.<listcomp>az  
            def setup_observers(self):
                """Setup the observers for the object."""
                super(%(class_name)s, self).setup_observers()
                tvtk_base._object_cache.setup_observers(self._vtk_obj,
                                              'EndInteractionEvent',
                                              self.update_traits)
            )r@   rG   Ú	get_classrS   r*   Ú_get_class_nameÚlevelÚ	__bases__r   ÚlocalsrN   r   rC   Zwrite_class_docÚ__doc__ÚincrZget_ancestors)rE   rO   rP   r@   ÚklassZvtk_class_nameÚ
class_nameÚ	base_nameZ
base_fnameÚ_impZcdefÚdeclr   r   r   rK   $  s6    


þüùz WrapperGenerator._gen_class_initc                 C   sò  |   ¡  |j¡}| j |¡ |jdkrH| j}|j d¡ |j 	ddg¡ |  
||¡\}}|  ||¡}|  ||¡\}}	|	 |¡ |  ||¡ |  ||¡ ||||	dœ}
|jdkrê|jd jdkrê|jd j}|
 ¡ D ]}|
|  || ¡ qÒ|
|_i }|
d |
d	 |
d
 fD ]}| |¡ �q
t tt| ¡ ƒƒ¡}dd|  }| | j |¡¡ t tt|
d ƒƒ¡}dd|  }| | j |¡¡ t |
¡}|d |d	 |d
   }}}dd„ }||ddgƒ t|jƒ}d| }t| ¡ ƒ}t| ¡ ƒ}t| ¡ ƒ}t d|| |  ¡}dd|  }| | j |¡¡ d}| | j |¡¡ | j  ¡  d}| | j |¡¡ | j  ¡  d| }| | j |¡¡ | j !¡  d}| | j |¡¡ | j  ¡  d}d| }dd||f  }| | j |¡¡ | j !¡  d}| | j |¡¡ | j  ¡  ||dgƒ ||g d ¢ƒ t| ¡ ƒ}t| ¡ ƒ}t| ¡ ƒ}t d!|||f ¡}d"d#||f  }| | j |¡¡ | j !¡  d$}| | j |¡¡ | j  ¡  d%}d&}d'||f }d(d)||f  }| | j |¡¡ | j !¡  | j !¡  d S )*NZ	vtkCameraZRollZGetRollZSetRoll)ÚtoggleÚstateÚget_setÚallow_update_failurer   rR   rc   rd   re   z
_updateable_traits_ = \z
%s

rf   z
_allow_update_failure_ = \c              	   S   s,   |D ]"}z
| |= W q t y$   Y q0 qd S r   )ÚKeyError)ÚdÚkeysr   r   r   r   Ú_safe_remove   s
    
z3WrapperGenerator._gen_methods.<locals>._safe_removeZreference_countÚprogresszEdit %s propertiesz(%s)z
_full_traitnames_list_ = \z4
def trait_view(self, name=None, view_element=None):zb
if view_element is not None or name not in (None, '', 'traits_view', 'full_traits_view', 'view'):z6
return super(%s, self).trait_view(name, view_element)z
if name == 'full_traits_view':z2Item("handler._full_traits_list",show_label=False)z
View((%s),z
full_traits_view = \z{
%s
title='%s', scrollable=True, resizable=True,
handler=TVTKBaseHandler,
buttons=['OK', 'Cancel'])
return full_traits_viewz
elif name == 'view':Zprogress_text)Zabort_executeZrelease_data_flagZdragableZpickableÚdebugZglobal_warning_displayzView((%s, %s, %s),z	
view = \zo
%s
title='%s', scrollable=True, resizable=True,
handler=TVTKBaseHandler,
buttons=['OK', 'Cancel'])
return viewz$
elif name in (None, 'traits_view'):z5HGroup(spring, "handler.view_type", show_border=True)zs
Item("handler.info.object", editor = InstanceEditor(view_name="handler.view"), style = "custom", show_label=False)zView((%s, %s),z
traits_view = \zx
%s
title='%s', scrollable=True, resizable=True,
handler=TVTKBaseHandler,
buttons=['OK', 'Cancel'])
return traits_view

)"rG   rW   rS   rA   Úparser*   Zget_set_methsr)   Zother_methsr7   Ú_gen_toggle_methodsÚ_gen_state_methodsÚ_gen_get_set_methodsÚupdateÚ_gen_get_methodsÚ_gen_other_methodsrY   ÚparentsÚdatari   ÚtextwrapÚfillÚreprr%   r"   rN   r@   r   ÚcopyÚdeepcopyr   Úsortedr]   Údecr)rE   rO   rP   r^   Úprc   Ztoggle_allow_failurerd   re   rf   ru   ÚpdÚiÚutZjunkÚcoderh   rj   r_   ÚtitleZt_gZs_gZgs_gZitem_contentsZviewtype_contentsZview_contentsr   r   r   rL   S  s¾    


ÿ





ÿýÿ

ýÿ

ÿÿýÿ
zWrapperGenerator._gen_methodsc                 C   sˆ   ddddœ}|j |v r„|  ¡  ||j  ¡}|j}d}|D ]0}|| }	||  |	¡ |	D ]}
|d|
 7 }qVq8|d7 }| | j |¡¡ dS )	zaThis method generates delegates for specific classes.  It
        modifies the n_data dictionary.ÚvtkPropertyZvtkProperty2DZvtkVolumeProperty)ZvtkActorZ
vtkActor2DZ	vtkVolumer   z%%s = tvtk_base.vtk_property_delegate
rH   N)rS   rG   Zget_noderu   rq   rN   r@   r   )rE   rO   Zn_datarP   Z	prop_nameZ	prop_nodeZ	prop_datar�   r   Úpropsr}   r   r   r   Ú_generate_delegates  s    þ
z$WrapperGenerator._generate_delegatesc                 C   sð   | j  ¡ }i }tƒ }|D ]Î}|  |¡}|  ||¡rl|  ||¡\}}	|sN||= n|	r\| |¡ |  |||¡ qd| ||< d}
|| rˆd}
zt|d| ƒ}W n6 t	yÐ   t|d| ƒ}| j
|||
|ddd� Y q0 | j
|||
|dd� q||fS )NÚGetztvtk_base.false_bool_traitútvtk_base.true_bool_traitÚSetT)ÚmappedÚbroken_bool©r‰   )rA   Zget_toggle_methodsr(   Ú_reform_nameÚ_is_specialÚ _get_special_updateable_failableÚaddÚ_write_special_traitÚgetattrÚAttributeErrorÚ_write_trait)rE   r^   rP   ÚmethsÚupdateable_traitsrf   ÚmrS   Ú
updateableÚcan_failÚt_defr;   r:   r   r   r   rn     s<    

ÿ
ÿÿz$WrapperGenerator._gen_toggle_methodsc                 C   sˆ  | j }| j}| ¡ }i }|D �]d}|  |¡}d| ||< i }	d}
|| D ]&\}}||	|  |¡< t|tjƒrHd}
qH|jdkrˆ|dkrˆd}
n^|jdkr |dkr d}
nF|jdkr¸|d	kr¸d}
n.|jd
krÐ|dkrÐd}
n|jdkræ|dkræd}
t|d| ƒsød}
|
dk�r|dv �rd}
d }|
dk�r8|jdk�r8|dk�r8d}|
dk�rf|jdk�rf|dk�rft	t
ddƒƒ}|
dk�rŠ|jdk�rŠ|dk�rŠd}|
dk�r®|jdk�r®|dk�r®d}tjdk�rÞ|
dk�rÞ|jdk�rÞ|dk�rÞd}|
�s,|  || d d ¡}|d u �rd tƒ  }nt|d!ƒ�r,t|ƒdd… }t|d| ƒ�s@d}
|
dk�rX|dv �rXd}
d }|
dk�r‚|jdk�r‚|dk�r‚d}nÒ|
dk�r¨|jd"k�r¨|d#k�r¨d}n¬|
dk�rØ|jdk�rØ|dk�rØt	t
ddƒƒ}n||
dk�rþ|jdk�rþ|dk�rþd}nV|
dk�r$|jdk�r$|dk�r$d}n0tjdk�rT|
dk�rT|jdk�rT|dk�rTd}|
�sÜ|  || d d ¡}|d u �r†d tƒ  }n2t|d!ƒ�r®t|ƒdd… }d$tƒ  }n
d$tƒ  }t|d| ƒ}| j||||d%d&� q||= t|d| ƒ}|  |||¡ |
dk�r$t|d| ƒ}|  |||¡ || dd … D ]L\}}|  |¡}t|d'||f ƒ}d(||f }d)tƒ  }|  ||||¡ �q4q|S )*Nr†   r   r   ZvtkCellQualityZQualityMeasureZvtkRenderViewZInteractionModeZvtkMatrixMathFilterZ	OperationZvtkResliceImageViewerZResliceModeZaxis_alignedZvtkThresholdZPointsDataTypeé
   rˆ   )ZDataScalarTypeZOutputScalarTypeZUpdateExtenté   ZvtkGenericEnSightReaderZ	ByteOrderZvtkImageDataZ
ScalarTypeé   ZvtkImagePlaneWidgetZPlaneOrientationr   ZAttributeModeéÿÿÿÿÚdarwinZvtkRenderWindowZ
StereoTypez:tvtk_base.RevPrefixMap(%(d)s, default_value='%(default)s')Ú__iter__Z!vtkPolyDataEdgeConnectivityFilterZRegionGrowingzItvtk_base.RevPrefixMap(%(d)s, %(extra_val)s, default_value='%(default)s')Tr‹   z	Set%sTo%szdef set_%s_to_%s(self):z"self._vtk_obj.Set%(m)sTo%(key)s()
)rA   r@   Zget_state_methodsrŒ   Ú
isinstanceÚvtkrQ   r*   Úhasattrr&   Úranger+   r,   r[   r$   r‘   r“   Ú_write_tvtk_methodÚ_write_generic_method)rE   r^   rP   rA   r@   r”   r•   r–   rS   rh   Zvtk_valr   ÚvalZ	extra_valr<   r™   r;   Úvtk_methrU   rb   Úbodyr   r   r   ro   A  sø    


ÿ
ÿ
ÿ
ÿ
ÿÿÿÿÿÿþ
ÿ
ÿþÿÿÿÿþ

ÿ


z#WrapperGenerator._gen_state_methodsc                 C   sî  | j }| ¡ }i }tƒ }|D �]Æ}|  |¡}d| ||< t|d| ƒ}	t|d| ƒ}
| |
¡}| |	¡}|  ||¡r®|  ||¡\}}|s�||= n|rž| |¡ |  	|||¡ q|| sâ|d d râ|  
|||
|¡ |  
|||	¡ q|| rø|| \}}nt|
|	d ƒd  }}|�r |  |||¡ qt|tƒ�rŒ| d¡�rŒz|  |||¡ W n8 t�y‚ } ztdt|ƒƒ d }W Y d }~nd }~0 0 ||= q|d u �s¤t|tjƒ�rÎt|ƒdk�r¾d gd fg}t|ƒdk�rèd gd gfg}d gd fg}nB|d d d u �s|d d dk�r*t|d ƒ|d< d g|d d< |d d d dk�rl|d d d u �rld	}| j||||	d
d� n`|d d d u �r¦t|d d ƒdk�r¦|  |||
|	¡ n |  
|||
|¡ |  
|||	|¡ ||= qt|tƒ�rPt|ƒdk�rP| d¡dk�s| d¡dk�s| d¡dk�rPd}|jdv �r,d}dj|d�}| j||||	d
|d� qzt|dd
d�\}}}W nD t�y¬   td|j dd� td| ƒ td| ƒ ||= Y q0 |�rÄd |||¡}nd ||¡}| j||||	d
d� q||fS ) Nr†   rˆ   r   r   Z_p_voidzWarning:r   r4   zGtraits.Trait(None, None, traits.String(enter_set=True, auto_set=False))Fr‹   r   Úcolorr�   Z
bond_colorZ
backgroundÚFalse)rƒ   ZvtkLightÚTruez$tvtk_base.vtk_color_trait({default})©r<   ©r‰   Úforce_updateT)Z	enter_setZauto_setz%s:ú )ÚendzIgnoring method: Get/Set%szdefault: %s, range: Nonez{0}({1}, {2})z{0}({1}))rA   Úget_get_set_methodsr(   rŒ   r‘   r6   r�   rŽ   r�   r�   r¤   r>   Ú_write_trait_with_ranger    r$   ÚendswithÚ#_write_trait_with_default_undefinedr0   Úprintr¡   rQ   r'   r&   r“   Ú_write_propertyr%   Úfindr*   r   r3   )rE   r^   rP   rA   r”   r•   rf   Úvtk_attr_namerS   r;   r:   Úget_sigÚset_sigr—   r˜   r<   ÚrngÚ	exceptionr™   ÚforceÚ
trait_typer1   r   r   r   rp   È  sÂ    



ÿ

ÿÿ$(ÿ(
ÿÿÿþÿþÿÿz%WrapperGenerator._gen_get_set_methodsc                 C   s  | j }| ¡ }|D ]ð}t||ƒ}|dkr:| j||dd� q|dkrP|  ||¡ q|dkrf|  ||¡ q|  |dd … ¡}| |¡}d}	d}
t|ƒdkr°|d	 d d u r°d}	d}
n*t|ƒdkrÚ|D ]}|d d u rÀd}	 qÚqÀ|	rî|  	|||d ¡ |
r|  
||||¡ qd S )
NÚ	GetOutputF©r(   ÚGetInputÚGetOutputPortr   Tr   r   )rA   Zget_get_methodsr‘   Ú_write_get_output_methodÚ_write_pure_get_input_methodÚ"_write_pure_get_output_port_methodrŒ   r6   r'   r¶   r¤   )rE   r^   rP   rA   r”   r–   r:   rS   r=   Z
write_propZwrite_getterr   r   r   r   rr   z  s4    

z!WrapperGenerator._gen_get_methodsc                 C   s4   | j }| ¡ }|D ]}t||ƒ}|  |||¡ qd S r   )rA   Zget_other_methodsr‘   r¤   )rE   r^   rP   rA   r”   r–   r§   r   r   r   rs   œ  s
    
z#WrapperGenerator._gen_other_methodsFc                 C   s>   |dkrdS |  ¡ r|r|S t|ƒ}t |¡r6|d S |S dS )z|Converts a VTK name to an Enthought style one.  If `method`
        is True it does not touch names that are all upper case.ZTeXZtexÚ_N)Úisupperr   ÚkeywordÚ	iskeyword)rE   rS   ÚmethodÚresr   r   r   rŒ   ¨  s    
zWrapperGenerator._reform_namec                 C   s0   g }t |ƒttfv r"dd„ |D ƒS t|jƒS dS )z5Returns renamed VTK classes as per TVTK naming style.c                 S   s   g | ]}t |jƒ‘qS r   )r   r*   rT   r   r   r   rV   ¾  s   ÿz4WrapperGenerator._get_class_name.<locals>.<listcomp>N)r   r&   r%   r   r*   )rE   ZklassesÚretr   r   r   rX   º  s    ÿz WrapperGenerator._get_class_namec                 C   sH   g d¢}t |ƒ}| d¡dkr@|D ]}| |¡dkr" dS q"dS dS dS )aE  Given `val` which is extracted from the method call
        signature, this returns the type of the value.  Right now this
        is in ['vtk', 'array', 'basic'].  'vtk' refers to a VTK type,
        'array' to a vtkDataArray/vtkCellArray/vtkPoints/vtkIdList,
        'basic' refers to a non-VTK, basic Python type.
        )ÚArrayZ	vtkPointsZ	vtkIdListr¡   r�   ÚarrayÚbasicN)rx   r·   )rE   r¦   Z
_arr_typesÚsr   r   r   r   Ú
_find_typeÃ  s    zWrapperGenerator._find_typec                 C   s8   t |ƒdkr |d d du r dS dd„ |D ƒ}|  |¡S )zçGiven a method signature `sig`, this finds the argument
        types.  It uses the `_find_type` method to obtain its result.
        If no arguments are present in *all* of the signatures, then
        it returns `None`.

        r   r   Nc                 S   s   g | ]}|d  ‘qS ©r   r   ©r   rÐ   r   r   r   rV   Þ  r   z3WrapperGenerator._find_arg_type.<locals>.<listcomp>)r'   rÑ   )rE   r=   Úargsr   r   r   Ú_find_arg_typeÔ  s
    zWrapperGenerator._find_arg_typec                 C   s   dd„ |D ƒ}|   |¡S )zMGiven a method signature `sig`, this finds the return
        types.
        c                 S   s   g | ]}|d  ‘qS )r   r   rÓ   r   r   r   rV   å  r   z6WrapperGenerator._find_return_type.<locals>.<listcomp>)rÑ   )rE   r=   Zretsr   r   r   Ú_find_return_typeá  s    z"WrapperGenerator._find_return_typec                 C   s   |   |¡|  |¡fS )z¹Given a method signature `sig`, this finds the return and
        argument types using.  This is a convenience type and returns
        a tuple containing (ret_type, arg_type).
        )rÖ   rÕ   ©rE   r=   r   r   r   Ú_find_sig_typeè  s    zWrapperGenerator._find_sig_typec                 C   s   dd„ |D ƒS )zcReturns a list of argument signatures from the signature
        information for a method.
        c                 S   s   g | ]}|d  ‘qS rÒ   r   rÓ   r   r   r   rV   ó  r   z8WrapperGenerator._find_array_arg_sig.<locals>.<listcomp>r   r×   r   r   r   Ú_find_array_arg_sigï  s    z$WrapperGenerator._find_array_arg_sigc                 C   s®   t |dƒ}| j |¡}d}|r*dtƒ  }n
dtƒ  }| | j |¡¡ t|ƒdkr\d}d}	nd}d	}	|  ||||	¡ |rªd
}d}	|	d7 }	|	d7 }	t |dƒ}
|  |||
|	¡ dS )a  Write the get_output method.  This method is special and
        needs special care.  `klass` is the class for which the method
        is being wrapped, `out` is the output file.  If `set` is True,
        a set_output method is also wrapped.  This defaults to False.
        r¿   z9Output of this source, i.e. the result of `get_output()`.aÃ  
            def _get_output(self):
                return wrap_vtk(self._vtk_obj.GetOutput())

            def _set_output(self, obj):
                old_val = self._get_output()
                self._wrap_call(self._vtk_obj.SetOutput, deref_vtk(obj))
                self.trait_property_changed('output', old_val, obj)
            output = traits.Property(_get_output, _set_output,
                                     desc="%(doc)s")

            zÓ
            def _get_output(self):
                return wrap_vtk(self._vtk_obj.GetOutput())
            output = traits.Property(_get_output,
                                     desc="%(doc)s")

            r   zdef get_output(self):z*return wrap_vtk(self._vtk_obj.GetOutput())zdef get_output(self, idx=None):z´
            if idx is None:
                return wrap_vtk(self._vtk_obj.GetOutput())
            else:
                return wrap_vtk(self._vtk_obj.GetOutput(idx))
            zdef set_output(self, obj):zold_val = self._get_output()
z9self._wrap_call(self._vtk_obj.SetOutput, deref_vtk(obj))
z4self.trait_property_changed('output', old_val, obj)
Z	SetOutputN)	r‘   rA   r6   r[   rN   r@   r   r'   r¥   )rE   r^   rP   r(   r:   r=   ÚdocÚ	trait_defrb   r¨   r;   r   r   r   rÃ   ù  s4    
õú
ÿz)WrapperGenerator._write_get_output_methodc                 C   s€   t |dƒ}t |dƒ}| j |¡}t|ƒdkrld}dtƒ  }| | j |¡¡ |  |||¡ |  ||||¡ n|  	|d||¡ dS )z±Write the set/get_source method.  This method needs special
        care.  `klass` is the class for which the method is being
        wrapped, `out` is the output file.
        Z	GetSourceZ	SetSourcer   zDThe first source of this object, i.e. the result of `get_source(0)`.aÄ  
            def _get_source(self):
                return wrap_vtk(self._vtk_obj.GetSource(0))

            def _set_source(self, obj):
                old_val = self._get_source()
                self._wrap_call(self._vtk_obj.SetSource, deref_vtk(obj))
                self.trait_property_changed('source', old_val, obj)
            source = traits.Property(_get_source, _set_source,
                                     desc="%(doc)s")

            ÚsourceN©
r‘   rA   r6   r'   r[   rN   r@   r   r¤   r¶   ©rE   r^   rP   r:   r;   rº   rÚ   rÛ   r   r   r   Ú_write_get_source_method2  s    

õz)WrapperGenerator._write_get_source_methodc                 C   sr   t |dƒ}dtƒ  }| j}| | |¡¡ d}| | |¡¡ |j}| j |||¡ | | d¡¡ | d¡ dS )zÇHandle the GetOutputPort method so that it does not print
        unnecessary warning messages.  `klass` is the class for which
        the method is being wrapped, `out` is the output file.
        rÂ   zÑ
        def _get_output_port(self):
            if self._vtk_obj.GetNumberOfOutputPorts():
                return wrap_vtk(self._vtk_obj.GetOutputPort())
            else:
                return None
        z6output_port = traits.Property(_get_output_port, desc=\ú)rH   N)r‘   r[   r@   rN   r   r\   rC   Úwrite_trait_doc)rE   r^   rP   r:   r™   r@   rÚ   r   r   r   rÅ   P  s    
úz3WrapperGenerator._write_pure_get_output_port_methodc                 C   sf   t |dƒ}| j |¡}t|ƒdkrRd}dtƒ  }| | j |¡¡ |  |||¡ n|  	|d|d¡ dS )z¼Write the get_input method when the class only has the
        getter and no setter.  `klass` is the class for which the
        method is being wrapped, `out` is the output file.
        rÁ   r   úBThe first input of this object, i.e. the result of `get_input(0)`.aH  
            def _get_input(self):
                try:
                    return wrap_vtk(self._vtk_obj.GetInput(0))
                except TypeError:
                    return wrap_vtk(self._vtk_obj.GetInput())
            input = traits.Property(_get_input,
                                    desc="%(doc)s")

            ÚinputNrÝ   )rE   r^   rP   r:   r¹   rÚ   rÛ   r   r   r   rÄ   g  s    
	÷
z-WrapperGenerator._write_pure_get_input_methodc                 C   s€   t |dƒ}t |dƒ}| j |¡}t|ƒdkrld}dtƒ  }| | j |¡¡ |  |||¡ |  ||||¡ n|  	|d||¡ dS )z°Write the set/get_input method.  This method needs special
        care.  `klass` is the class for which the method is being
        wrapped, `out` is the output file.
        rÁ   ZSetInputr   râ   a3  
            def _get_input(self):
                try:
                    return wrap_vtk(self._vtk_obj.GetInput(0))
                except TypeError:
                    return wrap_vtk(self._vtk_obj.GetInput())

            def _set_input(self, obj):
                old_val = self._get_input()
                self._wrap_call(self._vtk_obj.SetInput, deref_vtk(obj))
                self.trait_property_changed('input', old_val, obj)
            input = traits.Property(_get_input, _set_input,
                                    desc="%(doc)s")

            rã   NrÝ   rÞ   r   r   r   Ú_write_get_input_method�  s    

òz(WrapperGenerator._write_get_input_methodc                 C   sT   t |dƒ}t |dƒ}d}dtƒ  }| | j |¡¡ |  |||¡ |  |||¡ dS )zõWrite the set/get_input_connection method.  This method
        needs needs to be wrapped as a property and a method for
        convenience.  `klass` is the class for which the method is
        being wrapped, `out` is the output file.
        ZGetInputConnectionZSetInputConnectionz\The first input connection for this object, i.e. the result of `get_input_connection(0, 0)`.a£  
        def _get_input_connection(self):
            if self._vtk_obj.GetTotalNumberOfInputConnections():
                return wrap_vtk(self._vtk_obj.GetInputConnection(0, 0))
            else:
                return None

        def _set_input_connection(self, obj):
            old_val = self._get_input_connection()
            self._wrap_call(self._vtk_obj.SetInputConnection, deref_vtk(obj))
            self.trait_property_changed('input_connection', old_val, obj)
        input_connection = traits.Property(_get_input_connection,
                                           _set_input_connection,
                                           desc="%(doc)s")

        N)r‘   r[   rN   r@   r   r¤   )rE   r^   rP   r:   r;   rÚ   rÛ   r   r   r   Ú"_write_get_input_connection_method¢  s    

ñz3WrapperGenerator._write_get_input_connection_methodNc                 C   sl  |du r| j  |¡}|du r dS |  |¡\}}|j}| j|dd�}t |¡rT|d }|dv }	|dv ol|jdv }
|du rÆd| }d	}|	rŽ|d
7 }|dv r¤|d| 7 }n|d| 7 }|	r¼|d7 }|d7 }n’d| }|dk�rd	}|	rè|d
7 }|d| 7 }|	�r<|d7 }n8|dk�r4|  |¡}d||f }|
�r<|d7 }nd| }|dv �rP|d7 }n|d7 }|  ||||¡ dS )a†  Write a generic tvtk_method to `out`.

        Parameters
        ----------

        - out : file like object

        - vtk_meth : VTK method

          The VTK method to wrap.  A docstring is extracted from
          this.

        - sig : Signature of vtk_method (default: None)

          If None, this is computed.  If not, the passed signature
          information is used.
        NT)rÊ   rÆ   )ZAddInputZRemoveInputZRemoveAllInputsZSetInputByNumber)ZInsertNextCell)ZvtkCellArrayzdef %s(self):r   zold_val = self._get_input()
©r¡   rÎ   z#ret = wrap_vtk(self._vtk_obj.%s())
zret = self._vtk_obj.%s()
zAself.trait_property_changed('input', old_val, self._get_input())
zreturn ret

zdef %s(self, *args):r¡   zYmy_args = [deref_vtk(x) for x in args]
ret = self._wrap_call(self._vtk_obj.%s, *my_args)
rÎ   zRmy_args = deref_array(args, %s)
ret = self._wrap_call(self._vtk_obj.%s, *my_args)
zself.update_traits()
z/ret = self._wrap_call(self._vtk_obj.%s, *args)
zreturn wrap_vtk(ret)
zreturn ret
)	rA   r6   rØ   r*   rŒ   rÈ   rÉ   rÙ   r¥   )rE   r^   rP   r§   r=   Úret_typeÚarg_typeÚ
vtk_m_namerS   Zmethod_affects_inputZmethod_needs_updaterb   r¨   Úarr_sigr   r   r   r¤   À  sh    
ÿÿÿ

þ


þ
ÿ

z#WrapperGenerator._write_tvtk_methodc                 C   sŒ   t |ƒtu r|}n| j |j¡}| j}| | |¡¡ | ¡  | 	dd¡}|rf| | d| d ¡¡ | | |¡¡ | d¡ | 
¡  dS )a‰  Write out a method given the declaration, `decl`, the VTK
        method, `vtk_doc_meth`, from which the docstring is to be
        extracted and the code body, `body`.  Each of these is set as
        per the current indentation level.  output is written to the
        `out` object.

        `vtk_doc_meth` could also be a string, in which case the
        string is used directly.

        ú\z\\z"""
rH   N)r   r$   rC   Zget_method_docr\   r@   rN   r   r]   Úreplacer|   )rE   rP   rb   Zvtk_doc_methr¨   rÚ   r@   r   r   r   r¥     s    
z&WrapperGenerator._write_generic_methodc                 C   s  d| }|j }	d}
|rd}
d}|dur.d| }| d¡rJ|dd… d }n|d	7 }d
tƒ  }|r¨d}|	dd… dks|J |ƒ‚|	dd… d }|	dd… d }dtƒ  }n
dtƒ  }| j}| | |¡¡ |j}| j |||¡ | | d¡¡ | d¡ | | |¡¡ | d¡ dS )a‡  Write out a complete trait definition to `out`.

        Parameters
        ----------
        - out : File like object.

        - t_name : `string`: Name of the trait.

        - t_def : `string` : Trait definition.

        - vtk_set_meth : VTK setter method.

        - mapped : `bool` : Specifies if the trait is mapped.

        - force_update : `string` or `None` : force_update argument.

        - broken_bool : `bool` (default: `False`)

          If `True` the bool method does not have a 'Set' method and
          must be handled specially.  In this case make sure that the
          vtk_set_meth points to the 'Get' method.

        z_%s_changedr   rÆ   Nz, %srà   r�   z, desc=\z(desc=\ú%(t_name)s = %(t_def)szCIf broken_bool is true, make sure vtk_set_meth is of form 'GetProp'r   r†   ZOnZOffaf  
            def %(changed)s(self, old_val, new_val):
                def _bool_change(val, obj=self._vtk_obj):
                    if val:
                        obj.%(vtk_on_name)s()
                    else:
                        obj.%(vtk_off_name)s()
                self._do_change(_bool_change, self.%(t_name)s%(map_str)s%(force_str)s)
            zÉ
            def %(changed)s(self, old_val, new_val):
                self._do_change(self._vtk_obj.%(vtk_m_name)s,
                                self.%(t_name)s%(map_str)s%(force_str)s)
            rH   )	r*   r³   r[   r@   rN   r   r\   rC   rá   )rE   rP   Út_namer™   r;   r‰   r®   rŠ   Úchangedré   Zmap_strZ	force_strrÛ   ÚmsgZvtk_on_nameZvtk_off_nameZchanged_defr@   rÚ   r   r   r   r“   2  s>    

ø
ü
zWrapperGenerator._write_traitc                 C   st  | j }d| }|j}| j |¡}	|  |	¡}
|
dv r>dtƒ  }n
dtƒ  }| | |¡¡ |�rd| }|j}| j |¡}	|  |	¡}|rÄ|dkršdtƒ  }n(|dkr¸|  	|	¡}d	tƒ  }n
d
tƒ  }n<|dkrØdtƒ  }n(|dkrö|  	|	¡}dtƒ  }n
dtƒ  }| | |¡¡ dtƒ  }n
dtƒ  }dtƒ  }| | |¡¡ |j
}| j |||¡ | | d¡¡ | d¡ dS )a�  Writes out a traited property to `out` given the trait
        name, `t_name`, the VTK get method, `vtk_get_meth` an optional
        VTK set method for read-write traits as, `vtk_set_meth` plus a
        boolean value for `multi_arg`.  If `multi_arg` is True, the
        setter is treated as if it accepts a list of parameters.  If
        not the setter is treated as if it accepts a single parameter.
        z_get_%sræ   zq
            def %(getter)s(self):
                return wrap_vtk(self._vtk_obj.%(vtk_get_name)s())
            zg
            def %(getter)s(self):
                return self._vtk_obj.%(vtk_get_name)s()
            z_set_%sr¡   a„  
                    def %(setter)s(self, *args):
                        old_val = self.%(getter)s()
                        my_args = [deref_vtk(x) for x in args]
                        self._wrap_call(self._vtk_obj.%(vtk_set_name)s,
                                        *my_args)
                        self.trait_property_changed('%(t_name)s', old_val, args)
                    rÎ   a†  
                    def %(setter)s(self, *args):
                        old_val = self.%(getter)s()
                        my_args = deref_array(args, %(arr_sig)s)
                        self._wrap_call(self._vtk_obj.%(vtk_set_name)s,
                                        *my_args)
                        self.trait_property_changed('%(t_name)s', old_val, args)
                    aB  
                    def %(setter)s(self, *args):
                        old_val = self.%(getter)s()
                        self._wrap_call(self._vtk_obj.%(vtk_set_name)s,
                                        *args)
                        self.trait_property_changed('%(t_name)s', old_val, args)
                    aH  
                    def %(setter)s(self, arg):
                        old_val = self.%(getter)s()
                        self._wrap_call(self._vtk_obj.%(vtk_set_name)s,
                                        deref_vtk(arg))
                        self.trait_property_changed('%(t_name)s', old_val, arg)
                    a„  
                    def %(setter)s(self, arg):
                        old_val = self.%(getter)s()
                        my_arg = deref_array([arg], %(arr_sig)s)
                        self._wrap_call(self._vtk_obj.%(vtk_set_name)s,
                                        my_arg[0])
                        self.trait_property_changed('%(t_name)s', old_val, arg)
                    a=  
                    def %(setter)s(self, arg):
                        old_val = self.%(getter)s()
                        self._wrap_call(self._vtk_obj.%(vtk_set_name)s,
                                        arg)
                        self.trait_property_changed('%(t_name)s', old_val, arg)
                    z.traits.Property(%(getter)s, %(setter)s, desc=\z"traits.Property(%(getter)s, desc=\rí   rà   rH   N)r@   r*   rA   r6   rÖ   r[   rN   r   rÕ   rÙ   r\   rC   rá   )rE   rP   rî   r:   r;   Z	multi_argr@   ÚgetterZvtk_get_namer=   rç   rÛ   ÚsetterZvtk_set_namerè   rê   r™   rÚ   r   r   r   r¶   ~  sh    	
ýý
ù
ù
úú
ù
ú

z WrapperGenerator._write_propertyc                 C   s²   |   |¡}t|d| ƒ}t|d| ƒ}t||d ƒ}|r˜t|ƒttfv r`d d dt|ƒ ¡¡}nd}t	|ƒ\}	}
}dj||	|d�}| j
||||d	d
� nd}t| |j|¡ƒ‚d S )Nr†   rˆ   z({})r
   )útraits.Undefinedró   zOtraits.Trait({default}, {trait_type}({kwargs}), enter_set=True, auto_set=False))r<   r¾   r1   Fr‹   z+We cannot determine the trait type of {}.{})rŒ   r‘   r>   r   r%   r&   r   r!   r'   r3   r“   r0   r*   )rE   r^   rP   r¸   rS   r:   r;   Zvalue_for_typer<   r¾   rÆ   r1   r™   Úmessager   r   r   r´   ä  s&    

ÿûz4WrapperGenerator._write_trait_with_default_undefinedc           	      C   s  | j  ¡ | \}}|d us6J d|j d¡d |f ƒ‚||d k r^|d | dk r^||d f}||d kr†||d  dk r†|d |f}||d k sž||d krºdtƒ  }|d d… d }nd	tƒ  }|d d… d }|  |¡}t|d
| ƒ}| j||||dd� d S )Nz'add to vtk_parser exception list: %r %rÚ.r�   r   r›   r   z:traits.Trait(%(default)s, %(default)s, traits.Range%(rng)sz", enter_set=True, auto_set=False))z-traits.Trait(%(default)s, traits.Range%(rng)srˆ   Fr‹   )rA   r±   r*   Úsplitr[   rŒ   r‘   r“   ©	rE   r^   rP   r¸   r<   r»   r™   rS   r;   r   r   r   r²     s0    ÿÿÿÿ
ÿz(WrapperGenerator._write_trait_with_range)FFÚ_write_any_output)FFÚ_write_any_source)FFÚ_write_any_scalar_type)FFÚ_write_any_input)FFÚ_write_any_input_connection)TFÚ_write_any_something_file_name)TFÚ _write_any_something_file_prefix)TFÚ _write_image_reader2_header_size)TTÚ)_write_hardware_selector_prop_color_value)TTÚ._write_axes_transform_representation_tolerance)TTÚ_write_span_space_resolution)TTÚ+_write_smart_volume_mapper_vector_component)TTÚ0_write_hyper_tree_grid_cell_centers_vertex_cells)TTÚ*_write_euclidean_cluster_extraction_radius)TTÚ,_write_line_integral_conv_2d_max_noise_value)z[a-zA-Z0-9]+\.Output$z[a-zA-Z0-9]+\.Source$z[a-zA-Z0-9]+\.ScalarType$z[a-zA-Z0-9]+\.Input$z[a-zA-Z0-9]+\.InputConnection$z[a-zA-Z0-9\.]+FileName$z[a-zA-Z0-9\.]+FilePrefix$zvtkImageReader2.HeaderSize$z#vtkHardwareSelector.PropColorValue$z)vtkAxesTransformRepresentation.Tolerance$zvtkSpanSpace.Resolution$z%vtkSmartVolumeMapper.VectorComponent$z(vtkHyperTreeGridCellCenters.VertexCells$z%vtkEuclideanClusterExtraction.Radius$z+vtkLineIntegralConvolution2D.MaxNoiseValue$c                 C   s8   d  |j|f¡}| j ¡ D ]}t ||¡r|  S qdS )aX   Return the key in `special_traits` that matches klass.vtk_attr_name
        using regular expression

        Parameters
        ----------
        klass : class
           VTK class

        vtk_attr_name : str
           VTK class attribute name

        Returns
        -------
        key
           key is None if nothing matches
        rõ   N)r!   r*   Úspecial_traitsri   ÚreÚmatch)Úclsr^   r¸   Ú	full_nameZre_exprr   r   r   Ú_get_special_matched_keyu  s
    
z)WrapperGenerator._get_special_matched_keyc                 C   s<   |   ||¡}|du r*d}t| |j|¡ƒ‚| j| dd… S )aa   Return (updateable, failable) for the klass.vtk_attr_name

        Parameters
        ----------
        klass : class
           VTK class

        vtk_attr_name : str
           VTK class attribute name

        Raises
        ------
        ValueError
           if klass.vtk_attr_name does not match anything in
           `special_traits`
        Nz7{0}.{1} does not have a special method for get/set coder›   )r  Ú
ValueErrorr   r*   r  )r
  r^   r¸   r   rô   r   r   r   rŽ   Ž  s
    z1WrapperGenerator._get_special_updateable_failablec                 C   s,   d  |j|f¡}t d  | j ¡ ¡|¡duS )a   Returns True if klass.vtk_attr_name matches anything
        in `special_traits`

        Parameters
        ----------
        klass : class
           VTK class

        vtk_attr_name : str
           VTK class attribute name

        Returns
        -------
        boolean
        rõ   ú|N)r!   r*   r  r	  r  ri   )r
  r^   r¸   r  r   r   r   r�   ¨  s    ÿÿzWrapperGenerator._is_specialc                 C   s2   |   ||¡}| j| \}}}t| |ƒ|||ƒ d S r   )r  r  r‘   )rE   r^   rP   r¸   r   rÆ   Úmethod_namer   r   r   r�   ½  s    z%WrapperGenerator._write_special_traitc                 C   s   | j ||dd� d S )NTrÀ   )rÃ   ©rE   r^   rP   r¸   r   r   r   rø   Â  s    z"WrapperGenerator._write_any_outputc                 C   s   |   ||¡ d S r   )rß   r  r   r   r   rù   Å  s    z"WrapperGenerator._write_any_sourcec                 C   s   dS )z This method does nothing Nr   r  r   r   r   rú   È  s    z'WrapperGenerator._write_any_scalar_typec                 C   s   |   ||¡ d S r   )rä   r  r   r   r   rû   Ì  s    z!WrapperGenerator._write_any_inputc                 C   s   |   ||¡ d S r   )rå   r  r   r   r   rü   Ï  s    z,WrapperGenerator._write_any_input_connectionc                 C   s4   |   |¡}t|d| ƒ}d}| j||||dd� d S )Nrˆ   ztvtk_base.vtk_file_name("")Fr‹   ©rŒ   r‘   r“   ©rE   r^   rP   r¸   rS   r;   r™   r   r   r   rý   Ò  s    
z/WrapperGenerator._write_any_something_file_namec                 C   s4   |   |¡}t|d| ƒ}d}| j||||dd� d S )Nrˆ   ztvtk_base.vtk_file_prefix("")Fr‹   r  r  r   r   r   rþ   Ù  s    
z1WrapperGenerator._write_any_something_file_prefixc           	      C   s^   |dkrt dƒ‚| j ¡ | \}}dj|d�}|  |¡}t|d| ƒ}| j||||dd� d S )NZ
HeaderSizezDNot sure why you ask for me! I only deal with HeaderSize. Panicking.z5traits.Int({default}, enter_set=True, auto_set=False)r¬   rˆ   Fr‹   ©ÚRuntimeErrorrA   r±   r   rŒ   r‘   r“   )	rE   r^   rP   r¸   r<   rÆ   r™   rS   r;   r   r   r   rÿ   ß  s    ÿ
z1WrapperGenerator._write_image_reader2_header_sizec                 C   sF   |dkrt dƒ‚d}|  |¡}t|d| ƒ}| j||||ddd� d S )NZPropColorValuezHNot sure why you ask for me! I only deal with PropColorValue. Panicking.z*tvtk_base.vtk_color_trait((1.0, 1.0, 1.0))rˆ   Frª   r­   )r  rŒ   r‘   r“   )rE   r^   rP   r¸   r™   rS   r;   r   r   r   r   ò  s    
ÿz:WrapperGenerator._write_hardware_selector_prop_color_valuec           	      C   s`   |dkrt dƒ‚| j ¡ | \}}dj||d�}|  |¡}t|d| ƒ}| j||||dd� d S )NZ	TolerancezCNot sure why you ask for me! I only deal with Tolerance. Panicking.úJtraits.Trait({default}, traits.Range{rng}, enter_set=True, auto_set=False)©r<   r»   rˆ   Fr‹   r  r÷   r   r   r   r    s    þ
z?WrapperGenerator._write_axes_transform_representation_tolerancec           
      C   s|   |dkrt dƒ‚| j ¡ | \}}tdkr>d}t|ƒ |d }dj||d�}|  |¡}t|d| ƒ}	| j||||	d	d
� d S )NZVectorComponentzINot sure why you ask for me! I only deal with VectorComponent. Panicking.é   zbvtkSmartVolumeMapper: VectorComponent not updatable (VTK 8.x bug - value not properly initialized)r   r  r  rˆ   Fr‹   ©	r  rA   r±   r   rµ   r   rŒ   r‘   r“   ©
rE   r^   rP   r¸   r<   r»   rô   r™   rS   r;   r   r   r   r    s    þ
z<WrapperGenerator._write_smart_volume_mapper_vector_componentc           
      C   s|   |dkrt dƒ‚| j ¡ | \}}tdkr>d}t|ƒ |d }dj||d�}|  |¡}t|d| ƒ}	| j||||	d	d
� d S )NZ
ResolutionzDNot sure why you ask for me! I only deal with Resolution. Panicking.é   zUvtkSpanSpace: Resolution not updatable (VTK 7.x bug - value not properly initialized)r   r  r  rˆ   Fr‹   r  r  r   r   r   r  ,  s    þ
z-WrapperGenerator._write_span_space_resolutionc                 C   sX   |dkrt dƒ‚tdkr$d}t|ƒ d}|  |¡}t|d| ƒ}| j||||dd� d S )	NZVertexCellszENot sure why you ask for me! I only deal with VertexCells. Panicking.r  zevtkHyperTreeGridCellCenters: VertexCells not updatable (VTK 8.x bug - value not properly initialized)r‡   rˆ   Fr‹   )r  r   rµ   rŒ   r‘   r“   )rE   r^   rP   r¸   rô   r™   rS   r;   r   r   r   r  A  s    
zAWrapperGenerator._write_hyper_tree_grid_cell_centers_vertex_cellsc           
      C   s|   |dkrt dƒ‚| j ¡ | \}}tdkr>d}t|ƒ |d }dj||d�}|  |¡}t|d| ƒ}	| j||||	d	d
� d S )NZRadiusz@Not sure why you ask for me! I only deal with Radius. Panicking.r  zbvtkEuclideanClusterExtraction: Radius not updatable (VTK 9.1 bug - value not properly initialized)r   r  r  rˆ   Fr‹   r  r  r   r   r   r  S  s    þ
z;WrapperGenerator._write_euclidean_cluster_extraction_radiusc           
      C   s|   |dkrt dƒ‚| j ¡ | \}}tdkr>d}t|ƒ |d }dj||d�}|  |¡}t|d| ƒ}	| j||||	d	d
� d S )NZMaxNoiseValuezGNot sure why you ask for me! I only deal with MaxNoiseValue. Panicking.é	   zhvtkLineIntegralConvolution2D: MaxNoiseValue not updatable (VTK 9.2 bug - value not properly initialized)r   r  r  rˆ   Fr‹   r  r  r   r   r   r  i  s    þ
z=WrapperGenerator._write_line_integral_conv_2d_max_noise_value)F)F)N)NF)F)8r*   Ú
__module__Ú__qualname__r\   rF   rG   rM   rJ   rK   rL   r…   rn   ro   rp   rr   rs   rŒ   rX   rÑ   rÕ   rÖ   rØ   rÙ   rÃ   rß   rÅ   rÄ   rä   rå   r¤   r¥   r“   r¶   r´   r²   r  Úclassmethodr  rŽ   r�   r�   rø   rù   rú   rû   rü   rý   rþ   rÿ   r   r  r  r  r  r  r  r   r   r   r   r?   È   s–   
#'/ /+  3"
	

9!
X ÿ
M ÿ
f 4Ç>


r?   )r\   r  r+   r¡   rv   rÈ   ry   Ú	itertoolsr   Úcommonr   r   r   r   r   r   r	   ÚfaulthandlerÚImportErrorÚenabler3   r>   r?   r   r   r   r   Ú<module>   s&   RU