3
8ßL]X^ ã               @   sô   d Z ddlmZ ddlZddlmZmZmZmZm	Z	m
Z
mZmZmZmZmZmZmZmZmZ ddlmZmZmZ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G dd„ deƒZG dd„ deƒZ G dd„ deƒZ!dS )z_ Defines the tree node descriptor used by the tree editor and tree editor
    factory classes.
é    )Úabsolute_importN)Ú	AdaptedToÚAdapterÚAnyÚBoolÚCallableÚDictÚEitherÚHasPrivateTraitsÚInstanceÚ	InterfaceÚisinterfaceÚListÚPropertyÚStrÚcached_property)ÚSequenceTypesÚget_resource_pathÚxgetattrÚxsetattré   )ÚAViewc                   sl  e Zd ZdZeZeZeZeZeZ	e
dƒZe
dƒZe
dƒZe
dƒZe
dƒZe
dƒZe
dƒZe
dƒZeeƒZeeƒZeeƒZedd�Zedd�ZeZeedeƒƒZeZeZ eZ!eZ"eZ#e$Z%eZ&edƒZ'edƒZ(ed	ƒZ)eZ*eZ+eZ,eZ-e.Z/‡ fd
d„Z0e1dd„ ƒZ2e1dd„ ƒZ3dd„ Z4dd„ Z5dd„ Z6dd„ Z7dd„ Z8dd„ Z9dd„ Z:dd„ Z;d d!„ Z<d"d#„ Z=d$d%„ Z>d&d'„ Z?d(d)„ Z@d*d+„ ZAd,d-„ ZBd.d/„ ZCd0d1„ ZDd2d3„ ZEd4d5„ ZFd6d7„ ZGd8d9„ ZHd:d;„ ZId<d=„ ZJdgd?d@„ZKdAdB„ ZLdCdD„ ZMdEdF„ ZNdGdH„ ZOdIdJ„ ZPdKdL„ ZQdMdN„ ZRdOdP„ ZSdQdR„ ZTdSdT„ ZUdUdV„ ZVdWdX„ ZWdYdZ„ ZXd[d\„ ZYd]d^„ ZZd_d`„ Z[dadb„ Z\dcdd„ Z]dedf„ Z^‡  Z_S )hÚTreeNodez^ Represents a tree node. Used by the tree editor and tree editor factory
        classes.
    TFÚnode_for)Z
depends_onNz<item>z<group>z<open>c                s(   t t| ƒjf |Ž | jdkr$tƒ | _d S )NÚ )Úsuperr   Ú__init__Ú	icon_pathr   )ÚselfZtraits)Ú	__class__© ú8/tmp/pip-install-5sebvq2j/traitsui/traitsui/tree_node.pyr   ±   s    
zTreeNode.__init__c             C   s   t dd„ | jD ƒƒS )Nc             S   s   g | ]}t |ƒs|‘qS r    )r   )Ú.0Úklassr    r    r!   ú
<listcomp>º   s    z0TreeNode._get_node_for_class.<locals>.<listcomp>)Útupler   )r   r    r    r!   Ú_get_node_for_class¸   s    zTreeNode._get_node_for_classc             C   s   dd„ | j D ƒS )Nc             S   s   g | ]}t |ƒr|‘qS r    )r   )r"   r#   r    r    r!   r$   ¿   s    z4TreeNode._get_node_for_interface.<locals>.<listcomp>)r   )r   r    r    r!   Ú_get_node_for_interface½   s    z TreeNode._get_node_for_interfacec             C   s
   | j dkS )z8 Returns whether this object can have children.
        r   )Úchildren)r   Úobjectr    r    r!   Úallows_childrenÈ   s    zTreeNode.allows_childrenc             C   s   t | j|ƒƒdkS )z2 Returns whether the object has children.
        r   )ÚlenÚget_children)r   r)   r    r    r!   Úhas_childrenÑ   s    zTreeNode.has_childrenc             C   s   t || jdƒS )z% Gets the object's children.
        N)Úgetattrr(   )r   r)   r    r    r!   r,   Ú   s    zTreeNode.get_childrenc             C   s   | j S )z0 Gets the object's children identifier.
        )r(   )r   r)   r    r    r!   Úget_children_idã   s    zTreeNode.get_children_idc             C   s   | j |ƒ}|j|ƒ dS )z3 Appends a child to the object's children.
        N)r,   Úappend)r   r)   Úchildr(   r    r    r!   Úappend_childì   s    
zTreeNode.append_childc             C   s   | j |ƒ}|g|||…< dS )z5 Inserts a child into the object's children.
        N)r,   )r   r)   Úindexr1   r(   r    r    r!   Úinsert_childö   s    
zTreeNode.insert_childc             C   s   dS )a}   Checks whether a specified object can be deleted.

        The following return values are possible:

        - **True** if the object should be deleted with no further prompting.
        - **False** if the object should not be deleted.
        - Anything else: Caller should take its default action (which might
          include prompting the user to confirm deletion).
        Nr    )r   r)   r    r    r!   Úconfirm_delete  s    
zTreeNode.confirm_deletec             C   s   | j |ƒ|= dS )zJ Deletes a child at a specified index from the object's children.
        N)r,   )r   r)   r3   r    r    r!   Údelete_child  s    zTreeNode.delete_childc             C   s   |j || j|dd� dS )zb Sets up or removes a listener for children being replaced on a
        specified object.
        Úfast_ui)ÚremoveÚdispatchN)Úon_trait_changer(   )r   r)   Úlistenerr8   r    r    r!   Úwhen_children_replaced  s    zTreeNode.when_children_replacedc             C   s   |j || jd |dd� dS )za Sets up or removes a listener for children being changed on a
        specified object.
        Ú_itemsr7   )r8   r9   N)r:   r(   )r   r)   r;   r8   r    r    r!   Úwhen_children_changed)  s    zTreeNode.when_children_changedc             C   sH   | j }|dd… dkr"|dd… S t||dƒ}| jdkr<|S | j||ƒS )z; Gets the label to display for a specified object.
        Nr   ú=r   )Úlabelr   Ú	formatter)r   r)   r@   r    r    r!   Ú	get_label4  s    
zTreeNode.get_labelc             C   s&   | j }|dd… dkr"t|||ƒ dS )z0 Sets the label for a specified object.
        Nr   r?   )r@   r   )r   r)   r@   Ú
label_namer    r    r!   Ú	set_labelF  s    zTreeNode.set_labelc                sp   | j }|dd… dkrld|ˆˆ f}|s@‡ ‡fdd„}|| j|< n| jj|dƒ}|dkrZdS ˆj|||dd� dS )	zb Sets up or removes a listener for the label being changed on a
        specified object.
        Nr   r?   r@   c                s   ˆ ˆ||ƒS )z2 Ensure listener gets called with correct object. r    )ÚtargetÚnameÚnew)r;   r)   r    r!   Úwrapped_listenerY  s    z5TreeNode.when_label_changed.<locals>.wrapped_listenerÚui)r8   r9   )r@   Ú_listener_cacheÚpopr:   )r   r)   r;   r8   r@   ÚmemorH   r    )r;   r)   r!   Úwhen_label_changedQ  s    
zTreeNode.when_label_changedc             C   sZ   | j }t||g ƒ}g }x>tjj| j|ƒD ]*\}}|dkrD|j|ƒ q(|j||ƒƒ q(W |S )z@ Get the labels for any columns that have been defined.
        N)Úcolumn_labelsr   ÚsixÚmovesÚzip_longestÚcolumn_formattersr0   )r   r)   ÚtraitÚlabelsÚ	formattedrA   r@   r    r    r!   Úget_column_labelsf  s    zTreeNode.get_column_labelsc                s~   | j }|dkrzd|ˆˆ f}|s8‡ ‡fdd„}|| j|< n| jj|dƒ}|dkrRdS ˆj|||dd� ˆj||d |dd� dS )	ac   Sets up or removes a listener for the column labels being changed on
        a specified object.

        This will fire when either the list is reassigned or when it is
        modified. I.e., it listens both to the trait change event and the
        trait_items change event. Implement the listener appropriately to
        handle either case.
        r   Zcolumn_labelc                s   ˆ ˆ||ƒS )z2 Ensure listener gets called with correct object. r    )rE   rF   rG   )r;   r)   r    r!   rH   …  s    z<TreeNode.when_column_labels_change.<locals>.wrapped_listenerNrI   )r8   r9   r=   )rN   rJ   rK   r:   )r   r)   r;   r8   rS   rL   rH   r    )r;   r)   r!   Úwhen_column_labels_changex  s    	
z"TreeNode.when_column_labels_changec             C   sT   | j }|dkr|S |dd… dkr.|dd… S t||dƒ}| jdkrH|S | j||ƒS )z= Gets the tooltip to display for a specified object.
        r   Nr   r?   )Útooltipr   Útooltip_formatter)r   r)   rX   r    r    r!   Úget_tooltip˜  s    
zTreeNode.get_tooltipc             C   s    | j |ƒs| jS |r| jS | jS )z2 Returns the icon for a specified object.
        )r*   Ú	icon_itemÚ	icon_openÚ
icon_group)r   r)   Úis_expandedr    r    r!   Úget_icon­  s
    
zTreeNode.get_iconc             C   s   | j S )z; Returns the path used to locate an object's icon.
        )r   )r   r)   r    r    r!   Úget_icon_path¼  s    zTreeNode.get_icon_pathc             C   s   | j S )zq Returns the name to use when adding a new object instance
            (displayed in the "New" submenu).
        )rF   )r   r)   r    r    r!   Úget_nameÆ  s    zTreeNode.get_namec             C   s   | j S )z6 Gets the view to use when editing an object.
        )Úview)r   r)   r    r    r!   Úget_viewÐ  s    zTreeNode.get_viewc             C   s   | j S )z= Returns the right-click context menu for an object.
        )Úmenu)r   r)   r    r    r!   Úget_menuÙ  s    zTreeNode.get_menuc             C   s$   | j }t|tjƒr t|||d�}|S )N)Údefault)Ú
backgroundÚ
isinstancerO   Ústring_typesr   )r   r)   rg   r    r    r!   Úget_backgroundÞ  s    zTreeNode.get_backgroundc             C   s$   | j }t|tjƒr t|||d�}|S )N)rf   )Ú
foregroundrh   rO   ri   r   )r   r)   rk   r    r    r!   Úget_foregroundä  s    zTreeNode.get_foregroundr   c             C   s   | j S )z0 Return the renderer for the object and column. )Úrenderer)r   r)   Úcolumnr    r    r!   Úget_rendererê  s    zTreeNode.get_rendererc             C   s   | j S )z? Returns whether the object's children can be renamed.
        )Úrename)r   r)   r    r    r!   Ú
can_renameò  s    zTreeNode.can_renamec             C   s   | j S )z4 Returns whether the object can be renamed.
        )Ú	rename_me)r   r)   r    r    r!   Úcan_rename_meû  s    zTreeNode.can_rename_mec             C   s   | j S )z> Returns whether the object's children can be copied.
        )Úcopy)r   r)   r    r    r!   Úcan_copy  s    zTreeNode.can_copyc             C   s   | j S )z? Returns whether the object's children can be deleted.
        )Údelete)r   r)   r    r    r!   Ú
can_delete  s    zTreeNode.can_deletec             C   s   | j S )z4 Returns whether the object can be deleted.
        )Ú	delete_me)r   r)   r    r    r!   Úcan_delete_me  s    zTreeNode.can_delete_mec             C   s   | j S )zW Returns whether the object's children can be inserted (vs.
        appended).
        )Úinsert)r   r)   r    r    r!   Ú
can_insert   s    zTreeNode.can_insertc             C   s   | j S )zW Returns whether the object's children should be automatically
        opened.
        )Ú	auto_open)r   r)   r    r    r!   Úcan_auto_open*  s    zTreeNode.can_auto_openc             C   s   | j S )zW Returns whether the object's children should be automatically
        closed.
        )Ú
auto_close)r   r)   r    r    r!   Úcan_auto_close4  s    zTreeNode.can_auto_closec             C   s   t || jƒp|j| jŽ S )zK Returns whether this is the node that handles a specified object.
        )rh   Únode_for_classÚhas_traits_interfaceÚnode_for_interface)r   r)   r    r    r!   Úis_node_for?  s    zTreeNode.is_node_forc             C   sN   | j |ƒ}| j|ƒrdS x0| jD ]&}t|ƒtkr8|d }t||ƒr dS q W dS )zB Returns whether a given object is droppable on the node.
        Tr   F)Ú
_class_forÚ
is_addableÚmoveÚtyper   Ú
issubclass)r   r)   Ú
add_objectr#   Úitemr    r    r!   Úcan_addI  s    


zTreeNode.can_addc             C   s   | j S )zF Returns the list of classes that can be added to the object.
        )Úadd)r   r)   r    r    r!   Úget_add\  s    zTreeNode.get_addc             C   s   |S )z< Returns a draggable version of a specified object.
        r    )r   r)   r    r    r!   Úget_drag_objecte  s    zTreeNode.get_drag_objectc             C   sd   | j |ƒ}| j|ƒr|S xF| jD ]<}t|ƒtkrNt||d ƒr\|d ||ƒS q t||ƒr |S q W |S )z< Returns a droppable version of a specified object.
        r   r   )r„   r…   r†   r‡   r   rˆ   )r   r)   Údropped_objectr#   rŠ   r    r    r!   Údrop_objectn  s    


zTreeNode.drop_objectc             C   s   | j dk	r| j |ƒ dS dS )z+ Handles an object being selected.
        NT)Ú	on_select)r   r)   r    r    r!   Úselect‚  s    

zTreeNode.selectc             C   s   | j dk	r| j |ƒ dS dS )z* Handles an object being clicked.
        NT)Úon_click)r   r)   r    r    r!   Úclick�  s    

zTreeNode.clickc             C   s   | j dk	r| j |ƒ dS dS )z1 Handles an object being double-clicked.
        NT)Ú	on_dclick)r   r)   r    r    r!   Údclickœ  s    

zTreeNode.dclickc             C   s   | j dk	r| j |ƒ dS dS )z, Handles an object being activated.
        NT)Úon_activated)r   r)   r    r    r!   Ú	activated©  s    

zTreeNode.activatedc             C   s6   x0| j D ]&}t|ƒtkr |d }t||ƒrdS qW dS )zL Returns whether a specified object class can be added to the node.
        r   TF)rŒ   r‡   r   rˆ   )r   r#   rŠ   r    r    r!   r…   ¶  s    
zTreeNode.is_addablec             C   s   t |tƒr|S |jS )z) Returns the class of an object.
        )rh   r‡   r   )r   r)   r    r    r!   r„   Æ  s    
zTreeNode._class_for)r   )`Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r(   r@   rN   rX   rF   r   rp   rr   rt   rv   rx   rz   r|   r~   r   r   rŒ   r†   r   r   r€   r‚   r   rA   r	   rR   rY   r‘   r“   r•   r—   r   rb   rd   r[   r]   r\   r   rg   rk   rm   r   rJ   r   r   r&   r'   r*   r-   r,   r/   r2   r4   r5   r6   r<   r>   rB   rD   rM   rV   rW   rZ   r_   r`   ra   rc   re   rj   rl   ro   rq   rs   ru   rw   ry   r{   r}   r   rƒ   r‹   r�   rŽ   r�   r’   r”   r–   r˜   r…   r„   Ú__classcell__r    r    )r   r!   r   /   s¤   

				

 

	
				



		r   c               @   s4  e 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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/d0„ Zd1d2„ Zd3d4„ Zd5d6„ Zd7d8„ Zd9d:„ Zd;d<„ Z d=d>„ Z!d?d@„ Z"dAdB„ Z#dCdD„ Z$dEdF„ Z%dGdH„ Z&dIdJ„ Z'dKS )LÚ	ITreeNodec             C   s   dS )z8 Returns whether this object can have children.
        Nr    )r   r    r    r!   r*   Õ  s    zITreeNode.allows_childrenc             C   s   dS )z2 Returns whether the object has children.
        Nr    )r   r    r    r!   r-   Ù  s    zITreeNode.has_childrenc             C   s   dS )z% Gets the object's children.
        Nr    )r   r    r    r!   r,   Ý  s    zITreeNode.get_childrenc             C   s   dS )z0 Gets the object's children identifier.
        Nr    )r   r    r    r!   r/   á  s    zITreeNode.get_children_idc             C   s   dS )z3 Appends a child to the object's children.
        Nr    )r   r1   r    r    r!   r2   å  s    zITreeNode.append_childc             C   s   dS )z5 Inserts a child into the object's children.
        Nr    )r   r3   r1   r    r    r!   r4   é  s    zITreeNode.insert_childc             C   s   dS )a}   Checks whether a specified object can be deleted.

        The following return values are possible:

        - **True** if the object should be deleted with no further prompting.
        - **False** if the object should not be deleted.
        - Anything else: Caller should take its default action (which might
          include prompting the user to confirm deletion).
        Nr    )r   r    r    r!   r5   í  s    zITreeNode.confirm_deletec             C   s   dS )zJ Deletes a child at a specified index from the object's children.
        Nr    )r   r3   r    r    r!   r6   ø  s    zITreeNode.delete_childc             C   s   dS )zf Sets up or removes a listener for children being replaced on a
            specified object.
        Nr    )r   r;   r8   r    r    r!   r<   ü  s    z ITreeNode.when_children_replacedc             C   s   dS )ze Sets up or removes a listener for children being changed on a
            specified object.
        Nr    )r   r;   r8   r    r    r!   r>     s    zITreeNode.when_children_changedc             C   s   dS )z; Gets the label to display for a specified object.
        Nr    )r   r    r    r!   rB     s    zITreeNode.get_labelc             C   s   dS )z0 Sets the label for a specified object.
        Nr    )r   r@   r    r    r!   rD   
  s    zITreeNode.set_labelc             C   s   dS )zf Sets up or removes a listener for the label being changed on a
            specified object.
        Nr    )r   r;   r8   r    r    r!   rM     s    zITreeNode.when_label_changedc             C   s   dS )z@ Get the labels for any columns that have been defined.
        Nr    )r   r)   r    r    r!   rV     s    zITreeNode.get_column_labelsc             C   s   dS )ac   Sets up or removes a listener for the column labels being changed on
        a specified object.

        This will fire when either the list is reassigned or when it is
        modified. I.e., it listens both to the trait change event and the
        trait_items change event. Implement the listener appropriately to handle
        either case.
        Nr    )r   r)   r;   r8   r    r    r!   rW     s    z#ITreeNode.when_column_labels_changec             C   s   dS )z= Gets the tooltip to display for a specified object.
        Nr    )r   r    r    r!   rZ   !  s    zITreeNode.get_tooltipc             C   s   dS )z2 Returns the icon for a specified object.
        Nr    )r   r^   r    r    r!   r_   %  s    zITreeNode.get_iconc             C   s   dS )z; Returns the path used to locate an object's icon.
        Nr    )r   r    r    r!   r`   )  s    zITreeNode.get_icon_pathc             C   s   dS )zq Returns the name to use when adding a new object instance
            (displayed in the "New" submenu).
        Nr    )r   r    r    r!   ra   -  s    zITreeNode.get_namec             C   s   dS )z6 Gets the view to use when editing an object.
        Nr    )r   r    r    r!   rc   2  s    zITreeNode.get_viewc             C   s   dS )z= Returns the right-click context menu for an object.
        Nr    )r   r    r    r!   re   6  s    zITreeNode.get_menuc             C   s   dS )z? Returns whether the object's children can be renamed.
        Nr    )r   r    r    r!   rq   :  s    zITreeNode.can_renamec             C   s   dS )z4 Returns whether the object can be renamed.
        Nr    )r   r    r    r!   rs   >  s    zITreeNode.can_rename_mec             C   s   dS )z> Returns whether the object's children can be copied.
        Nr    )r   r    r    r!   ru   B  s    zITreeNode.can_copyc             C   s   dS )z? Returns whether the object's children can be deleted.
        Nr    )r   r    r    r!   rw   F  s    zITreeNode.can_deletec             C   s   dS )z4 Returns whether the object can be deleted.
        Nr    )r   r    r    r!   ry   J  s    zITreeNode.can_delete_mec             C   s   dS )z[ Returns whether the object's children can be inserted (vs.
            appended).
        Nr    )r   r    r    r!   r{   N  s    zITreeNode.can_insertc             C   s   dS )z[ Returns whether the object's children should be automatically
            opened.
        Nr    )r   r    r    r!   r}   S  s    zITreeNode.can_auto_openc             C   s   dS )z[ Returns whether the object's children should be automatically
            closed.
        Nr    )r   r    r    r!   r   X  s    zITreeNode.can_auto_closec             C   s   dS )zB Returns whether a given object is droppable on the node.
        Nr    )r   r‰   r    r    r!   r‹   ]  s    zITreeNode.can_addc             C   s   dS )zF Returns the list of classes that can be added to the object.
        Nr    )r   r    r    r!   r�   a  s    zITreeNode.get_addc             C   s   dS )z< Returns a draggable version of a specified object.
        Nr    )r   r    r    r!   rŽ   e  s    zITreeNode.get_drag_objectc             C   s   dS )z< Returns a droppable version of a specified object.
        Nr    )r   r�   r    r    r!   r�   i  s    zITreeNode.drop_objectc             C   s   dS )z+ Handles an object being selected.
        Nr    )r   r    r    r!   r’   m  s    zITreeNode.selectc             C   s   dS )z* Handles an object being clicked.
        Nr    )r   r    r    r!   r”   q  s    zITreeNode.clickc             C   s   dS )z1 Handles an object being double-clicked.
        Nr    )r   r    r    r!   r–   u  s    zITreeNode.dclickc             C   s   dS )z, Handles an object being activated.
        Nr    )r   r    r    r!   r˜   y  s    zITreeNode.activatedN)(r™   rš   r›   r*   r-   r,   r/   r2   r4   r5   r6   r<   r>   rB   rD   rM   rV   rW   rZ   r_   r`   ra   rc   re   rq   rs   ru   rw   ry   r{   r}   r   r‹   r�   rŽ   r�   r’   r”   r–   r˜   r    r    r    r!   rž   Ó  sJ   
rž   c               @   sR  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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dTd1d2„Zd3d4„ Zd5d6„ Zd7d8„ Zd9d:„ Zd;d<„ Z d=d>„ Z!d?d@„ Z"dAdB„ Z#dCdD„ Z$dEdF„ Z%dGdH„ Z&dIdJ„ Z'dKdL„ Z(dMdN„ Z)dOdP„ Z*dQdR„ Z+dSS )UÚITreeNodeAdapteraI   Abstract base class for an adapter that implements the ITreeNode
    interface.

    Usage:

    1. Create a subclass of ITreeNodeAdapter.
    2. Register the adapter to define what class (or classes) this is an
       ITreeNode adapter for (ie.
       ``register_factory(<from class>, ITreeNode, ITreeNodeAdapter)``).
    3. Override any of the following methods as necessary, using the
       ``self.adaptee`` trait to access the adapted object if needed.

    Note
    ----
    This base class implements all of the ITreeNode interface methods,
    but does not necessarily provide useful implementations for all of the
    methods. It allows you to get a new adapter class up and running quickly,
    but you should carefully review your final adapter implementation class
    to make sure it behaves correctly in your application.
    c             C   s   dS )z8 Returns whether this object can have children.
        Fr    )r   r    r    r!   r*   ˜  s    z ITreeNodeAdapter.allows_childrenc             C   s   dS )z2 Returns whether the object has children.
        Fr    )r   r    r    r!   r-   �  s    zITreeNodeAdapter.has_childrenc             C   s   g S )z% Gets the object's children.
        r    )r   r    r    r!   r,   ¢  s    zITreeNodeAdapter.get_childrenc             C   s   dS )z0 Gets the object's children identifier.
        r   r    )r   r    r    r!   r/   §  s    z ITreeNodeAdapter.get_children_idc             C   s   dS )z3 Appends a child to the object's children.
        Nr    )r   r1   r    r    r!   r2   ¬  s    zITreeNodeAdapter.append_childc             C   s   dS )z5 Inserts a child into the object's children.
        Nr    )r   r3   r1   r    r    r!   r4   ±  s    zITreeNodeAdapter.insert_childc             C   s   dS )a}   Checks whether a specified object can be deleted.

        The following return values are possible:

        - **True** if the object should be deleted with no further prompting.
        - **False** if the object should not be deleted.
        - Anything else: Caller should take its default action (which might
          include prompting the user to confirm deletion).
        Fr    )r   r    r    r!   r5   ¶  s    
zITreeNodeAdapter.confirm_deletec             C   s   dS )zJ Deletes a child at a specified index from the object's children.
        Nr    )r   r3   r    r    r!   r6   Â  s    zITreeNodeAdapter.delete_childc             C   s   dS )zf Sets up or removes a listener for children being replaced on a
            specified object.
        Nr    )r   r;   r8   r    r    r!   r<   Ç  s    z'ITreeNodeAdapter.when_children_replacedc             C   s   dS )ze Sets up or removes a listener for children being changed on a
            specified object.
        Nr    )r   r;   r8   r    r    r!   r>   Í  s    z&ITreeNodeAdapter.when_children_changedc             C   s   dS )z; Gets the label to display for a specified object.
        zNo label specifiedr    )r   r    r    r!   rB   Ó  s    zITreeNodeAdapter.get_labelc             C   s   dS )z0 Sets the label for a specified object.
        Nr    )r   r@   r    r    r!   rD   Ø  s    zITreeNodeAdapter.set_labelc             C   s   dS )zf Sets up or removes a listener for the label being changed on a
            specified object.
        Nr    )r   r;   r8   r    r    r!   rM   Ý  s    z#ITreeNodeAdapter.when_label_changedc             C   s   g S )z@ Get the labels for any columns that have been defined.
        r    )r   r    r    r!   rV   ã  s    z"ITreeNodeAdapter.get_column_labelsc             C   s   dS )ac   Sets up or removes a listener for the column labels being changed on
        a specified object.

        This will fire when either the list is reassigned or when it is
        modified. I.e., it listens both to the trait change event and the
        trait_items change event. Implement the listener appropriately to handle
        either case.
        Nr    )r   r;   r8   r    r    r!   rW   è  s    	z*ITreeNodeAdapter.when_column_labels_changec             C   s   dS )z= Gets the tooltip to display for a specified object.
        r   r    )r   r    r    r!   rZ   ó  s    zITreeNodeAdapter.get_tooltipc             C   s   dS )z2 Returns the icon for a specified object.
        z<item>r    )r   r^   r    r    r!   r_   ø  s    zITreeNodeAdapter.get_iconc             C   s   dS )z; Returns the path used to locate an object's icon.
        r   r    )r   r    r    r!   r`   ý  s    zITreeNodeAdapter.get_icon_pathc             C   s   dS )zq Returns the name to use when adding a new object instance
            (displayed in the "New" submenu).
        r   r    )r   r    r    r!   ra     s    zITreeNodeAdapter.get_namec             C   s   dS )z6 Gets the view to use when editing an object.
        Nr    )r   r    r    r!   rc     s    zITreeNodeAdapter.get_viewc             C   s   dS )z= Returns the right-click context menu for an object.
        Nr    )r   r    r    r!   re     s    zITreeNodeAdapter.get_menuc             C   s   dS )z+ Returns the background for object
        Nr    )r   r    r    r!   rj     s    zITreeNodeAdapter.get_backgroundc             C   s   dS )z+ Returns the foreground for object
        Nr    )r   r    r    r!   rl     s    zITreeNodeAdapter.get_foregroundr   c             C   s   dS )z) Returns the renderer for object
        Nr    )r   rn   r    r    r!   ro     s    zITreeNodeAdapter.get_rendererc             C   s   dS )z? Returns whether the object's children can be renamed.
        Fr    )r   r    r    r!   rq   !  s    zITreeNodeAdapter.can_renamec             C   s   dS )z4 Returns whether the object can be renamed.
        Fr    )r   r    r    r!   rs   &  s    zITreeNodeAdapter.can_rename_mec             C   s   dS )z> Returns whether the object's children can be copied.
        Fr    )r   r    r    r!   ru   +  s    zITreeNodeAdapter.can_copyc             C   s   dS )z? Returns whether the object's children can be deleted.
        Fr    )r   r    r    r!   rw   0  s    zITreeNodeAdapter.can_deletec             C   s   dS )z4 Returns whether the object can be deleted.
        Fr    )r   r    r    r!   ry   5  s    zITreeNodeAdapter.can_delete_mec             C   s   dS )z[ Returns whether the object's children can be inserted (vs.
            appended).
        Fr    )r   r    r    r!   r{   :  s    zITreeNodeAdapter.can_insertc             C   s   dS )z[ Returns whether the object's children should be automatically
            opened.
        Fr    )r   r    r    r!   r}   @  s    zITreeNodeAdapter.can_auto_openc             C   s   dS )z[ Returns whether the object's children should be automatically
            closed.
        Fr    )r   r    r    r!   r   F  s    zITreeNodeAdapter.can_auto_closec             C   s   dS )zB Returns whether a given object is droppable on the node.
        Fr    )r   r‰   r    r    r!   r‹   L  s    zITreeNodeAdapter.can_addc             C   s   g S )zF Returns the list of classes that can be added to the object.
        r    )r   r    r    r!   r�   Q  s    zITreeNodeAdapter.get_addc             C   s   | j S )z< Returns a draggable version of a specified object.
        )Zadaptee)r   r    r    r!   rŽ   V  s    z ITreeNodeAdapter.get_drag_objectc             C   s   |S )z< Returns a droppable version of a specified object.
        r    )r   r�   r    r    r!   r�   [  s    zITreeNodeAdapter.drop_objectc             C   s   dS )z+ Handles an object being selected.
        Nr    )r   r    r    r!   r’   `  s    zITreeNodeAdapter.selectc             C   s   dS )z* Handles an object being clicked.
        Nr    )r   r    r    r!   r”   e  s    zITreeNodeAdapter.clickc             C   s   dS )z1 Handles an object being double-clicked.
        Nr    )r   r    r    r!   r–   j  s    zITreeNodeAdapter.dclickc             C   s   dS )z, Handles an object being activated.
        Nr    )r   r    r    r!   r˜   o  s    zITreeNodeAdapter.activatedN)r   ),r™   rš   r›   rœ   r*   r-   r,   r/   r2   r4   r5   r6   r<   r>   rB   rD   rM   rV   rW   rZ   r_   r`   ra   rc   re   rj   rl   ro   rq   rs   ru   rw   ry   r{   r}   r   r‹   r�   rŽ   r�   r’   r”   r–   r˜   r    r    r    r!   rŸ   ‚  sR   
rŸ   c               @   sZ  e Zd ZdZeeƒ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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dTd1d2„Zd3d4„ Zd5d6„ Z d7d8„ Z!d9d:„ Z"d;d<„ Z#d=d>„ Z$d?d@„ Z%dAdB„ Z&dCdD„ Z'dEdF„ Z(dGdH„ Z)dIdJ„ Z*dKdL„ Z+dMdN„ Z,dOdP„ Z-dQdR„ Z.dSS )UÚITreeNodeAdapterBridgezÒ Private class for use by a toolkit-specific implementation of the
        TreeEditor to allow bridging the TreeNode interface used by the editor
        to the ITreeNode interface used by object adapters.
    c             C   s
   | j jƒ S )z8 Returns whether this object can have children.
        )Úadapterr*   )r   r)   r    r    r!   r*   „  s    z&ITreeNodeAdapterBridge.allows_childrenc             C   s
   | j jƒ S )z2 Returns whether the object has children.
        )r¡   r-   )r   r)   r    r    r!   r-   ‰  s    z#ITreeNodeAdapterBridge.has_childrenc             C   s
   | j jƒ S )z% Gets the object's children.
        )r¡   r,   )r   r)   r    r    r!   r,   Ž  s    z#ITreeNodeAdapterBridge.get_childrenc             C   s
   | j jƒ S )z0 Gets the object's children identifier.
        )r¡   r/   )r   r)   r    r    r!   r/   “  s    z&ITreeNodeAdapterBridge.get_children_idc             C   s   | j j|ƒS )z3 Appends a child to the object's children.
        )r¡   r2   )r   r)   r1   r    r    r!   r2   ˜  s    z#ITreeNodeAdapterBridge.append_childc             C   s   | j j||ƒS )z5 Inserts a child into the object's children.
        )r¡   r4   )r   r)   r3   r1   r    r    r!   r4   �  s    z#ITreeNodeAdapterBridge.insert_childc             C   s
   | j jƒ S )a}   Checks whether a specified object can be deleted.

        The following return values are possible:

        - **True** if the object should be deleted with no further prompting.
        - **False** if the object should not be deleted.
        - Anything else: Caller should take its default action (which might
          include prompting the user to confirm deletion).
        )r¡   r5   )r   r)   r    r    r!   r5   ¢  s    
z%ITreeNodeAdapterBridge.confirm_deletec             C   s   | j j|ƒS )zJ Deletes a child at a specified index from the object's children.
        )r¡   r6   )r   r)   r3   r    r    r!   r6   ®  s    z#ITreeNodeAdapterBridge.delete_childc             C   s   | j j||ƒS )zf Sets up or removes a listener for children being replaced on a
            specified object.
        )r¡   r<   )r   r)   r;   r8   r    r    r!   r<   ³  s    z-ITreeNodeAdapterBridge.when_children_replacedc             C   s   | j j||ƒS )ze Sets up or removes a listener for children being changed on a
            specified object.
        )r¡   r>   )r   r)   r;   r8   r    r    r!   r>   ¹  s    z,ITreeNodeAdapterBridge.when_children_changedc             C   s
   | j jƒ S )z; Gets the label to display for a specified object.
        )r¡   rB   )r   r)   r    r    r!   rB   ¿  s    z ITreeNodeAdapterBridge.get_labelc             C   s   | j j|ƒS )z0 Sets the label for a specified object.
        )r¡   rD   )r   r)   r@   r    r    r!   rD   Ä  s    z ITreeNodeAdapterBridge.set_labelc             C   s   | j j||ƒS )zf Sets up or removes a listener for the label being changed on a
            specified object.
        )r¡   rM   )r   r)   r;   r8   r    r    r!   rM   É  s    z)ITreeNodeAdapterBridge.when_label_changedc             C   s
   | j jƒ S )z@ Get the labels for any columns that have been defined.
        )r¡   rV   )r   r)   r    r    r!   rV   Ï  s    z(ITreeNodeAdapterBridge.get_column_labelsc             C   s   | j j||ƒS )ac   Sets up or removes a listener for the column labels being changed on
        a specified object.

        This will fire when either the list is reassigned or when it is
        modified. I.e., it listens both to the trait change event and the
        trait_items change event. Implement the listener appropriately to handle
        either case.
        )r¡   rW   )r   r)   r;   r8   r    r    r!   rW   Ô  s    	z0ITreeNodeAdapterBridge.when_column_labels_changec             C   s
   | j jƒ S )z= Gets the tooltip to display for a specified object.
        )r¡   rZ   )r   r)   r    r    r!   rZ   ß  s    z"ITreeNodeAdapterBridge.get_tooltipc             C   s   | j j|ƒS )z2 Returns the icon for a specified object.
        )r¡   r_   )r   r)   r^   r    r    r!   r_   ä  s    zITreeNodeAdapterBridge.get_iconc             C   s
   | j jƒ S )z; Returns the path used to locate an object's icon.
        )r¡   r`   )r   r)   r    r    r!   r`   é  s    z$ITreeNodeAdapterBridge.get_icon_pathc             C   s
   | j jƒ S )zq Returns the name to use when adding a new object instance
            (displayed in the "New" submenu).
        )r¡   ra   )r   r)   r    r    r!   ra   î  s    zITreeNodeAdapterBridge.get_namec             C   s
   | j jƒ S )z6 Gets the view to use when editing an object.
        )r¡   rc   )r   r)   r    r    r!   rc   ô  s    zITreeNodeAdapterBridge.get_viewc             C   s
   | j jƒ S )z= Returns the right-click context menu for an object.
        )r¡   re   )r   r)   r    r    r!   re   ù  s    zITreeNodeAdapterBridge.get_menuc             C   s
   | j jƒ S )z+ Returns the background for object
        )r¡   rj   )r   r)   r    r    r!   rj   þ  s    z%ITreeNodeAdapterBridge.get_backgroundc             C   s
   | j jƒ S )z+ Returns the foreground for object
        )r¡   rl   )r   r)   r    r    r!   rl     s    z%ITreeNodeAdapterBridge.get_foregroundr   c             C   s   | j j|ƒS )z) Returns the renderer for object
        )r¡   ro   )r   r)   rn   r    r    r!   ro     s    z#ITreeNodeAdapterBridge.get_rendererc             C   s
   | j jƒ S )z? Returns whether the object's children can be renamed.
        )r¡   rq   )r   r)   r    r    r!   rq     s    z!ITreeNodeAdapterBridge.can_renamec             C   s
   | j jƒ S )z4 Returns whether the object can be renamed.
        )r¡   rs   )r   r)   r    r    r!   rs     s    z$ITreeNodeAdapterBridge.can_rename_mec             C   s
   | j jƒ S )z> Returns whether the object's children can be copied.
        )r¡   ru   )r   r)   r    r    r!   ru     s    zITreeNodeAdapterBridge.can_copyc             C   s
   | j jƒ S )z? Returns whether the object's children can be deleted.
        )r¡   rw   )r   r)   r    r    r!   rw     s    z!ITreeNodeAdapterBridge.can_deletec             C   s
   | j jƒ S )z4 Returns whether the object can be deleted.
        )r¡   ry   )r   r)   r    r    r!   ry   !  s    z$ITreeNodeAdapterBridge.can_delete_mec             C   s
   | j jƒ S )z[ Returns whether the object's children can be inserted (vs.
            appended).
        )r¡   r{   )r   r)   r    r    r!   r{   &  s    z!ITreeNodeAdapterBridge.can_insertc             C   s
   | j jƒ S )z[ Returns whether the object's children should be automatically
            opened.
        )r¡   r}   )r   r)   r    r    r!   r}   ,  s    z$ITreeNodeAdapterBridge.can_auto_openc             C   s
   | j jƒ S )z[ Returns whether the object's children should be automatically
            closed.
        )r¡   r   )r   r)   r    r    r!   r   2  s    z%ITreeNodeAdapterBridge.can_auto_closec             C   s   | j j|ƒS )zB Returns whether a given object is droppable on the node.
        )r¡   r‹   )r   r)   r‰   r    r    r!   r‹   8  s    zITreeNodeAdapterBridge.can_addc             C   s
   | j jƒ S )zF Returns the list of classes that can be added to the object.
        )r¡   r�   )r   r)   r    r    r!   r�   =  s    zITreeNodeAdapterBridge.get_addc             C   s
   | j jƒ S )z< Returns a draggable version of a specified object.
        )r¡   rŽ   )r   r)   r    r    r!   rŽ   B  s    z&ITreeNodeAdapterBridge.get_drag_objectc             C   s   | j j|ƒS )z< Returns a droppable version of a specified object.
        )r¡   r�   )r   r)   r�   r    r    r!   r�   G  s    z"ITreeNodeAdapterBridge.drop_objectc             C   s
   | j jƒ S )z+ Handles an object being selected.
        )r¡   r’   )r   r)   r    r    r!   r’   L  s    zITreeNodeAdapterBridge.selectc             C   s
   | j jƒ S )z* Handles an object being clicked.
        )r¡   r”   )r   r)   r    r    r!   r”   Q  s    zITreeNodeAdapterBridge.clickc             C   s
   | j jƒ S )z1 Handles an object being double-clicked.
        )r¡   r–   )r   r)   r    r    r!   r–   V  s    zITreeNodeAdapterBridge.dclickc             C   s
   | j jƒ S )z, Handles an object being activated.
        )r¡   r˜   )r   r)   r    r    r!   r˜   [  s    z ITreeNodeAdapterBridge.activatedN)r   )/r™   rš   r›   rœ   r   rž   r¡   r*   r-   r,   r/   r2   r4   r5   r6   r<   r>   rB   rD   rM   rV   rW   rZ   r_   r`   ra   rc   re   rj   rl   ro   rq   rs   ru   rw   ry   r{   r}   r   r‹   r�   rŽ   r�   r’   r”   r–   r˜   r    r    r    r!   r    y  sT   
r    c               @   s,  e 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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/d0„ Zd1d2„ Zd3d4„ Zd5d6„ Zd7d8„ Zd9d:„ Zd;d<„ Z d=d>„ Z!d?d@„ Z"dAdB„ Z#dCdD„ Z$dEdF„ Z%dGdH„ Z&dIS )JÚObjectTreeNodec             C   s
   |j | ƒS )z8 Returns whether this object can have children.
        )Útno_allows_children)r   r)   r    r    r!   r*   n  s    zObjectTreeNode.allows_childrenc             C   s
   |j | ƒS )z2 Returns whether the object has children.
        )Útno_has_children)r   r)   r    r    r!   r-   w  s    zObjectTreeNode.has_childrenc             C   s
   |j | ƒS )z% Gets the object's children.
        )Útno_get_children)r   r)   r    r    r!   r,   €  s    zObjectTreeNode.get_childrenc             C   s
   |j | ƒS )z0 Gets the object's children identifier.
        )Útno_get_children_id)r   r)   r    r    r!   r/   ‰  s    zObjectTreeNode.get_children_idc             C   s   |j | |ƒS )z3 Appends a child to the object's children.
        )Útno_append_child)r   r)   r1   r    r    r!   r2   ’  s    zObjectTreeNode.append_childc             C   s   |j | ||ƒS )z5 Inserts a child into the object's children.
        )Útno_insert_child)r   r)   r3   r1   r    r    r!   r4   ›  s    zObjectTreeNode.insert_childc             C   s
   |j | ƒS )a}   Checks whether a specified object can be deleted.

        The following return values are possible:

        - **True** if the object should be deleted with no further prompting.
        - **False** if the object should not be deleted.
        - Anything else: Caller should take its default action (which might
          include prompting the user to confirm deletion).
        )Útno_confirm_delete)r   r)   r    r    r!   r5   §  s    
zObjectTreeNode.confirm_deletec             C   s   |j | |ƒS )zJ Deletes a child at a specified index from the object's children.
        )Útno_delete_child)r   r)   r3   r    r    r!   r6   ·  s    zObjectTreeNode.delete_childc             C   s   |j | ||ƒS )zf Sets up or removes a listener for children being replaced on a
            specified object.
        )Útno_when_children_replaced)r   r)   r;   r8   r    r    r!   r<   Á  s    z%ObjectTreeNode.when_children_replacedc             C   s   |j | ||ƒS )ze Sets up or removes a listener for children being changed on a
            specified object.
        )Útno_when_children_changed)r   r)   r;   r8   r    r    r!   r>   Ì  s    z$ObjectTreeNode.when_children_changedc             C   s
   |j | ƒS )z; Gets the label to display for a specified object.
        )Útno_get_label)r   r)   r    r    r!   rB   Ö  s    zObjectTreeNode.get_labelc             C   s   |j | |ƒS )z0 Sets the label for a specified object.
        )Útno_set_label)r   r)   r@   r    r    r!   rD   ß  s    zObjectTreeNode.set_labelc             C   s   |j | ||ƒS )zf Sets up or removes a listener for the label being changed on a
            specified object.
        )Útno_when_label_changed)r   r)   r;   r8   r    r    r!   rM   è  s    z!ObjectTreeNode.when_label_changedc             C   s
   |j | ƒS )z= Gets the tooltip to display for a specified object.
        )Útno_get_tooltip)r   r)   r    r    r!   rZ   ò  s    zObjectTreeNode.get_tooltipc             C   s   |j | |ƒS )z2 Returns the icon for a specified object.
        )Útno_get_icon)r   r)   r^   r    r    r!   r_   û  s    zObjectTreeNode.get_iconc             C   s
   |j | ƒS )z; Returns the path used to locate an object's icon.
        )Útno_get_icon_path)r   r)   r    r    r!   r`     s    zObjectTreeNode.get_icon_pathc             C   s
   |j | ƒS )zq Returns the name to use when adding a new object instance
            (displayed in the "New" submenu).
        )Útno_get_name)r   r)   r    r    r!   ra     s    zObjectTreeNode.get_namec             C   s
   |j | ƒS )z6 Gets the view to use when editing an object.
        )Útno_get_view)r   r)   r    r    r!   rc     s    zObjectTreeNode.get_viewc             C   s
   |j | ƒS )z= Returns the right-click context menu for an object.
        )Útno_get_menu)r   r)   r    r    r!   re   !  s    zObjectTreeNode.get_menuc             C   s
   |j | ƒS )z? Returns whether the object's children can be renamed.
        )Útno_can_rename)r   r)   r    r    r!   rq   *  s    zObjectTreeNode.can_renamec             C   s
   |j | ƒS )z4 Returns whether the object can be renamed.
        )Útno_can_rename_me)r   r)   r    r    r!   rs   3  s    zObjectTreeNode.can_rename_mec             C   s
   |j | ƒS )z> Returns whether the object's children can be copied.
        )Útno_can_copy)r   r)   r    r    r!   ru   <  s    zObjectTreeNode.can_copyc             C   s
   |j | ƒS )z? Returns whether the object's children can be deleted.
        )Útno_can_delete)r   r)   r    r    r!   rw   E  s    zObjectTreeNode.can_deletec             C   s
   |j | ƒS )z4 Returns whether the object can be deleted.
        )Útno_can_delete_me)r   r)   r    r    r!   ry   N  s    zObjectTreeNode.can_delete_mec             C   s
   |j | ƒS )zW Returns whether the object's children can be inserted (vs.
        appended).
        )Útno_can_insert)r   r)   r    r    r!   r{   X  s    zObjectTreeNode.can_insertc             C   s
   |j | ƒS )z[ Returns whether the object's children should be automatically
            opened.
        )Útno_can_auto_open)r   r)   r    r    r!   r}   b  s    zObjectTreeNode.can_auto_openc             C   s
   |j | ƒS )z[ Returns whether the object's children should be automatically
            closed.
        )Útno_can_auto_close)r   r)   r    r    r!   r   l  s    zObjectTreeNode.can_auto_closec             C   s   t |tƒr|j| ƒS dS )z] Returns whether this is the node that should handle a
            specified object.
        F)rh   ÚTreeNodeObjectÚtno_is_node_for)r   r)   r    r    r!   rƒ   w  s    

zObjectTreeNode.is_node_forc             C   s   |j | |ƒS )zB Returns whether a given object is droppable on the node.
        )Útno_can_add)r   r)   r‰   r    r    r!   r‹   „  s    zObjectTreeNode.can_addc             C   s
   |j | ƒS )zF Returns the list of classes that can be added to the object.
        )Útno_get_add)r   r)   r    r    r!   r�   �  s    zObjectTreeNode.get_addc             C   s
   |j | ƒS )z< Returns a draggable version of a specified object.
        )Útno_get_drag_object)r   r)   r    r    r!   rŽ   –  s    zObjectTreeNode.get_drag_objectc             C   s   |j | |ƒS )z< Returns a droppable version of a specified object.
        )Útno_drop_object)r   r)   r�   r    r    r!   r�   Ÿ  s    zObjectTreeNode.drop_objectc             C   s
   |j | ƒS )z+ Handles an object being selected.
        )Ú
tno_select)r   r)   r    r    r!   r’   ¨  s    zObjectTreeNode.selectc             C   s
   |j | ƒS )z* Handles an object being clicked.
        )Ú	tno_click)r   r)   r    r    r!   r”   ±  s    zObjectTreeNode.clickc             C   s
   |j | ƒS )z1 Handles an object being double-clicked.
        )Ú
tno_dclick)r   r)   r    r    r!   r–   º  s    zObjectTreeNode.dclickc             C   s
   |j | ƒS )z, Handles an object being activated.
        )Útno_activated)r   r)   r    r    r!   r˜   Ã  s    zObjectTreeNode.activatedN)'r™   rš   r›   r*   r-   r,   r/   r2   r4   r5   r6   r<   r>   rB   rD   rM   rZ   r_   r`   ra   rc   re   rq   rs   ru   rw   ry   r{   r}   r   rƒ   r‹   r�   rŽ   r�   r’   r”   r–   r˜   r    r    r    r!   r¢   h  sH   					

		
		

						


							r¢   c               @   s4  e Zd ZdZe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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d0d1„ Zd2d3„ Zd4d5„ Zd6d7„ Z d8d9„ Z!d:d;„ Z"d<d=„ Z#d>d?„ Z$d@dA„ Z%dBdC„ Z&dDdE„ Z'dFdG„ Z(dHdI„ Z)dJS )Kr¾   z< Represents the object that corresponds to a tree node.
    c             C   s
   |j dkS )z6 Returns whether this object allows children.
        r   )r(   )r   Únoder    r    r!   r£   Ø  s    z"TreeNodeObject.tno_allows_childrenc             C   s   t | j|ƒƒdkS )z3 Returns whether this object has children.
        r   )r+   r¥   )r   rÈ   r    r    r!   r¤   á  s    zTreeNodeObject.tno_has_childrenc             C   s   t | |jdƒS )z% Gets the object's children.
        N)r.   r(   )r   rÈ   r    r    r!   r¥   ê  s    zTreeNodeObject.tno_get_childrenc             C   s   |j S )z0 Gets the object's children identifier.
        )r(   )r   rÈ   r    r    r!   r¦   ó  s    z"TreeNodeObject.tno_get_children_idc             C   s   | j |ƒj|ƒ dS )z3 Appends a child to the object's children.
        N)r¥   r0   )r   rÈ   r1   r    r    r!   r§   ü  s    zTreeNodeObject.tno_append_childc             C   s   | j |ƒ}|g|||…< dS )z5 Inserts a child into the object's children.
        N)r¥   )r   rÈ   r3   r1   r(   r    r    r!   r¨     s    
zTreeNodeObject.tno_insert_childc             C   s   dS )a}   Checks whether a specified object can be deleted.

        The following return values are possible:

        - **True** if the object should be deleted with no further prompting.
        - **False** if the object should not be deleted.
        - Anything else: Caller should take its default action (which might
          include prompting the user to confirm deletion).
        Nr    )r   rÈ   r    r    r!   r©     s    
z!TreeNodeObject.tno_confirm_deletec             C   s   | j |ƒ|= dS )zJ Deletes a child at a specified index from the object's children.
        N)r¥   )r   rÈ   r3   r    r    r!   rª   "  s    zTreeNodeObject.tno_delete_childc             C   s   | j ||j|dd� dS )zb Sets up or removes a listener for children being replaced on a
        specified object.
        r7   )r8   r9   N)r:   r(   )r   rÈ   r;   r8   r    r    r!   r«   -  s    z)TreeNodeObject.tno_when_children_replacedc             C   s   | j ||jd |dd� dS )za Sets up or removes a listener for children being changed on a
        specified object.
        r=   r7   )r8   r9   N)r:   r(   )r   rÈ   r;   r8   r    r    r!   r¬   9  s    z(TreeNodeObject.tno_when_children_changedc             C   sF   |j }|dd… dkr"|dd… S t| |ƒ}|jdkr:|S |j| |ƒS )z; Gets the label to display for a specified object.
        Nr   r?   )r@   r   rA   )r   rÈ   r@   r    r    r!   r­   D  s    

zTreeNodeObject.tno_get_labelc             C   s&   |j }|dd… dkr"t| ||ƒ dS )z0 Sets the label for a specified object.
        Nr   r?   )r@   r   )r   rÈ   r@   rC   r    r    r!   r®   V  s    zTreeNodeObject.tno_set_labelc                sp   |j }|dd… dkrld||ˆ f}|s@‡ ‡fdd„}|ˆj|< nˆjj|dƒ}|dkrZdS ˆj|||dd� dS )	zc Sets up or removes a listener for  the label being changed on a
        specified object.
        Nr   r?   r@   c                s   ˆ ˆ||ƒS )z2 Ensure listener gets called with correct object. r    )rE   rF   rG   )r;   r   r    r!   rH   i  s    z?TreeNodeObject.tno_when_label_changed.<locals>.wrapped_listenerrI   )r8   r9   )r@   rJ   rK   r:   )r   rÈ   r;   r8   r@   rL   rH   r    )r;   r   r!   r¯   a  s    
z%TreeNodeObject.tno_when_label_changedc             C   sR   |j }|dkr|S |dd… dkr.|dd… S t| |ƒ}|jdkrF|S |j| |ƒS )z= Gets the tooltip to display for a specified object.
        r   Nr   r?   )rX   r   rY   )r   rÈ   rX   r    r    r!   r°   z  s    

zTreeNodeObject.tno_get_tooltipc             C   s    | j |ƒs|jS |r|jS |jS )z2 Returns the icon for a specified object.
        )r£   r[   r\   r]   )r   rÈ   r^   r    r    r!   r±   �  s
    
zTreeNodeObject.tno_get_iconc             C   s   |j S )z; Returns the path used to locate an object's icon.
        )r   )r   rÈ   r    r    r!   r²   ž  s    z TreeNodeObject.tno_get_icon_pathc             C   s   |j S )zq Returns the name to use when adding a new object instance
            (displayed in the "New" submenu).
        )rF   )r   rÈ   r    r    r!   r³   ¨  s    zTreeNodeObject.tno_get_namec             C   s   |j S )z6 Gets the view to use when editing an object.
        )rb   )r   rÈ   r    r    r!   r´   ²  s    zTreeNodeObject.tno_get_viewc             C   s   |j S )z= Returns the right-click context menu for an object.
        )rd   )r   rÈ   r    r    r!   rµ   »  s    zTreeNodeObject.tno_get_menuc             C   s   |j S )z? Returns whether the object's children can be renamed.
        )rp   )r   rÈ   r    r    r!   r¶   Ä  s    zTreeNodeObject.tno_can_renamec             C   s   |j S )z4 Returns whether the object can be renamed.
        )rr   )r   rÈ   r    r    r!   r·   Í  s    z TreeNodeObject.tno_can_rename_mec             C   s   |j S )z> Returns whether the object's children can be copied.
        )rt   )r   rÈ   r    r    r!   r¸   Ö  s    zTreeNodeObject.tno_can_copyc             C   s   |j S )z? Returns whether the object's children can be deleted.
        )rv   )r   rÈ   r    r    r!   r¹   ß  s    zTreeNodeObject.tno_can_deletec             C   s   |j S )z4 Returns whether the object can be deleted.
        )rx   )r   rÈ   r    r    r!   rº   è  s    z TreeNodeObject.tno_can_delete_mec             C   s   |j S )zW Returns whether the object's children can be inserted (vs.
        appended).
        )rz   )r   rÈ   r    r    r!   r»   ò  s    zTreeNodeObject.tno_can_insertc             C   s   |j S )zW Returns whether the object's children should be automatically
        opened.
        )r|   )r   rÈ   r    r    r!   r¼   ü  s    z TreeNodeObject.tno_can_auto_openc             C   s   |j S )zW Returns whether the object's children should be automatically
        closed.
        )r~   )r   rÈ   r    r    r!   r½     s    z!TreeNodeObject.tno_can_auto_closec             C   s   t | |jƒp| j|jŽ S )z] Returns whether this is the node that should handle a
            specified object.
        )rh   r€   r�   r‚   )r   rÈ   r    r    r!   r¿     s    zTreeNodeObject.tno_is_node_forc             C   sN   |j |ƒ}|j|ƒrdS x0|jD ]&}t|ƒtkr8|d }t||ƒr dS q W dS )zB Returns whether a given object is droppable on the node.
        Tr   F)r„   r…   r†   r‡   r   rˆ   )r   rÈ   r‰   r#   rŠ   r    r    r!   rÀ     s    


zTreeNodeObject.tno_can_addc             C   s   |j S )zF Returns the list of classes that can be added to the object.
        )rŒ   )r   rÈ   r    r    r!   rÁ   /  s    zTreeNodeObject.tno_get_addc             C   s   | S )z< Returns a draggable version of a specified object.
        r    )r   rÈ   r    r    r!   rÂ   8  s    z"TreeNodeObject.tno_get_drag_objectc             C   sZ   |j |ƒr|S xF|jD ]<}t|ƒtkrDt||d ƒrR|d | |ƒS qt||ƒr|S qW dS )z< Returns a droppable version of a specified object.
        r   r   N)r…   r†   r‡   r   rh   )r   rÈ   r�   rŠ   r    r    r!   rÃ   A  s    

zTreeNodeObject.tno_drop_objectc             C   s   |j dk	r|j | ƒ dS dS )z+ Handles an object being selected.
        NT)r‘   )r   rÈ   r    r    r!   rÄ   S  s    

zTreeNodeObject.tno_selectc             C   s   |j dk	r|j | ƒ dS dS )z* Handles an object being clicked.
        NT)r“   )r   rÈ   r    r    r!   rÅ   `  s    

zTreeNodeObject.tno_clickc             C   s   |j dk	r|j | ƒ dS dS )z1 Handles an object being double-clicked.
        NT)r•   )r   rÈ   r    r    r!   rÆ   m  s    

zTreeNodeObject.tno_dclickc             C   s   |j dk	r|j | ƒ dS dS )z, Handles an object being activated.
        NT)r—   )r   rÈ   r    r    r!   rÇ   z  s    

zTreeNodeObject.tno_activatedN)*r™   rš   r›   rœ   r   rJ   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»   r¼   r½   r¿   rÀ   rÁ   rÂ   rÃ   rÄ   rÅ   rÆ   rÇ   r    r    r    r!   r¾   Í  sL   					

						


		r¾   c               @   s  e Zd ZeeƒZeeƒ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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/d0„ Zd1d2„ Z d3d4„ Z!d5d6„ Z"d7d8„ Z#d9d:„ Z$d;d<„ Z%d=S )>ÚMultiTreeNodec             C   s   dS )zV Returns whether this object can have children (True for this
        class).
        Tr    )r   r)   r    r    r!   r*   ˜  s    zMultiTreeNode.allows_childrenc             C   s   dS )zI Returns whether this object has children (True for this class).
        Tr    )r   r)   r    r    r!   r-   ¢  s    zMultiTreeNode.has_childrenc                s   ‡ fdd„| j D ƒS )z% Gets the object's children.
        c                s   g | ]}ˆ |f‘qS r    r    )r"   rÈ   )r)   r    r!   r$   ®  s    z.MultiTreeNode.get_children.<locals>.<listcomp>)Únodes)r   r)   r    )r)   r!   r,   «  s    zMultiTreeNode.get_childrenc             C   s   dS )z0 Gets the object's children identifier.
        r   r    )r   r)   r    r    r!   r/   ´  s    zMultiTreeNode.get_children_idc             C   s   dS )zb Sets up or removes a listener for children being replaced on a
        specified object.
        Nr    )r   r)   r;   r8   r    r    r!   r<   ¾  s    z$MultiTreeNode.when_children_replacedc             C   s   dS )za Sets up or removes a listener for children being changed on a
        specified object.
        Nr    )r   r)   r;   r8   r    r    r!   r>   É  s    z#MultiTreeNode.when_children_changedc             C   s   | j j|ƒS )z; Gets the label to display for a specified object.
        )Ú	root_noderB   )r   r)   r    r    r!   rB   Ó  s    zMultiTreeNode.get_labelc             C   s   | j j||ƒS )z0 Sets the label for a specified object.
        )rË   rD   )r   r)   r@   r    r    r!   rD   Ü  s    zMultiTreeNode.set_labelc             C   s   | j j|||ƒS )zb Sets up or removes a listener for the label being changed on a
        specified object.
        )rË   rM   )r   r)   r;   r8   r    r    r!   rM   å  s    z MultiTreeNode.when_label_changedc             C   s   | j j||ƒS )z2 Returns the icon for a specified object.
        )rË   r_   )r   r)   r^   r    r    r!   r_   ï  s    zMultiTreeNode.get_iconc             C   s   | j j|ƒS )z; Returns the path used to locate an object's icon.
        )rË   r`   )r   r)   r    r    r!   r`   ø  s    zMultiTreeNode.get_icon_pathc             C   s   | j j|ƒS )zq Returns the name to use when adding a new object instance
            (displayed in the "New" submenu).
        )rË   ra   )r   r)   r    r    r!   ra   	  s    zMultiTreeNode.get_namec             C   s   | j j|ƒS )z6 Gets the view to use when editing an object.
        )rË   rc   )r   r)   r    r    r!   rc   	  s    zMultiTreeNode.get_viewc             C   s   | j j|ƒS )z= Returns the right-click context menu for an object.
        )rË   re   )r   r)   r    r    r!   re   	  s    zMultiTreeNode.get_menuc             C   s   dS )z^ Returns whether the object's children can be renamed (False for
        this class).
        Fr    )r   r)   r    r    r!   rq   	  s    zMultiTreeNode.can_renamec             C   s   dS )zK Returns whether the object can be renamed (False for this class).
        Fr    )r   r)   r    r    r!   rs   (	  s    zMultiTreeNode.can_rename_mec             C   s   | j j|ƒS )z> Returns whether the object's children can be copied.
        )rË   ru   )r   r)   r    r    r!   ru   1	  s    zMultiTreeNode.can_copyc             C   s   dS )z^ Returns whether the object's children can be deleted (False for
        this class).
        Fr    )r   r)   r    r    r!   rw   :	  s    zMultiTreeNode.can_deletec             C   s   dS )zJ Returns whether the object can be deleted (True for this class).
        Tr    )r   r)   r    r    r!   ry   D	  s    zMultiTreeNode.can_delete_mec             C   s   dS )z„ Returns whether the object's children can be inserted (False,
        meaning that children are appended, for this class).
        Fr    )r   r)   r    r    r!   r{   N	  s    zMultiTreeNode.can_insertc             C   s   | j j|ƒS )zW Returns whether the object's children should be automatically
        opened.
        )rË   r}   )r   r)   r    r    r!   r}   X	  s    zMultiTreeNode.can_auto_openc             C   s   | j j|ƒS )zW Returns whether the object's children should be automatically
        closed.
        )rË   r   )r   r)   r    r    r!   r   b	  s    zMultiTreeNode.can_auto_closec             C   s   dS )za Returns whether a given object is droppable on the node (False for
        this class).
        Fr    )r   r)   r‰   r    r    r!   r‹   l	  s    zMultiTreeNode.can_addc             C   s   g S )zF Returns the list of classes that can be added to the object.
        r    )r   r)   r    r    r!   r�   v	  s    zMultiTreeNode.get_addc             C   s   | j j|ƒS )z< Returns a draggable version of a specified object.
        )rË   rŽ   )r   r)   r    r    r!   rŽ   	  s    zMultiTreeNode.get_drag_objectc             C   s   | j j||ƒS )z< Returns a droppable version of a specified object.
        )rË   r�   )r   r)   r�   r    r    r!   r�   ˆ	  s    zMultiTreeNode.drop_objectc             C   s   | j j|ƒS )z+ Handles an object being selected.
        )rË   r’   )r   r)   r    r    r!   r’   ‘	  s    zMultiTreeNode.selectc             C   s   | j j|ƒS )z* Handles an object being clicked.
        )rË   r”   )r   r)   r    r    r!   r”   š	  s    zMultiTreeNode.clickc             C   s   | j j|ƒS )z1 Handles an object being double-clicked.
        )rË   r–   )r   r)   r    r    r!   r–   £	  s    zMultiTreeNode.dclickc             C   s   | j j|ƒS )z, Handles an object being activated.
        )rË   r˜   )r   r)   r    r    r!   r˜   ¬	  s    zMultiTreeNode.activatedN)&r™   rš   r›   r   r   rË   r   rÊ   r*   r-   r,   r/   r<   r>   rB   rD   rM   r_   r`   ra   rc   re   rq   rs   ru   rw   ry   r{   r}   r   r‹   r�   rŽ   r�   r’   r”   r–   r˜   r    r    r    r!   rÉ   ˆ  s@   
		

		
	

		
		





						rÉ   )"rœ   Ú
__future__r   rO   Z
traits.apir   r   r   r   r   r   r	   r
   r   r   r   r   r   r   r   Ztraits.trait_baser   r   r   r   Z	ui_traitsr   r   rž   rŸ   r    r¢   r¾   rÉ   r    r    r    r!   Ú<module>   s2   D     ) 0 x p  g   >