3
<Ad]³  ã               @   s8   d Z ddlmZmZmZ ddlmZ G dd„ deƒZdS )z Model for tree views. é    )ÚAnyÚ	HasTraitsÚEventé   )Ú	NodeEventc               @   sì   e Zd ZdZeZeeƒZeeƒZ	eeƒ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.S )/Ú	TreeModelz Model for tree views. c             C   s   t ‚dS )a   Returns True if a node has children, otherwise False.

        This method is provided in case the model has an efficient way to
        determine whether or not a node has any children without having to
        actually get the children themselves.

        N)ÚNotImplementedError)ÚselfÚnode© r   úp/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.6/site-packages/pyface-6.1.2-py3.6.egg/pyface/tree/tree_model.pyÚhas_children5   s    	zTreeModel.has_childrenc             C   s   t ‚dS )z! Returns the children of a node. N)r   )r	   r
   r   r   r   Úget_children@   s    zTreeModel.get_childrenc             C   s   |S )zk Get the value that is dragged for a node.

        By default the drag value is the node itself.

        r   )r	   r
   r   r   r   Úget_drag_valueE   s    zTreeModel.get_drag_valuec             C   s   dS )z@ Returns True if a node allows an object to be dropped onto it. Fr   )r	   r
   Úobjr   r   r   Úcan_dropN   s    zTreeModel.can_dropc             C   s   t ‚dS )z Drops an object onto a node. N)r   )r	   r
   r   r   r   r   ÚdropS   s    zTreeModel.dropc             C   s   dS )zj Returns the label image for a node.

        Return None (the default) if no image is required.

        Nr   )r	   r
   ÚselectedZexpandedr   r   r   Ú	get_imageX   s    zTreeModel.get_imagec          	   C   s&   yt |ƒ}W n   t|ƒ}Y nX |S )z# Generate a unique key for a node. )ÚhashÚid)r	   r
   Úkeyr   r   r   Úget_keya   s
    zTreeModel.get_keyc             C   s   |S )zz Get the value that is used when a node is selected.

        By default the selection value is the node itself.

        r   )r	   r
   r   r   r   Úget_selection_valuel   s    zTreeModel.get_selection_valuec             C   s   t |ƒS )z} Returns the label text for a node.

        Return None if no text is required.  By default we return 'str(node)'.

        )Ústr)r	   r
   r   r   r   Úget_textu   s    zTreeModel.get_textc             C   s   t |jƒ ƒdkS )z. Returns True if the node's label can be set. r   )ÚlenÚstrip)r	   r
   Útextr   r   r   Úcan_set_text~   s    zTreeModel.can_set_textc             C   s   dS )z! Sets the label text for a node. Nr   )r	   r
   r   r   r   r   Úset_textƒ   s    zTreeModel.set_textc             C   s   dS )z; Returns True if the node is collapsible, otherwise False. Tr   )r	   r
   r   r   r   Úis_collapsibleˆ   s    zTreeModel.is_collapsiblec             C   s   dS )z9 Returns True if the node is draggable, otherwise False. Tr   )r	   r
   r   r   r   Úis_draggable�   s    zTreeModel.is_draggablec             C   s   dS )zƒ Returns True if the node is editable, otherwise False.

        If the node is editable, its text can be set via the UI.

        Fr   )r	   r
   r   r   r   Úis_editable’   s    zTreeModel.is_editablec             C   s   dS )z; Returns True if the node is expandanble, otherwise False. Tr   )r	   r
   r   r   r   Úis_expandable›   s    zTreeModel.is_expandablec             C   s   dS )z( Adds a listener for changes to a node. Nr   )r	   r
   r   r   r   Úadd_listener    s    zTreeModel.add_listenerc             C   s   dS )z+ Removes a listener for changes to a node. Nr   )r	   r
   r   r   r   Úremove_listener¥   s    zTreeModel.remove_listenerc             C   s   t ||d�| _dS )z  Fires the nodes changed event. )r
   ÚchildrenN)r   Únodes_changed)r	   r
   r'   r   r   r   Úfire_nodes_changedª   s    zTreeModel.fire_nodes_changedc             C   s   t ||d�| _dS )z! Fires the nodes inserted event. )r
   r'   N)r   Únodes_inserted)r	   r
   r'   r   r   r   Úfire_nodes_inserted±   s    zTreeModel.fire_nodes_insertedc             C   s   t t|d�| _dS )z  Fires the nodes removed event. )r
   r'   N)r   r
   Únodes_removed)r	   Úparentr'   r   r   r   Úfire_nodes_removed¸   s    zTreeModel.fire_nodes_removedc             C   s   t |||d�| _dS )z  Fires the nodes removed event. )r
   Úold_childrenr'   N)r   Únodes_replaced)r	   r
   r/   Znew_childrenr   r   r   Úfire_nodes_replaced¿   s    zTreeModel.fire_nodes_replacedc             C   s   t |d�| _dS )z$ Fires the structure changed event. )r
   N)r   Ústructure_changed)r	   r
   r   r   r   Úfire_structure_changedÈ   s    z TreeModel.fire_structure_changedN)#Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Úrootr   r   r(   r*   r,   r0   r2   r   r   r   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r)   r+   r.   r1   r3   r   r   r   r   r      s:   						r   N)r7   Z
traits.apir   r   r   Z
node_eventr   r   r   r   r   r   Ú<module>   s   