@@ -403,7 +403,9 @@ def value2pickle(self):
403403
404404 @docstrings .get_sectionsf ('Formatoption' )
405405 @dedent
406- def __init__ (self , key , plotter = None , index_in_list = None , ** kwargs ):
406+ def __init__ (self , key , plotter = None , index_in_list = None ,
407+ additional_children = [], additional_dependencies = [],
408+ ** kwargs ):
407409 """
408410 Parameters
409411 ----------
@@ -415,6 +417,11 @@ def __init__(self, key, plotter=None, index_in_list=None, **kwargs):
415417 index_in_list: int or None
416418 The index that shall be used if the data is a
417419 :class:`psyplot.InteractiveList`
420+ additional_children: list or str
421+ Additional children to use (see the :attr:`children` attribute)
422+ additional_dependencies: list or str
423+ Additional dependencies to use (see the :attr:`dependencies`
424+ attribute)
418425 ``**kwargs``
419426 Further keywords may be used to specify different names for
420427 children, dependencies and connection formatoptions that match the
@@ -426,6 +433,10 @@ def __init__(self, key, plotter=None, index_in_list=None, **kwargs):
426433 self .plotter = plotter
427434 self .index_in_list = index_in_list
428435 self .shared = set ()
436+ self .additional_children = additional_children
437+ self .additional_dependencies = additional_dependencies
438+ self .children = self .children + additional_children
439+ self .dependencies = self .dependencies + additional_dependencies
429440 self ._child_mapping = dict (zip (* tee (chain (
430441 self .children , self .dependencies , self .connections ,
431442 self .parents ), 2 )))
@@ -455,7 +466,10 @@ def __get__(self, instance, owner):
455466 return getattr (instance , '_' + self .key )
456467 except AttributeError :
457468 fmto = self .__class__ (
458- self .key , instance , self .index_in_list , ** self .init_kwargs )
469+ self .key , instance , self .index_in_list ,
470+ additional_children = self .additional_children ,
471+ additional_dependencies = self .additional_dependencies ,
472+ ** self .init_kwargs )
459473 setattr (instance , '_' + self .key , fmto )
460474 return fmto
461475
0 commit comments