
    e=
                     6    d dl mZ ddlmZ d Z G d d      Zy)    )OrderedDict   )Nodec                 N    	 t        | t              sy	 t        | d      S #  Y yxY w)NFnodeName)
issubclassr   hasattr)clss    A/usr/lib/python3/dist-packages/pyqtgraph/flowchart/NodeLibrary.pyisNodeClassr      s2    #t$ % 3
##s     $c                   F    e Zd ZdZd Zd
dZd Zd Zd Ze	d        Z
d Zy	)NodeLibraryz
    A library of flowchart Node types. Custom libraries may be built to provide 
    each flowchart with a specific set of allowed Node types.
    c                 @    t               | _        t               | _        y N)r   nodeListnodeTreeselfs    r   __init__zNodeLibrary.__init__   s    ##    c                 $   t        |      st        dt        |      z        |j                  }|s|| j                  v rt        d|z        || j                  |<   |D ]0  }| j
                  }|D ]  }||vrt               ||<   ||   } |||<   2 y)ah  
        Register a new node type. If the type's name is already in use,
        an exception will be raised (unless override=True).
        
        ============== =========================================================
        **Arguments:**
        
        nodeClass      a subclass of Node (must have typ.nodeName)
        paths          list of tuples specifying the location(s) this 
                       type will appear in the library tree.
        override       if True, overwrite any class having the same name
        ============== =========================================================
        z Object %s is not a Node subclassz*Node type name '%s' is already registered.N)r   	Exceptionstrr   r   r   r   )r   	nodeClasspathsoverridenamepathrootns           r   addNodeTypezNodeLibrary.addNodeType   s     9%>YOPP!!DDMM1H4OPP'd 	#D==D D=)mDGAw #DJ	#r   c                 X    	 | j                   |   S # t        $ r t        d|z        w xY w)NzNo node type called '%s')r   KeyErrorr   )r   r   s     r   getNodeTypezNodeLibrary.getNodeType8   s6    	?==&& 	?6=>>	?s    )c                     | j                   S r   )r   r   s    r   getNodeTreezNodeLibrary.getNodeTree>   s    }}r   c                     t               }| j                  j                         |_        | j                  | j                        |_        |S )z0
        Return a copy of this library.
        )r   r   copytreeCopyr   )r   libs     r   r(   zNodeLibrary.copyA   s8     m}}))+}}T]]3
r   c                     t               }| j                         D ].  \  }}t        |      r|||<   t        j	                  |      ||<   0 |S r   )r   itemsr   r   r)   )treer(   kvs       r   r)   zNodeLibrary.treeCopyJ   sM    }::< 	2CAa1~Q%..q1Q		2
 r   c                     t               )z6
        Reload Node classes in this library.
        )NotImplementedErrorr   s    r   reloadzNodeLibrary.reloadT   s     "##r   N)F)__name__
__module____qualname____doc__r   r!   r$   r&   r(   staticmethodr)   r2    r   r   r   r      s9    
&#<?  $r   r   N)collectionsr   r   r   r   r8   r   r   <module>r:      s    # $H$ H$r   