a
    §ˆc  ã                   @   s�   d Z ddlmZ ddlmZmZmZmZmZm	Z	m
Z
 ddlm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dS )zo Defines the various instance descriptors used by the instance editor and
    instance editor factory classes.
é    )Úabstractmethod)ÚABCHasStrictTraitsÚStrÚAnyÚDictÚTupleÚCallableÚBoolé   )ÚAView)Úuser_name_forc                   @   sX   e Zd Zeƒ ZeZedƒZddd„Z	dd„ Z
edd„ ƒZed	d
„ ƒZdd„ Zdd„ ZdS )ÚInstanceChoiceItemFNc                 C   s   | j S )úReturns the name of the item.)Úname©ÚselfÚobject© r   ú[/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/traitsui/instance_choice.pyÚget_name/   s    zInstanceChoiceItem.get_namec                 C   s   | j S )z,Returns the view associated with the object.)Úview©r   r   r   r   Úget_view3   s    zInstanceChoiceItem.get_viewc                 C   s   dS )ú,Returns the object associated with the item.Nr   r   r   r   r   Ú
get_object7   s    zInstanceChoiceItem.get_objectc                 C   s   dS )úAIndicates whether a specified object is compatible with the item.Nr   r   r   r   r   Úis_compatible<   s    z InstanceChoiceItem.is_compatiblec                 C   s   dS )ú7Indicates whether the item can be selected by the user.Tr   r   r   r   r   Úis_selectableA   s    z InstanceChoiceItem.is_selectablec                 C   s   dS )ú2Indicates whether the item supports drag and drop.Fr   r   r   r   r   Úis_droppableE   s    zInstanceChoiceItem.is_droppable)N)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r	   Ú
is_factoryr   r   r   r   r   r   r    r   r   r   r   r       s   


r   c                   @   s4   e Zd Zeƒ ZedƒZd	dd„Zdd„ Zdd„ Z	dS )
ÚInstanceChoicer   Nc                 C   s<   | j dkr| j S t| j| jdƒ}t|tƒr.|S t| jjjƒS )r   Ú N)	r   Úgetattrr   Ú
name_traitÚ
isinstanceÚstrr   Ú	__class__r!   )r   r   r   r   r   r   r   V   s    

zInstanceChoice.get_namec                 C   s   | j S ©r   ©r   r   r   r   r   r   a   s    zInstanceChoice.get_objectc                 C   s
   || j u S ©r   r-   r   r   r   r   r   e   s    zInstanceChoice.is_compatible)N)
r!   r"   r#   r   r   r   r(   r   r   r   r   r   r   r   r%   J   s
   
r%   c                   @   s`   e Zd ZedƒZedƒZeƒ Zeƒ Z	e
eeƒZdZddd„Zdd„ Zdd	„ Zd
d„ Zdd„ ZdS )ÚInstanceFactoryChoiceFTNc                 C   sV   | j dkr| j S t|ddƒ}t|tƒr*|S tt| jƒtƒrB| j}n
|  ¡ j}t	|j
ƒS )r   r&   r   N)r   r'   r)   r*   Ú
issubclassÚtypeÚklassr   r+   r   r!   )r   r   r   r2   r   r   r   r   „   s    


zInstanceFactoryChoice.get_namec                 C   s   | j | ji | j¤ŽS r,   )r2   ÚargsÚkw_argsr   r   r   r   r   ”   s    z InstanceFactoryChoice.get_objectc                 C   s   | j S )r   )Ú	droppabler   r   r   r   r    ˜   s    z"InstanceFactoryChoice.is_droppablec                 C   s,   t t| jƒtƒrt|| jƒS t||  ¡ jƒS r.   )r0   r1   r2   r)   r   r+   r   r   r   r   r   œ   s    z#InstanceFactoryChoice.is_compatiblec                 C   s   | j S )r   )Ú
selectabler   r   r   r   r   ¢   s    z#InstanceFactoryChoice.is_selectable)N)r!   r"   r#   r	   r5   r6   r   r2   r   r3   r   r   r   r4   r$   r   r   r    r   r   r   r   r   r   r/   j   s   

r/   c                   @   s   e Zd ZdZdZdZdS )ÚInstanceDropChoiceTFN)r!   r"   r#   r5   r6   r$   r   r   r   r   r7   §   s   r7   N)Ú__doc__Úabcr   Z
traits.apir   r   r   r   r   r   r	   Z	ui_traitsr   Úhelperr   r   r%   r/   r7   r   r   r   r   Ú<module>   s   $
* =