a
    ¨ˆcØ
  ã                   @   s@   d Z ddl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é   )Ú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u rd}n| j j}|S )z0 Returns the string representation of the item. NÚroot)r   Úname)ÚselfÚs© r   úk/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.9/site-packages/apptools/preferences/ui/preferences_node.pyÚ__str__,   s    
zPreferencesNode.__str__c                 C   s   | j  |¡S )z, Creates the preference page for this node. )r   Zcreate_control)r   Úparentr   r   r   Úcreate_page=   s    zPreferencesNode.create_pagec                 C   s"   | j D ]}|j|kr qqd}|S )znReturns the child of this node with the specified Id.

        Returns None if no such child exists.

        N)Úchildrenr
   )r   r
   Únoder   r   r   ÚlookupB   s
    

zPreferencesNode.lookupÚ c                 C   s.   t |dt| ƒƒ | jD ]}| |d ¡ qdS )z" Pretty-print the node to stdout. ÚNodez  N)ÚprintÚstrr   Údump)r   ÚindentÚchildr   r   r   r   V   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   Zi_preferences_pager   Z	tree_itemr   r   r   r   r   r   Ú<module>
   s   