3
6ßL](  ã               @   sD   d Z ddlmZmZmZ ddlmZ ddlmZ G dd„ deƒZ	dS )	z9 Abstract base class for a node in a preferences dialog. é    )ÚDelegateÚInstanceÚStré   )ÚIPreferencesPage)ÚTreeItemc               @   sN   e Zd ZdZedƒZedƒZeeƒZ	dd„ Z
e
Zdd„ Zdd„ Zdd
d„ZdS )ÚPreferencesNodezÐ Abstract base class for a node in a preferences dialog.

    A preferences node has a name and an image which are used to represent the
    node in a preferences dialog (usually in the form of a tree).

    Úpagec             C   s   | j dkrd}n| j j}|S )z0 Returns the string representation of the item. NÚroot)r	   Úname)ÚselfÚs© r   úN/tmp/pip-install-5sebvq2j/apptools/apptools/preferences/ui/preferences_node.pyÚ__str__1   s    
zPreferencesNode.__str__c             C   s   | j j|ƒS )z, Creates the preference page for this node. )r	   Zcreate_control)r   Úparentr   r   r   Úcreate_pageB   s    zPreferencesNode.create_pagec             C   s$   x| j D ]}|j|krP qW d}|S )zo Returns the child of this node with the specified Id.

        Returns None if no such child exists.

        N)Úchildrenr   )r   r   Únoder   r   r   ÚlookupG   s
    
zPreferencesNode.lookupÚ c             C   s2   t |dt| ƒƒ x| jD ]}|j|d ƒ qW dS )z" Pretty-print the node to stdout. ÚNodez  N)ÚprintÚstrr   Údump)r   ÚindentÚchildr   r   r   r   [   s    zPreferencesNode.dumpN)r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Zhelp_idr   r   r   r	   r   Ú__repr__r   r   r   r   r   r   r   r      s   r   N)
r    Z
traits.apir   r   r   Zi_preferences_pager   Z	tree_itemr   r   r   r   r   r   Ú<module>   s   