better dynamic support
This commit is contained in:
parent
7545e6105d
commit
4df2d0e2bf
@ -6,7 +6,7 @@ from .annotator import ERASED_ATTRIBUTES, CONVERT_OPTION
|
|||||||
|
|
||||||
|
|
||||||
FUNC_TO_DICT = []
|
FUNC_TO_DICT = []
|
||||||
ATTRIBUTES_ORDER = ('name', 'doc', 'default', 'multi', 'properties', 'min_number', 'max_number', 'dynamic')
|
ATTRIBUTES_ORDER = ('name', 'doc', 'default', 'multi', 'properties', 'min_number', 'max_number')
|
||||||
|
|
||||||
|
|
||||||
class Root(): # pylint: disable=R0903
|
class Root(): # pylint: disable=R0903
|
||||||
@ -453,6 +453,7 @@ class Family(Common):
|
|||||||
if not self.option_name:
|
if not self.option_name:
|
||||||
self.populate_attrib()
|
self.populate_attrib()
|
||||||
self.parse_properties()
|
self.parse_properties()
|
||||||
|
self.populate_dynamic()
|
||||||
self.option_name = self.elt.reflector_name
|
self.option_name = self.elt.reflector_name
|
||||||
object_name = self.get_object_name()
|
object_name = self.get_object_name()
|
||||||
attrib = self.get_attrib() + \
|
attrib = self.get_attrib() + \
|
||||||
@ -461,17 +462,16 @@ class Family(Common):
|
|||||||
self.populate_informations()
|
self.populate_informations()
|
||||||
return self.option_name
|
return self.option_name
|
||||||
|
|
||||||
|
def populate_dynamic(self):
|
||||||
|
if hasattr(self.elt, 'dynamic'):
|
||||||
|
dyn = self.elt.dynamic.reflector_object.get()
|
||||||
|
self.attrib['suffixes'] = f"Calculation(func.calc_value, Params((ParamOption({dyn}))))"
|
||||||
|
|
||||||
def populate_attrib(self):
|
def populate_attrib(self):
|
||||||
"""parse a populate attributes
|
"""parse a populate attributes
|
||||||
"""
|
"""
|
||||||
for key in self.get_attributes(self.elt):
|
for key in self.get_attributes(self.elt):
|
||||||
value = getattr(self.elt, key)
|
self.attrib[key] = getattr(self.elt, key)
|
||||||
if key == 'dynamic':
|
|
||||||
dynamic = value.reflector_object.get()
|
|
||||||
self.attrib['suffixes'] = \
|
|
||||||
f"Calculation(func.calc_value, Params((ParamOption({dynamic}))))"
|
|
||||||
else:
|
|
||||||
self.attrib[key] = value
|
|
||||||
|
|
||||||
def parse_properties(self):
|
def parse_properties(self):
|
||||||
"""parse current children
|
"""parse current children
|
||||||
|
Loading…
x
Reference in New Issue
Block a user