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
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.
é    )Úzip_longest)ÚAdapterÚAnyÚBoolÚCallableÚDictÚHasPrivateTraitsÚInstanceÚ	InterfaceÚisinterfaceÚListÚPropertyÚStrÚSupportsÚUnionÚcached_property)ÚSequenceTypesÚget_resource_pathÚxgetattrÚxsetattré   )ÚAViewc                       sŽ  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ÚTreeNodezYRepresents a tree node. Used by the tree editor and tree editor factory
    classes.
    TFÚnode_for)ZobserveNú<item>z<group>z<open>c                    s(   t ƒ jf i |¤Ž | jdkr$tƒ | _d S )NÚ )ÚsuperÚ__init__Ú	icon_pathr   )ÚselfZtraits©Ú	__class__© úU/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/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>Å   ó    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)   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 )ú.Returns whether this object can have children.r   ©Úchildren©r   Úobjectr"   r"   r#   Úallows_childrenÎ   s    zTreeNode.allows_childrenc                 C   s   t |  |¡ƒdkS )ú(Returns whether the object has children.r   )ÚlenÚget_childrenr1   r"   r"   r#   Úhas_childrenÒ   s    zTreeNode.has_childrenc                 C   s   t || jdƒS ©úGets the object's children.N©Úgetattrr0   r1   r"   r"   r#   r6   Ö   s    zTreeNode.get_childrenc                 C   s   | j S ©ú&Gets the object's children identifier.r/   r1   r"   r"   r#   Úget_children_idÚ   s    zTreeNode.get_children_idc                 C   s   |   |¡}| |¡ dS ©ú)Appends a child to the object's children.N)r6   Úappend)r   r2   Úchildr0   r"   r"   r#   Úappend_childÞ   s    
zTreeNode.append_childc                 C   s   |   |¡}|g|||…< dS ©ú+Inserts a child into the object's children.N©r6   )r   r2   ÚindexrB   r0   r"   r"   r#   Úinsert_childã   s    
zTreeNode.insert_childc                 C   s   dS ©á|  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"   r1   r"   r"   r#   Úconfirm_deleteè   s    
zTreeNode.confirm_deletec                 C   s   |   |¡|= dS ©ú@Deletes a child at a specified index from the object's children.NrF   ©r   r2   rG   r"   r"   r#   Údelete_childô   s    zTreeNode.delete_childc                 C   s   |j || j|dd� dS ©úaSets up or removes a listener for children being replaced on a
        specified object.
        Úfast_ui©ÚremoveÚdispatchN©Úon_trait_changer0   ©r   r2   ÚlistenerrT   r"   r"   r#   Úwhen_children_replacedø   s    
ÿzTreeNode.when_children_replacedc                 C   s   |j || jd |dd� dS ©ú`Sets up or removes a listener for children being changed on a
        specified object.
        Ú_itemsrR   rS   NrV   rX   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u r<|S |  ||¡S )ú1Gets the label to display for a specified object.Nr   ú=r   ©Úlabelr   Ú	formatter©r   r2   rb   r"   r"   r#   Ú	get_label  s    
zTreeNode.get_labelc                 C   s&   | j }|dd… dkr"t|||ƒ dS ©ú&Sets the label for a specified object.Nr   r`   ©rb   r   )r   r2   rb   Ú
label_namer"   r"   r#   Ú	set_label  s    zTreeNode.set_labelc                    sp   | j }|dd… dkrld|ˆˆ f}|s@‡ ‡fdd„}|| j|< n| j |d¡}|du rZdS ˆj|||dd� dS )	úaSets up or removes a listener for the label being changed on a
        specified object.
        Nr   r`   rb   c                    s   ˆ ˆ||ƒS ©z0Ensure listener gets called with correct object.r"   ©ÚtargetÚnameÚnew©rY   r2   r"   r#   Úwrapped_listener'  s    z5TreeNode.when_label_changed.<locals>.wrapped_listenerÚuirS   ©rb   Ú_listener_cacheÚpoprW   )r   r2   rY   rT   rb   Úmemorr   r"   rq   r#   Úwhen_label_changed  s    ÿzTreeNode.when_label_changedc                 C   sR   | j }t||g ƒ}g }t| j|ƒD ]*\}}|du r>| |¡ q"| ||ƒ¡ q"|S ©ú6Get the labels for any columns that have been defined.N)Úcolumn_labelsr   r   Úcolumn_formattersrA   )r   r2   ÚtraitÚlabelsÚ	formattedrc   rb   r"   r"   r#   Úget_column_labels5  s    zTreeNode.get_column_labelsc                    s~   | j }|dkrzd|ˆˆ f}|s8‡ ‡fdd„}|| j|< n| j |d¡}|du rRdS ˆj|||dd� ˆj||d |dd� dS )	ab  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 rl   r"   rm   rq   r"   r#   rr   S  s    z<TreeNode.when_column_labels_change.<locals>.wrapped_listenerNrs   rS   r]   )r{   ru   rv   rW   )r   r2   rY   rT   r}   rw   rr   r"   rq   r#   Úwhen_column_labels_changeE  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u rH|S |  ||¡S ©ú3Gets the tooltip to display for a specified object.r   Nr   r`   ©Útooltipr   Útooltip_formatter)r   r2   r…   r"   r"   r#   Úget_tooltipg  s    
zTreeNode.get_tooltipc                 C   s    |   |¡s| jS |r| jS | jS ©ú(Returns the icon for a specified object.)r3   Ú	icon_itemÚ	icon_openÚ
icon_group©r   r2   Úis_expandedr"   r"   r#   Úget_iconw  s
    
zTreeNode.get_iconc                 C   s   | j S ©ú1Returns the path used to locate an object's icon.©r   r1   r"   r"   r#   Úget_icon_path�  s    zTreeNode.get_icon_pathc                 C   s   | j S ©úlReturns the name to use when adding a new object instance
        (displayed in the "New" submenu).
        ©ro   r1   r"   r"   r#   Úget_name…  s    zTreeNode.get_namec                 C   s   | j S ©ú,Gets the view to use when editing an object.©Úviewr1   r"   r"   r#   Úget_view‹  s    zTreeNode.get_viewc                 C   s   | j S ©ú3Returns the right-click context menu for an object.©Úmenur1   r"   r"   r#   Úget_menu�  s    zTreeNode.get_menuc                 C   s"   | j }t|tƒrt|||d�}|S ©N)Údefault)Ú
backgroundÚ
isinstanceÚstrr   )r   r2   r¤   r"   r"   r#   Úget_background“  s    
zTreeNode.get_backgroundc                 C   s"   | j }t|tƒrt|||d�}|S r¢   )Ú
foregroundr¥   r¦   r   )r   r2   r¨   r"   r"   r#   Úget_foreground™  s    
zTreeNode.get_foregroundr   c                 C   s   | j S )z.Return the renderer for the object and column.)Úrenderer©r   r2   Úcolumnr"   r"   r#   Úget_rendererŸ  s    zTreeNode.get_rendererc                 C   s   | j S ©ú5Returns whether the object's children can be renamed.©Úrenamer1   r"   r"   r#   Ú
can_rename£  s    zTreeNode.can_renamec                 C   s   | j S ©ú*Returns whether the object can be renamed.©Ú	rename_mer1   r"   r"   r#   Úcan_rename_me§  s    zTreeNode.can_rename_mec                 C   s   | j S ©ú4Returns whether the object's children can be copied.©Úcopyr1   r"   r"   r#   Úcan_copy«  s    zTreeNode.can_copyc                 C   s   | j S ©ú5Returns whether the object's children can be deleted.©Údeleter1   r"   r"   r#   Ú
can_delete¯  s    zTreeNode.can_deletec                 C   s   | j S ©ú*Returns whether the object can be deleted.©Ú	delete_mer1   r"   r"   r#   Úcan_delete_me³  s    zTreeNode.can_delete_mec                 C   s   | j S ©úVReturns whether the object's children can be inserted (vs.
        appended).
        ©Úinsertr1   r"   r"   r#   Ú
can_insert·  s    zTreeNode.can_insertc                 C   s   | j S ©úVReturns whether the object's children should be automatically
        opened.
        ©Ú	auto_openr1   r"   r"   r#   Úcan_auto_open½  s    zTreeNode.can_auto_openc                 C   s   | j S ©úVReturns whether the object's children should be automatically
        closed.
        ©Ú
auto_closer1   r"   r"   r#   Úcan_auto_closeÃ  s    zTreeNode.can_auto_closec                 C   s   t || jƒp|j| jŽ S )zAReturns whether this is the node that handles a specified object.©r¥   Únode_for_classZhas_traits_interfaceÚnode_for_interfacer1   r"   r"   r#   Úis_node_forÉ  s
    ÿ
þzTreeNode.is_node_forc                 C   sL   |   |¡}|  |¡rdS | jD ](}t|ƒtv r6|d }t||ƒr dS qdS ©ú8Returns whether a given object is droppable on the node.Tr   F©Ú
_class_forÚ
is_addableÚmoveÚtyper   Ú
issubclass)r   r2   Ú
add_objectr'   Úitemr"   r"   r#   Úcan_addÏ  s    



zTreeNode.can_addc                 C   s   | j S ©ú<Returns the list of classes that can be added to the object.©Úaddr1   r"   r"   r#   Úget_addÝ  s    zTreeNode.get_addc                 C   s   |S ©ú2Returns a draggable version of a specified object.r"   r1   r"   r"   r#   Úget_drag_objectá  s    zTreeNode.get_drag_objectc                 C   sh   |   |¡}|  |¡r|S | jD ]D}t|ƒtv rPt||d ƒrb|d ||ƒ  S qt||ƒr|  S q|S )ú2Returns a droppable version of a specified object.r   r   rÜ   )r   r2   Údropped_objectr'   rã   r"   r"   r#   Údrop_objectå  s    




zTreeNode.drop_objectc                 C   s   | j dur|   |¡ dS dS ©ú!Handles an object being selected.NT©Ú	on_selectr1   r"   r"   r#   Úselectô  s    

zTreeNode.selectc                 C   s   | j dur|   |¡ dS dS ©ú Handles an object being clicked.NT©Úon_clickr1   r"   r"   r#   Úclickü  s    

zTreeNode.clickc                 C   s   | j dur|   |¡ dS dS ©ú'Handles an object being double-clicked.NT©Ú	on_dclickr1   r"   r"   r#   Údclick  s    

zTreeNode.dclickc                 C   s   | j dur|   |¡ dS dS ©ú"Handles an object being activated.NT©Úon_activatedr1   r"   r"   r#   Ú	activated  s    

zTreeNode.activatedc                 C   s4   | j D ](}t|ƒtv r|d }t||ƒr dS qdS )zBReturns 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.)r¥   rà   r!   r1   r"   r"   r#   rÝ     s    
zTreeNode._class_for)r   )`Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r0   rb   r{   r…   ro   r   r±   r¶   r»   rÀ   rÅ   rÊ   rÏ   rÔ   r   r   rè   rß   r   r   r×   rØ   r   rc   r   r|   r†   ró   rø   rý   r  r   r›   r    rŠ   rŒ   r‹   r   r¤   r¨   rª   r   ru   r   r   r,   r-   r3   r7   r6   r>   rC   rH   rK   rO   rZ   r^   re   rj   rx   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Ý   Ú__classcell__r"   r"   r    r#   r   2   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 )r.   Nr"   r+   r"   r"   r#   r3   -  s    zITreeNode.allows_childrenc                 C   s   dS )r4   Nr"   r+   r"   r"   r#   r7   0  s    zITreeNode.has_childrenc                 C   s   dS r8   r"   r+   r"   r"   r#   r6   3  s    zITreeNode.get_childrenc                 C   s   dS )r=   Nr"   r+   r"   r"   r#   r>   6  s    zITreeNode.get_children_idc                 C   s   dS r?   r"   ©r   rB   r"   r"   r#   rC   9  s    zITreeNode.append_childc                 C   s   dS rD   r"   ©r   rG   rB   r"   r"   r#   rH   <  s    zITreeNode.insert_childc                 C   s   dS rI   r"   r+   r"   r"   r#   rK   ?  s    zITreeNode.confirm_deletec                 C   s   dS rL   r"   ©r   rG   r"   r"   r#   rO   J  s    zITreeNode.delete_childc                 C   s   dS ©rQ   Nr"   ©r   rY   rT   r"   r"   r#   rZ   M  s    z ITreeNode.when_children_replacedc                 C   s   dS ©r\   Nr"   r  r"   r"   r#   r^   R  s    zITreeNode.when_children_changedc                 C   s   dS )r_   Nr"   r+   r"   r"   r#   re   W  s    zITreeNode.get_labelc                 C   s   dS ©rg   Nr"   ©r   rb   r"   r"   r#   rj   Z  s    zITreeNode.set_labelc                 C   s   dS ©rk   Nr"   r  r"   r"   r#   rx   ]  s    zITreeNode.when_label_changedc                 C   s   dS ry   r"   r1   r"   r"   r#   r€   b  s    zITreeNode.get_column_labelsc                 C   s   dS ©áb  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"   rX   r"   r"   r#   r�   e  s    z#ITreeNode.when_column_labels_changec                 C   s   dS )rƒ   Nr"   r+   r"   r"   r#   r‡   o  s    zITreeNode.get_tooltipc                 C   s   dS )r‰   Nr"   ©r   rŽ   r"   r"   r#   r�   r  s    zITreeNode.get_iconc                 C   s   dS )r‘   Nr"   r+   r"   r"   r#   r“   u  s    zITreeNode.get_icon_pathc                 C   s   dS )r•   Nr"   r+   r"   r"   r#   r—   x  s    zITreeNode.get_namec                 C   s   dS ©r™   Nr"   r+   r"   r"   r#   rœ   }  s    zITreeNode.get_viewc                 C   s   dS ©rž   Nr"   r+   r"   r"   r#   r¡   €  s    zITreeNode.get_menuc                 C   s   dS )r¯   Nr"   r+   r"   r"   r#   r²   ƒ  s    zITreeNode.can_renamec                 C   s   dS )r´   Nr"   r+   r"   r"   r#   r·   †  s    zITreeNode.can_rename_mec                 C   s   dS )r¹   Nr"   r+   r"   r"   r#   r¼   ‰  s    zITreeNode.can_copyc                 C   s   dS )r¾   Nr"   r+   r"   r"   r#   rÁ   Œ  s    zITreeNode.can_deletec                 C   s   dS )rÃ   Nr"   r+   r"   r"   r#   rÆ   �  s    zITreeNode.can_delete_mec                 C   s   dS )rÈ   Nr"   r+   r"   r"   r#   rË   ’  s    zITreeNode.can_insertc                 C   s   dS )rÍ   Nr"   r+   r"   r"   r#   rÐ   —  s    zITreeNode.can_auto_openc                 C   s   dS )rÒ   Nr"   r+   r"   r"   r#   rÕ   œ  s    zITreeNode.can_auto_closec                 C   s   dS )rÛ   Nr"   ©r   râ   r"   r"   r#   rä   ¡  s    zITreeNode.can_addc                 C   s   dS )ræ   Nr"   r+   r"   r"   r#   ré   ¤  s    zITreeNode.get_addc                 C   s   dS )rë   Nr"   r+   r"   r"   r#   rì   §  s    zITreeNode.get_drag_objectc                 C   s   dS )rí   Nr"   ©r   rî   r"   r"   r#   rï   ª  s    zITreeNode.drop_objectc                 C   s   dS ©rñ   Nr"   r+   r"   r"   r#   rô   ­  s    zITreeNode.selectc                 C   s   dS ©rö   Nr"   r+   r"   r"   r#   rù   °  s    zITreeNode.clickc                 C   s   dS ©rû   Nr"   r+   r"   r"   r#   rþ   ³  s    zITreeNode.dclickc                 C   s   dS ©r   Nr"   r+   r"   r"   r#   r  ¶  s    zITreeNode.activatedN)(r  r  r  r3   r7   r6   r>   rC   rH   rK   rO   rZ   r^   re   rj   rx   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	  ,  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ÚITreeNodeAdapteraH  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 )r.   Fr"   r+   r"   r"   r#   r3   Õ  s    z ITreeNodeAdapter.allows_childrenc                 C   s   dS )r4   Fr"   r+   r"   r"   r#   r7   Ù  s    zITreeNodeAdapter.has_childrenc                 C   s   g S ©r9   r"   r+   r"   r"   r#   r6   Ý  s    zITreeNodeAdapter.get_childrenc                 C   s   dS ©r=   r   r"   r+   r"   r"   r#   r>   á  s    z ITreeNodeAdapter.get_children_idc                 C   s   dS r?   r"   r
  r"   r"   r#   rC   å  s    zITreeNodeAdapter.append_childc                 C   s   dS rD   r"   r  r"   r"   r#   rH   é  s    zITreeNodeAdapter.insert_childc                 C   s   dS )rJ   Fr"   r+   r"   r"   r#   rK   í  s    
zITreeNodeAdapter.confirm_deletec                 C   s   dS rL   r"   r  r"   r"   r#   rO   ù  s    zITreeNodeAdapter.delete_childc                 C   s   dS r  r"   r  r"   r"   r#   rZ   ý  s    z'ITreeNodeAdapter.when_children_replacedc                 C   s   dS r  r"   r  r"   r"   r#   r^     s    z&ITreeNodeAdapter.when_children_changedc                 C   s   dS )r_   zNo label specifiedr"   r+   r"   r"   r#   re   	  s    zITreeNodeAdapter.get_labelc                 C   s   dS r  r"   r  r"   r"   r#   rj     s    zITreeNodeAdapter.set_labelc                 C   s   dS r  r"   r  r"   r"   r#   rx     s    z#ITreeNodeAdapter.when_label_changedc                 C   s   g S ©rz   r"   r+   r"   r"   r#   r€     s    z"ITreeNodeAdapter.get_column_labelsc                 C   s   dS r  r"   r  r"   r"   r#   r�     s    	z*ITreeNodeAdapter.when_column_labels_changec                 C   s   dS )rƒ   r   r"   r+   r"   r"   r#   r‡   &  s    zITreeNodeAdapter.get_tooltipc                 C   s   dS )zÁReturns the icon for a specified object.

        Valid values are '<item>' (file looking icon), '<group>' (closed folder
        looking icon) and '<open>' (open folder looking icon).
        r   r"   r  r"   r"   r#   r�   *  s    zITreeNodeAdapter.get_iconc                 C   s   dS )r‘   r   r"   r+   r"   r"   r#   r“   2  s    zITreeNodeAdapter.get_icon_pathc                 C   s   dS )r•   r   r"   r+   r"   r"   r#   r—   6  s    zITreeNodeAdapter.get_namec                 C   s   dS r  r"   r+   r"   r"   r#   rœ   <  s    zITreeNodeAdapter.get_viewc                 C   s   dS r  r"   r+   r"   r"   r#   r¡   @  s    zITreeNodeAdapter.get_menuc                 C   s   dS )ú!Returns the background for objectNr"   r+   r"   r"   r#   r§   D  s    zITreeNodeAdapter.get_backgroundc                 C   s   dS )ú!Returns the foreground for objectNr"   r+   r"   r"   r#   r©   H  s    zITreeNodeAdapter.get_foregroundr   c                 C   s   dS )úReturns the renderer for objectNr"   )r   r¬   r"   r"   r#   r­   L  s    zITreeNodeAdapter.get_rendererc                 C   s   dS )r¯   Fr"   r+   r"   r"   r#   r²   P  s    zITreeNodeAdapter.can_renamec                 C   s   dS )r´   Fr"   r+   r"   r"   r#   r·   T  s    zITreeNodeAdapter.can_rename_mec                 C   s   dS )r¹   Fr"   r+   r"   r"   r#   r¼   X  s    zITreeNodeAdapter.can_copyc                 C   s   dS )r¾   Fr"   r+   r"   r"   r#   rÁ   \  s    zITreeNodeAdapter.can_deletec                 C   s   dS )rÃ   Fr"   r+   r"   r"   r#   rÆ   `  s    zITreeNodeAdapter.can_delete_mec                 C   s   dS )rÈ   Fr"   r+   r"   r"   r#   rË   d  s    zITreeNodeAdapter.can_insertc                 C   s   dS )rÍ   Fr"   r+   r"   r"   r#   rÐ   j  s    zITreeNodeAdapter.can_auto_openc                 C   s   dS )rÒ   Fr"   r+   r"   r"   r#   rÕ   p  s    zITreeNodeAdapter.can_auto_closec                 C   s   dS )rÛ   Fr"   r  r"   r"   r#   rä   v  s    zITreeNodeAdapter.can_addc                 C   s   g S rå   r"   r+   r"   r"   r#   ré   z  s    zITreeNodeAdapter.get_addc                 C   s   | j S rê   )Zadapteer+   r"   r"   r#   rì   ~  s    z ITreeNodeAdapter.get_drag_objectc                 C   s   |S ©rí   r"   r  r"   r"   r#   rï   ‚  s    zITreeNodeAdapter.drop_objectc                 C   s   dS r  r"   r+   r"   r"   r#   rô   †  s    zITreeNodeAdapter.selectc                 C   s   dS r  r"   r+   r"   r"   r#   rù   Š  s    zITreeNodeAdapter.clickc                 C   s   dS r  r"   r+   r"   r"   r#   rþ   Ž  s    zITreeNodeAdapter.dclickc                 C   s   dS r  r"   r+   r"   r"   r#   r  ’  s    zITreeNodeAdapter.activatedN)r   ),r  r  r  r  r3   r7   r6   r>   rC   rH   rK   rO   rZ   r^   re   rj   rx   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  ¿  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  ¡ S ©r.   )Úadapterr3   r1   r"   r"   r#   r3   §  s    z&ITreeNodeAdapterBridge.allows_childrenc                 C   s
   | j  ¡ S ©r4   )r(  r7   r1   r"   r"   r#   r7   «  s    z#ITreeNodeAdapterBridge.has_childrenc                 C   s
   | j  ¡ S r  )r(  r6   r1   r"   r"   r#   r6   ¯  s    z#ITreeNodeAdapterBridge.get_childrenc                 C   s
   | j  ¡ S r<   )r(  r>   r1   r"   r"   r#   r>   ³  s    z&ITreeNodeAdapterBridge.get_children_idc                 C   s   | j  |¡S ©r@   )r(  rC   ©r   r2   rB   r"   r"   r#   rC   ·  s    z#ITreeNodeAdapterBridge.append_childc                 C   s   | j  ||¡S ©rE   )r(  rH   ©r   r2   rG   rB   r"   r"   r#   rH   »  s    z#ITreeNodeAdapterBridge.insert_childc                 C   s
   | j  ¡ S ©rJ   )r(  rK   r1   r"   r"   r#   rK   ¿  s    
z%ITreeNodeAdapterBridge.confirm_deletec                 C   s   | j  |¡S ©rM   )r(  rO   rN   r"   r"   r#   rO   Ë  s    z#ITreeNodeAdapterBridge.delete_childc                 C   s   | j  ||¡S ©rQ   )r(  rZ   rX   r"   r"   r#   rZ   Ï  s    z-ITreeNodeAdapterBridge.when_children_replacedc                 C   s   | j  ||¡S ©r\   )r(  r^   rX   r"   r"   r#   r^   Õ  s    z,ITreeNodeAdapterBridge.when_children_changedc                 C   s
   | j  ¡ S ©r_   )r(  re   r1   r"   r"   r#   re   Û  s    z ITreeNodeAdapterBridge.get_labelc                 C   s   | j  |¡S ©rg   )r(  rj   rd   r"   r"   r#   rj   ß  s    z ITreeNodeAdapterBridge.set_labelc                 C   s   | j  ||¡S ©rk   )r(  rx   rX   r"   r"   r#   rx   ã  s    z)ITreeNodeAdapterBridge.when_label_changedc                 C   s
   | j  ¡ S r!  )r(  r€   r1   r"   r"   r#   r€   é  s    z(ITreeNodeAdapterBridge.get_column_labelsc                 C   s   | j  ||¡S )r  )r(  r�   rX   r"   r"   r#   r�   í  s    	z0ITreeNodeAdapterBridge.when_column_labels_changec                 C   s
   | j  ¡ S ©rƒ   )r(  r‡   r1   r"   r"   r#   r‡   ø  s    z"ITreeNodeAdapterBridge.get_tooltipc                 C   s   | j  |¡S rˆ   )r(  r�   r�   r"   r"   r#   r�   ü  s    zITreeNodeAdapterBridge.get_iconc                 C   s
   | j  ¡ S r�   )r(  r“   r1   r"   r"   r#   r“      s    z$ITreeNodeAdapterBridge.get_icon_pathc                 C   s
   | j  ¡ S r”   )r(  r—   r1   r"   r"   r#   r—     s    zITreeNodeAdapterBridge.get_namec                 C   s
   | j  ¡ S r˜   )r(  rœ   r1   r"   r"   r#   rœ   
  s    zITreeNodeAdapterBridge.get_viewc                 C   s
   | j  ¡ S r�   )r(  r¡   r1   r"   r"   r#   r¡     s    zITreeNodeAdapterBridge.get_menuc                 C   s
   | j  ¡ S )r"  )r(  r§   r1   r"   r"   r#   r§     s    z%ITreeNodeAdapterBridge.get_backgroundc                 C   s
   | j  ¡ S )r#  )r(  r©   r1   r"   r"   r#   r©     s    z%ITreeNodeAdapterBridge.get_foregroundr   c                 C   s   | j  |¡S )r$  )r(  r­   r«   r"   r"   r#   r­     s    z#ITreeNodeAdapterBridge.get_rendererc                 C   s
   | j  ¡ S r®   )r(  r²   r1   r"   r"   r#   r²     s    z!ITreeNodeAdapterBridge.can_renamec                 C   s
   | j  ¡ S r³   )r(  r·   r1   r"   r"   r#   r·   "  s    z$ITreeNodeAdapterBridge.can_rename_mec                 C   s
   | j  ¡ S r¸   )r(  r¼   r1   r"   r"   r#   r¼   &  s    zITreeNodeAdapterBridge.can_copyc                 C   s
   | j  ¡ S r½   )r(  rÁ   r1   r"   r"   r#   rÁ   *  s    z!ITreeNodeAdapterBridge.can_deletec                 C   s
   | j  ¡ S rÂ   )r(  rÆ   r1   r"   r"   r#   rÆ   .  s    z$ITreeNodeAdapterBridge.can_delete_mec                 C   s
   | j  ¡ S rÇ   )r(  rË   r1   r"   r"   r#   rË   2  s    z!ITreeNodeAdapterBridge.can_insertc                 C   s
   | j  ¡ S rÌ   )r(  rÐ   r1   r"   r"   r#   rÐ   8  s    z$ITreeNodeAdapterBridge.can_auto_openc                 C   s
   | j  ¡ S rÑ   )r(  rÕ   r1   r"   r"   r#   rÕ   >  s    z%ITreeNodeAdapterBridge.can_auto_closec                 C   s   | j  |¡S ©rÛ   )r(  rä   ©r   r2   râ   r"   r"   r#   rä   D  s    zITreeNodeAdapterBridge.can_addc                 C   s
   | j  ¡ S rå   )r(  ré   r1   r"   r"   r#   ré   H  s    zITreeNodeAdapterBridge.get_addc                 C   s
   | j  ¡ S rê   )r(  rì   r1   r"   r"   r#   rì   L  s    z&ITreeNodeAdapterBridge.get_drag_objectc                 C   s   | j  |¡S r%  )r(  rï   ©r   r2   rî   r"   r"   r#   rï   P  s    z"ITreeNodeAdapterBridge.drop_objectc                 C   s
   | j  ¡ S ©rñ   )r(  rô   r1   r"   r"   r#   rô   T  s    zITreeNodeAdapterBridge.selectc                 C   s
   | j  ¡ S ©rö   )r(  rù   r1   r"   r"   r#   rù   X  s    zITreeNodeAdapterBridge.clickc                 C   s
   | j  ¡ S ©rû   )r(  rþ   r1   r"   r"   r#   rþ   \  s    zITreeNodeAdapterBridge.dclickc                 C   s
   | j  ¡ S ©r   )r(  r  r1   r"   r"   r#   r  `  s    z ITreeNodeAdapterBridge.activatedN)r   )/r  r  r  r  r   r	  r(  r3   r7   r6   r>   rC   rH   rK   rO   rZ   r^   re   rj   rx   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&  œ  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
   |  | ¡S r'  )Útno_allows_childrenr1   r"   r"   r#   r3   n  s    zObjectTreeNode.allows_childrenc                 C   s
   |  | ¡S r)  )Útno_has_childrenr1   r"   r"   r#   r7   r  s    zObjectTreeNode.has_childrenc                 C   s
   |  | ¡S r  ©Útno_get_childrenr1   r"   r"   r#   r6   v  s    zObjectTreeNode.get_childrenc                 C   s
   |  | ¡S r<   )Útno_get_children_idr1   r"   r"   r#   r>   z  s    zObjectTreeNode.get_children_idc                 C   s   |  | |¡S r*  )Útno_append_childr+  r"   r"   r#   rC   ~  s    zObjectTreeNode.append_childc                 C   s   |  | ||¡S r,  )Útno_insert_childr-  r"   r"   r#   rH   ‚  s    zObjectTreeNode.insert_childc                 C   s
   |  | ¡S r.  )Útno_confirm_deleter1   r"   r"   r#   rK   †  s    
zObjectTreeNode.confirm_deletec                 C   s   |  | |¡S r/  )Útno_delete_childrN   r"   r"   r#   rO   ’  s    zObjectTreeNode.delete_childc                 C   s   |  | ||¡S r0  )Útno_when_children_replacedrX   r"   r"   r#   rZ   –  s    z%ObjectTreeNode.when_children_replacedc                 C   s   |  | ||¡S r1  )Útno_when_children_changedrX   r"   r"   r#   r^   œ  s    z$ObjectTreeNode.when_children_changedc                 C   s
   |  | ¡S r2  )Útno_get_labelr1   r"   r"   r#   re   ¢  s    zObjectTreeNode.get_labelc                 C   s   |  | |¡S r3  )Útno_set_labelrd   r"   r"   r#   rj   ¦  s    zObjectTreeNode.set_labelc                 C   s   |  | ||¡S r4  )Útno_when_label_changedrX   r"   r"   r#   rx   ª  s    z!ObjectTreeNode.when_label_changedc                 C   s
   |  | ¡S r5  )Útno_get_tooltipr1   r"   r"   r#   r‡   °  s    zObjectTreeNode.get_tooltipc                 C   s   |  | |¡S rˆ   )Útno_get_iconr�   r"   r"   r#   r�   ´  s    zObjectTreeNode.get_iconc                 C   s
   |  | ¡S r�   )Útno_get_icon_pathr1   r"   r"   r#   r“   ¸  s    zObjectTreeNode.get_icon_pathc                 C   s
   |  | ¡S r”   )Útno_get_namer1   r"   r"   r#   r—   ¼  s    zObjectTreeNode.get_namec                 C   s
   |  | ¡S r˜   )Útno_get_viewr1   r"   r"   r#   rœ   Â  s    zObjectTreeNode.get_viewc                 C   s
   |  | ¡S r�   )Útno_get_menur1   r"   r"   r#   r¡   Æ  s    zObjectTreeNode.get_menuc                 C   s
   |  | ¡S r®   )Útno_can_renamer1   r"   r"   r#   r²   Ê  s    zObjectTreeNode.can_renamec                 C   s
   |  | ¡S r³   )Útno_can_rename_mer1   r"   r"   r#   r·   Î  s    zObjectTreeNode.can_rename_mec                 C   s
   |  | ¡S r¸   )Útno_can_copyr1   r"   r"   r#   r¼   Ò  s    zObjectTreeNode.can_copyc                 C   s
   |  | ¡S r½   )Útno_can_deleter1   r"   r"   r#   rÁ   Ö  s    zObjectTreeNode.can_deletec                 C   s
   |  | ¡S rÂ   )Útno_can_delete_mer1   r"   r"   r#   rÆ   Ú  s    zObjectTreeNode.can_delete_mec                 C   s
   |  | ¡S rÇ   )Útno_can_insertr1   r"   r"   r#   rË   Þ  s    zObjectTreeNode.can_insertc                 C   s
   |  | ¡S rÌ   )Útno_can_auto_openr1   r"   r"   r#   rÐ   ä  s    zObjectTreeNode.can_auto_openc                 C   s
   |  | ¡S rÑ   )Útno_can_auto_closer1   r"   r"   r#   rÕ   ê  s    zObjectTreeNode.can_auto_closec                 C   s   t |tƒr| | ¡S dS )úXReturns whether this is the node that should handle a
        specified object.
        F)r¥   ÚTreeNodeObjectÚtno_is_node_forr1   r"   r"   r#   rÙ   ð  s    

zObjectTreeNode.is_node_forc                 C   s   |  | |¡S r6  )Útno_can_addr7  r"   r"   r#   rä   ù  s    zObjectTreeNode.can_addc                 C   s
   |  | ¡S rå   )Útno_get_addr1   r"   r"   r#   ré   ý  s    zObjectTreeNode.get_addc                 C   s
   |  | ¡S rê   )Útno_get_drag_objectr1   r"   r"   r#   rì     s    zObjectTreeNode.get_drag_objectc                 C   s   |  | |¡S r%  )Útno_drop_objectr8  r"   r"   r#   rï     s    zObjectTreeNode.drop_objectc                 C   s
   |  | ¡S r9  )Ú
tno_selectr1   r"   r"   r#   rô   	  s    zObjectTreeNode.selectc                 C   s
   |  | ¡S r:  )Ú	tno_clickr1   r"   r"   r#   rù     s    zObjectTreeNode.clickc                 C   s
   |  | ¡S r;  )Ú
tno_dclickr1   r"   r"   r#   rþ     s    zObjectTreeNode.dclickc                 C   s
   |  | ¡S r<  )Útno_activatedr1   r"   r"   r#   r    s    zObjectTreeNode.activatedN)'r  r  r  r3   r7   r6   r>   rC   rH   rK   rO   rZ   r^   re   rj   rx   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=  m  sH   	r=  c                   @   s6  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[  z6Represents the object that corresponds to a tree node.c                 C   s
   |j dkS )z,Returns whether this object allows children.r   r/   ©r   Únoder"   r"   r#   r>     s    z"TreeNodeObject.tno_allows_childrenc                 C   s   t |  |¡ƒdkS )z)Returns whether this object has children.r   )r5   rA  re  r"   r"   r#   r?  $  s    zTreeNodeObject.tno_has_childrenc                 C   s   t | |jdƒS r8   r:   re  r"   r"   r#   rA  (  s    zTreeNodeObject.tno_get_childrenc                 C   s   |j S r<   r/   re  r"   r"   r#   rB  ,  s    z"TreeNodeObject.tno_get_children_idc                 C   s   |   |¡ |¡ dS r?   )rA  rA   )r   rf  rB   r"   r"   r#   rC  0  s    zTreeNodeObject.tno_append_childc                 C   s   |   |¡}|g|||…< dS rD   r@  )r   rf  rG   rB   r0   r"   r"   r#   rD  4  s    
zTreeNodeObject.tno_insert_childc                 C   s   dS rI   r"   re  r"   r"   r#   rE  9  s    
z!TreeNodeObject.tno_confirm_deletec                 C   s   |   |¡|= dS rL   r@  )r   rf  rG   r"   r"   r#   rF  E  s    zTreeNodeObject.tno_delete_childc                 C   s   | j ||j|dd� dS rP   rV   ©r   rf  rY   rT   r"   r"   r#   rG  J  s    
ÿz)TreeNodeObject.tno_when_children_replacedc                 C   s   | j ||jd |dd� dS r[   rV   rg  r"   r"   r#   rH  R  s    üz(TreeNodeObject.tno_when_children_changedc                 C   sF   |j }|dd… dkr"|dd… S t| |ƒ}|jdu r:|S | | |¡S )r_   Nr   r`   ra   )r   rf  rb   r"   r"   r#   rI  ]  s    

zTreeNodeObject.tno_get_labelc                 C   s&   |j }|dd… dkr"t| ||ƒ dS rf   rh   )r   rf  rb   ri   r"   r"   r#   rJ  j  s    zTreeNodeObject.tno_set_labelc                    sp   |j }|dd… dkrld||ˆ f}|s@‡ ‡fdd„}|ˆj|< nˆj |d¡}|du rZdS ˆj|||dd� dS )	zbSets up or removes a listener for  the label being changed on a
        specified object.
        Nr   r`   rb   c                    s   ˆ ˆ||ƒS rl   r"   rm   ©rY   r   r"   r#   rr   y  s    z?TreeNodeObject.tno_when_label_changed.<locals>.wrapped_listenerrs   rS   rt   )r   rf  rY   rT   rb   rw   rr   r"   rh  r#   rK  p  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u rF|S | | |¡S r‚   r„   )r   rf  r…   r"   r"   r#   rL  ‡  s    

zTreeNodeObject.tno_get_tooltipc                 C   s    |   |¡s|jS |r|jS |jS rˆ   )r>  rŠ   r‹   rŒ   )r   rf  rŽ   r"   r"   r#   rM  —  s
    
zTreeNodeObject.tno_get_iconc                 C   s   |j S r�   r’   re  r"   r"   r#   rN  ¡  s    z TreeNodeObject.tno_get_icon_pathc                 C   s   |j S r”   r–   re  r"   r"   r#   rO  ¥  s    zTreeNodeObject.tno_get_namec                 C   s   |j S r˜   rš   re  r"   r"   r#   rP  «  s    zTreeNodeObject.tno_get_viewc                 C   s   |j S r�   rŸ   re  r"   r"   r#   rQ  ¯  s    zTreeNodeObject.tno_get_menuc                 C   s   |j S r®   r°   re  r"   r"   r#   rR  ³  s    zTreeNodeObject.tno_can_renamec                 C   s   |j S r³   rµ   re  r"   r"   r#   rS  ·  s    z TreeNodeObject.tno_can_rename_mec                 C   s   |j S r¸   rº   re  r"   r"   r#   rT  »  s    zTreeNodeObject.tno_can_copyc                 C   s   |j S r½   r¿   re  r"   r"   r#   rU  ¿  s    zTreeNodeObject.tno_can_deletec                 C   s   |j S rÂ   rÄ   re  r"   r"   r#   rV  Ã  s    z TreeNodeObject.tno_can_delete_mec                 C   s   |j S rÇ   rÉ   re  r"   r"   r#   rW  Ç  s    zTreeNodeObject.tno_can_insertc                 C   s   |j S rÌ   rÎ   re  r"   r"   r#   rX  Í  s    z TreeNodeObject.tno_can_auto_openc                 C   s   |j S rÑ   rÓ   re  r"   r"   r#   rY  Ó  s    z!TreeNodeObject.tno_can_auto_closec                 C   s   t | |jƒp| j|jŽ S )rZ  rÖ   re  r"   r"   r#   r\  Ù  s
    ÿ
þzTreeNodeObject.tno_is_node_forc                 C   sL   |  |¡}| |¡rdS |jD ](}t|ƒtv r6|d }t||ƒr dS qdS rÚ   rÜ   )r   rf  râ   r'   rã   r"   r"   r#   r]  á  s    



zTreeNodeObject.tno_can_addc                 C   s   |j S rå   rç   re  r"   r"   r#   r^  ï  s    zTreeNodeObject.tno_get_addc                 C   s   | S rê   r"   re  r"   r"   r#   r_  ó  s    z"TreeNodeObject.tno_get_drag_objectc                 C   s^   |  |¡r|S |jD ]D}t|ƒtv rFt||d ƒrX|d | |ƒ  S qt||ƒr|  S qdS )rí   r   r   N)rÞ   rß   rà   r   r¥   )r   rf  rî   rã   r"   r"   r#   r`  ÷  s    


zTreeNodeObject.tno_drop_objectc                 C   s   |j dur|  | ¡ dS dS rð   rò   re  r"   r"   r#   ra    s    

zTreeNodeObject.tno_selectc                 C   s   |j dur|  | ¡ dS dS rõ   r÷   re  r"   r"   r#   rb    s    

zTreeNodeObject.tno_clickc                 C   s   |j dur|  | ¡ dS dS rú   rü   re  r"   r"   r#   rc    s    

zTreeNodeObject.tno_dclickc                 C   s   |j dur|  | ¡ dS dS rÿ   r  re  r"   r"   r#   rd    s    

zTreeNodeObject.tno_activatedN)*r  r  r  r  r   ru   r>  r?  rA  rB  rC  rD  rE  rF  rG  rH  rI  rJ  rK  rL  rM  rN  rO  rP  rQ  rR  rS  rT  rU  rV  rW  rX  rY  r\  r]  r^  r_  r`  ra  rb  rc  rd  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 )zUReturns whether this object can have children (True for this
        class).
        Tr"   r1   r"   r"   r#   r3   6  s    zMultiTreeNode.allows_childrenc                 C   s   dS )z?Returns whether this object has children (True for this class).Tr"   r1   r"   r"   r#   r7   <  s    zMultiTreeNode.has_childrenc                    s   ‡ fdd„| j D ƒS )r9   c                    s   g | ]}ˆ |f‘qS r"   r"   )r&   rf  ©r2   r"   r#   r(   B  r)   z.MultiTreeNode.get_children.<locals>.<listcomp>)Únodesr1   r"   rj  r#   r6   @  s    zMultiTreeNode.get_childrenc                 C   s   dS r   r"   r1   r"   r"   r#   r>   D  s    zMultiTreeNode.get_children_idc                 C   s   dS r  r"   rX   r"   r"   r#   rZ   H  s    z$MultiTreeNode.when_children_replacedc                 C   s   dS r  r"   rX   r"   r"   r#   r^   N  s    z#MultiTreeNode.when_children_changedc                 C   s   | j  |¡S r2  )Ú	root_nodere   r1   r"   r"   r#   re   T  s    zMultiTreeNode.get_labelc                 C   s   | j  ||¡S r3  )rl  rj   rd   r"   r"   r#   rj   X  s    zMultiTreeNode.set_labelc                 C   s   | j  |||¡S r4  )rl  rx   rX   r"   r"   r#   rx   \  s    z MultiTreeNode.when_label_changedc                 C   s   | j  ||¡S rˆ   )rl  r�   r�   r"   r"   r#   r�   b  s    zMultiTreeNode.get_iconc                 C   s   | j  |¡S r�   )rl  r“   r1   r"   r"   r#   r“   f  s    zMultiTreeNode.get_icon_pathc                 C   s   | j  |¡S r”   )rl  r—   r1   r"   r"   r#   r—   j  s    zMultiTreeNode.get_namec                 C   s   | j  |¡S r˜   )rl  rœ   r1   r"   r"   r#   rœ   p  s    zMultiTreeNode.get_viewc                 C   s   | j  |¡S r�   )rl  r¡   r1   r"   r"   r#   r¡   t  s    zMultiTreeNode.get_menuc                 C   s   dS )z]Returns whether the object's children can be renamed (False for
        this class).
        Fr"   r1   r"   r"   r#   r²   x  s    zMultiTreeNode.can_renamec                 C   s   dS )zAReturns whether the object can be renamed (False for this class).Fr"   r1   r"   r"   r#   r·   ~  s    zMultiTreeNode.can_rename_mec                 C   s   | j  |¡S r¸   )rl  r¼   r1   r"   r"   r#   r¼   ‚  s    zMultiTreeNode.can_copyc                 C   s   dS )z]Returns whether the object's children can be deleted (False for
        this class).
        Fr"   r1   r"   r"   r#   rÁ   †  s    zMultiTreeNode.can_deletec                 C   s   dS )z@Returns whether the object can be deleted (True for this class).Tr"   r1   r"   r"   r#   rÆ   Œ  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"   r1   r"   r"   r#   rË   �  s    zMultiTreeNode.can_insertc                 C   s   | j  |¡S rÌ   )rl  rÐ   r1   r"   r"   r#   rÐ   –  s    zMultiTreeNode.can_auto_openc                 C   s   | j  |¡S rÑ   )rl  rÕ   r1   r"   r"   r#   rÕ   œ  s    zMultiTreeNode.can_auto_closec                 C   s   dS )z`Returns whether a given object is droppable on the node (False for
        this class).
        Fr"   r7  r"   r"   r#   rä   ¢  s    zMultiTreeNode.can_addc                 C   s   g S rå   r"   r1   r"   r"   r#   ré   ¨  s    zMultiTreeNode.get_addc                 C   s   | j  |¡S rê   )rl  rì   r1   r"   r"   r#   rì   ¬  s    zMultiTreeNode.get_drag_objectc                 C   s   | j  ||¡S r%  )rl  rï   r8  r"   r"   r#   rï   °  s    zMultiTreeNode.drop_objectc                 C   s   | j  |¡S r9  )rl  rô   r1   r"   r"   r#   rô   ´  s    zMultiTreeNode.selectc                 C   s   | j  |¡S r:  )rl  rù   r1   r"   r"   r#   rù   ¸  s    zMultiTreeNode.clickc                 C   s   | j  |¡S r;  )rl  rþ   r1   r"   r"   r#   rþ   ¼  s    zMultiTreeNode.dclickc                 C   s   | j  |¡S r<  )rl  r  r1   r"   r"   r#   r  À  s    zMultiTreeNode.activatedN)&r  r  r  r	   r   rl  r   rk  r3   r7   r6   r>   rZ   r^   re   rj   rx   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#   ri  *  s@   ri  N)!r  Ú	itertoolsr   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[  ri  r"   r"   r"   r#   Ú<module>   s(   D   }  ^ R .  