fill is a value
This commit is contained in:
@ -484,6 +484,8 @@ class SpaceAnnotator(object):
|
||||
self.filter_separators()
|
||||
self.absolute_path_for_symlink_in_containers()
|
||||
self.convert_helps()
|
||||
#if hasattr(self.space, 'constraints'):
|
||||
# print(vars(self.space.constraints))
|
||||
|
||||
def absolute_path_for_symlink_in_containers(self):
|
||||
if not hasattr(self.space, 'containers'):
|
||||
@ -758,7 +760,7 @@ class SpaceAnnotator(object):
|
||||
is_follower = True
|
||||
else:
|
||||
is_follower = False
|
||||
path = '{}.{}.{}.{}'.format(variables.name, family.name, variable.name, follower.name)
|
||||
path = '{}.{}.{}'.format(family.path, variable.name, follower.name)
|
||||
self._annotate_variable(follower, family_mode, path, is_follower)
|
||||
if HIGH_COMPATIBILITY:
|
||||
# leader's variable are right
|
||||
@ -781,7 +783,7 @@ class SpaceAnnotator(object):
|
||||
# auto_freeze's variable is set in 'basic' mode if its mode is 'normal'
|
||||
if variable.auto_freeze is True and variable.mode != modes_level[-1]:
|
||||
variable.mode = modes_level[0]
|
||||
path = '{}.{}.{}'.format(variables.name, family.name, variable.name)
|
||||
path = '{}.{}'.format(family.path, variable.name)
|
||||
self._annotate_variable(variable, family_mode, path)
|
||||
|
||||
def get_variable(self, name): # pylint: disable=C0111
|
||||
@ -1103,6 +1105,18 @@ class SpaceAnnotator(object):
|
||||
del_idx.sort(reverse=True)
|
||||
for idx in del_idx:
|
||||
space.constraints.fill.pop(idx)
|
||||
for fill in space.constraints.fill:
|
||||
variable = self.paths.get_variable_obj(fill.target)
|
||||
value = self.objectspace.value()
|
||||
value.type = 'calculation'
|
||||
value.name = fill.name
|
||||
if hasattr(fill, 'param'):
|
||||
value.param = fill.param
|
||||
if not hasattr(variable, 'value'):
|
||||
variable.value = []
|
||||
variable.value.append(value)
|
||||
self.force_not_mandatory.append(fill.target)
|
||||
del space.constraints.fill
|
||||
|
||||
def filter_targets(self): # pylint: disable=C0111
|
||||
for condition_idx, condition in enumerate(self.space.constraints.condition):
|
||||
|
@ -506,7 +506,7 @@ class CreoleObjSpace(object):
|
||||
if not attr.startswith('_'):
|
||||
yield attr
|
||||
|
||||
def _sub_xml_export(self, name, node, node_name, space):
|
||||
def _sub_xml_export(self, name, node, node_name, space, current_space):
|
||||
if isinstance(space, dict):
|
||||
space = list(space.values())
|
||||
if isinstance(space, list):
|
||||
@ -533,13 +533,13 @@ class CreoleObjSpace(object):
|
||||
child_node = SubElement(node, name)
|
||||
for subname in self._get_attributes(space):
|
||||
subspace = getattr(space, subname)
|
||||
self._sub_xml_export(subname, child_node, name, subspace)
|
||||
self._sub_xml_export(subname, child_node, name, subspace, space)
|
||||
elif isinstance(space, self.Redefinable):
|
||||
child_node = SubElement(node, 'family')
|
||||
child_node.attrib['name'] = name
|
||||
for subname in self._get_attributes(space):
|
||||
subspace = getattr(space, subname)
|
||||
self._sub_xml_export(subname, child_node, name, subspace)
|
||||
self._sub_xml_export(subname, child_node, name, subspace, space)
|
||||
else:
|
||||
# FIXME plutot dans annotator ...
|
||||
if name in PROPERTIES and node.tag in ['variable', 'family', 'leader']:
|
||||
@ -548,7 +548,7 @@ class CreoleObjSpace(object):
|
||||
SubElement(node, 'property').text = prop
|
||||
|
||||
elif name not in ERASED_ATTRIBUTES:
|
||||
if name == 'name' and node_name in self.forced_text_elts_as_name:
|
||||
if name == 'name' and node_name in self.forced_text_elts_as_name and not hasattr(current_space, 'param'):
|
||||
if isinstance(space, str):
|
||||
node.text = space
|
||||
else:
|
||||
@ -571,7 +571,7 @@ class CreoleObjSpace(object):
|
||||
def _xml_export(self, node, space, node_name='creole'):
|
||||
for name in self._get_attributes(space):
|
||||
subspace = getattr(space, name)
|
||||
self._sub_xml_export(name, node, node_name, subspace)
|
||||
self._sub_xml_export(name, node, node_name, subspace, space)
|
||||
|
||||
|
||||
class Path(object):
|
||||
@ -683,10 +683,9 @@ class Path(object):
|
||||
def _get_variable(self, name):
|
||||
if name not in self.variables:
|
||||
if name.startswith('creole.'):
|
||||
raise CreoleDictConsistencyError(
|
||||
_("don't set full path variable in creole's namespace "
|
||||
"(set '{}' not '{}')").format(name.split('.')[-1], name))
|
||||
raise CreoleDictConsistencyError(_('unknown option {}').format(name))
|
||||
name = name.split('.')[-1]
|
||||
if name not in self.variables:
|
||||
raise CreoleDictConsistencyError(_('unknown option {}').format(name))
|
||||
return self.variables[name]
|
||||
|
||||
def get_leader(self, name): # pylint: disable=C0111
|
||||
|
Reference in New Issue
Block a user