recursive_add

pyrubrum.recursive_add(menus: Union[Dict[pyrubrum.menus.base_menu.BaseMenu, Any], Iterable[pyrubrum.menus.base_menu.BaseMenu]], parent: pyrubrum.tree.node.Node)

Link the provided menus to Node instances and add these ones to a provided parent. Finally, for each found value which is iterable, this function is called in a recursive way in order to link its elements to its parent Node.

Parameters
  • menus (MenuIterable) – The provided iterable of the menus which are being added to the parent node. If it is a dictionary, the stored value for each key, if iterable, will be recursively provided as argument to a new call of this function, together with the parent node, which is the key.

  • parent (Node) – The parent the nodes are being added to.