better _if_in and _if_not_in support
This commit is contained in:
@ -243,41 +243,50 @@ class ConditionAnnotator:
|
||||
param.name == 'condition_operator':
|
||||
or_needed = False
|
||||
break
|
||||
fill.index += 1
|
||||
else:
|
||||
fill = self.objectspace.fill(target.xmlfiles)
|
||||
fill.target = listvar.path
|
||||
fill.name = 'calc_value'
|
||||
fill.namespace = 'services'
|
||||
fill.index = -1
|
||||
fill.index = 0
|
||||
if not hasattr(self.objectspace.space.constraints, 'fill'):
|
||||
self.objectspace.space.constraints.fill = []
|
||||
self.objectspace.space.constraints.fill.append(fill)
|
||||
fills[listvar.path] = fill
|
||||
param1 = self.objectspace.param(target.xmlfiles)
|
||||
param1.text = value
|
||||
param1.text = False
|
||||
param1.type = 'boolean'
|
||||
param2 = self.objectspace.param(target.xmlfiles)
|
||||
param2.name = 'default'
|
||||
param2.text = not value
|
||||
param2.text = True
|
||||
param2.type = 'boolean'
|
||||
fill.param = [param1, param2]
|
||||
or_needed = len(condition.param) != 1
|
||||
for param in condition.param:
|
||||
fill.index += 1
|
||||
param3 = self.objectspace.param(target.xmlfiles)
|
||||
param3.name = f'condition_{fill.index}'
|
||||
param3.type = 'variable'
|
||||
param3.text = condition.source
|
||||
fill.param.append(param3)
|
||||
param4 = self.objectspace.param(target.xmlfiles)
|
||||
param4.name = f'expected_{fill.index}'
|
||||
param4.text = getattr(param, 'text', None)
|
||||
fill.param.append(param4)
|
||||
if or_needed:
|
||||
if len(condition.param) == 1:
|
||||
values = getattr(condition.param[0], 'text', None)
|
||||
else:
|
||||
values = tuple([getattr(param, 'text', None) for param in condition.param])
|
||||
param3 = self.objectspace.param(target.xmlfiles)
|
||||
param3.name = f'condition_{fill.index}'
|
||||
param3.type = 'variable'
|
||||
param3.text = condition.source
|
||||
fill.param.append(param3)
|
||||
param4 = self.objectspace.param(target.xmlfiles)
|
||||
param4.name = f'expected_{fill.index}'
|
||||
param4.text = values
|
||||
fill.param.append(param4)
|
||||
if condition.name != 'disabled_if_in':
|
||||
param5 = self.objectspace.param(target.xmlfiles)
|
||||
param5.name = 'condition_operator'
|
||||
param5.text = 'OR'
|
||||
param5.name = f'reverse_condition_{fill.index}'
|
||||
param5.text = True
|
||||
param5.type = 'boolean'
|
||||
fill.param.append(param5)
|
||||
if or_needed:
|
||||
param6 = self.objectspace.param(target.xmlfiles)
|
||||
param6.name = f'condition_operator'
|
||||
param6.text = 'OR'
|
||||
fill.param.append(param6)
|
||||
|
||||
def convert_condition_source(self):
|
||||
"""remove condition for ChoiceOption that don't have param
|
||||
|
Reference in New Issue
Block a user