frozen_if_ => hidden_if_

This commit is contained in:
Emmanuel Garette 2020-07-07 18:33:19 +02:00
parent ef948fa109
commit b12bf443a6
7 changed files with 20 additions and 20 deletions

View file

@ -287,7 +287,7 @@ class SpaceAnnotator(object):
else: else:
self.eosfunc = None self.eosfunc = None
if HIGH_COMPATIBILITY: if HIGH_COMPATIBILITY:
self.has_frozen_if_in_condition = [] self.has_hidden_if_in_condition = []
self.convert_variable() self.convert_variable()
self.convert_auto_freeze() self.convert_auto_freeze()
self.convert_groups() self.convert_groups()
@ -539,7 +539,7 @@ class SpaceAnnotator(object):
for variable in family.variable.values(): for variable in family.variable.values():
if variable.auto_freeze: if variable.auto_freeze:
new_condition = self.objectspace.condition() new_condition = self.objectspace.condition()
new_condition.name = 'auto_frozen_if_in' new_condition.name = 'auto_hidden_if_in'
new_condition.namespace = variables.name new_condition.namespace = variables.name
new_condition.source = FREEZE_AUTOFREEZE_VARIABLE new_condition.source = FREEZE_AUTOFREEZE_VARIABLE
new_param = self.objectspace.param() new_param = self.objectspace.param()
@ -994,7 +994,7 @@ class SpaceAnnotator(object):
variable.disabled = True variable.disabled = True
if condition.name in ['mandatory_if_in']: if condition.name in ['mandatory_if_in']:
variable.mandatory = True variable.mandatory = True
if condition.name in ['frozen_if_in', 'frozen_if_not_in']: if condition.name in ['hidden_if_in', 'hidden_if_not_in']:
variable.hidden = False variable.hidden = False
if HIGH_COMPATIBILITY: if HIGH_COMPATIBILITY:
fallback_variables.append(name) fallback_variables.append(name)
@ -1014,7 +1014,7 @@ class SpaceAnnotator(object):
variable.disabled = True variable.disabled = True
if condition.name in ['mandatory_if_in']: if condition.name in ['mandatory_if_in']:
variable.mandatory = True variable.mandatory = True
if condition.name in ['frozen_if_in', 'frozen_if_not_in']: if condition.name in ['hidden_if_in', 'hidden_if_not_in']:
variable.hidden = False variable.hidden = False
fallback_lists.append(listvar) fallback_lists.append(listvar)
remove_conditions.append(idx) remove_conditions.append(idx)
@ -1063,8 +1063,8 @@ class SpaceAnnotator(object):
# elif condition.name == 'hidden_if_not_in': # elif condition.name == 'hidden_if_not_in':
# condition.name = 'disabled_if_not_in' # condition.name = 'disabled_if_not_in'
for condition in self.space.constraints.condition: for condition in self.space.constraints.condition:
if condition.name not in ['disabled_if_in', 'disabled_if_not_in', 'frozen_if_in', 'auto_frozen_if_in', if condition.name not in ['disabled_if_in', 'disabled_if_not_in', 'hidden_if_in', 'auto_hidden_if_in',
'frozen_if_not_in', 'mandatory_if_in', 'mandatory_if_not_in']: 'hidden_if_not_in', 'mandatory_if_in', 'mandatory_if_not_in']:
raise CreoleDictConsistencyError(_('unknown condition {}').format(condition.name)) raise CreoleDictConsistencyError(_('unknown condition {}').format(condition.name))
def check_params(self): def check_params(self):
@ -1109,7 +1109,7 @@ class SpaceAnnotator(object):
variable.disabled = True variable.disabled = True
force_remove_targets.setdefault(condition.name, force_remove_targets.setdefault(condition.name,
[]).append(target.name) []).append(target.name)
elif condition.name == 'frozen_if_not_in': elif condition.name == 'hidden_if_not_in':
variable.hidden = True variable.hidden = True
force_remove_targets.setdefault(condition.name, force_remove_targets.setdefault(condition.name,
[]).append(target.name) []).append(target.name)
@ -1141,13 +1141,13 @@ class SpaceAnnotator(object):
if name in fallback_variables: if name in fallback_variables:
remove_targets.append(target_idx) remove_targets.append(target_idx)
continue continue
if condition.name in ['frozen_if_in', 'frozen_if_not_in']: if condition.name in ['hidden_if_in', 'hidden_if_not_in']:
variable.hidden = False variable.hidden = False
if condition.name in ['mandatory_if_in', 'mandatory_if_not_in']: if condition.name in ['mandatory_if_in', 'mandatory_if_not_in']:
variable.mandatory = False variable.mandatory = False
if HIGH_COMPATIBILITY and condition.name in ['frozen_if_in', if HIGH_COMPATIBILITY and condition.name in ['hidden_if_in',
'frozen_if_not_in']: 'hidden_if_not_in']:
self.has_frozen_if_in_condition.append(name) self.has_hidden_if_in_condition.append(name)
if condition.name in ['mandatory_if_in', 'mandatory_if_not_in']: if condition.name in ['mandatory_if_in', 'mandatory_if_not_in']:
self.force_not_mandatory.append(target.name) self.force_not_mandatory.append(target.name)
@ -1189,10 +1189,10 @@ class SpaceAnnotator(object):
elif condition.name == 'disabled_if_not_in': elif condition.name == 'disabled_if_not_in':
actions = ['disabled'] actions = ['disabled']
inverse = True inverse = True
elif condition.name == 'frozen_if_in': elif condition.name == 'hidden_if_in':
actions = ['frozen', 'hidden', 'force_default_on_freeze'] actions = ['frozen', 'hidden', 'force_default_on_freeze']
inverse = False inverse = False
elif condition.name == 'frozen_if_not_in': elif condition.name == 'hidden_if_not_in':
actions = ['frozen', 'hidden', 'force_default_on_freeze'] actions = ['frozen', 'hidden', 'force_default_on_freeze']
inverse = True inverse = True
elif condition.name == 'mandatory_if_in': elif condition.name == 'mandatory_if_in':
@ -1201,7 +1201,7 @@ class SpaceAnnotator(object):
elif condition.name == 'mandatory_if_not_in': elif condition.name == 'mandatory_if_not_in':
actions = ['mandatory'] actions = ['mandatory']
inverse = True inverse = True
elif condition.name == 'auto_frozen_if_in': elif condition.name == 'auto_hidden_if_in':
actions = ['auto_frozen'] actions = ['auto_frozen']
inverse = True inverse = True
for param in condition.param: for param in condition.param:

View file

@ -16,7 +16,7 @@
<fill name="calc_val" target="autosavevar"> <fill name="calc_val" target="autosavevar">
<param>oui</param> <param>oui</param>
</fill> </fill>
<condition name="frozen_if_in" source="mode_conteneur_actif"> <condition name="hidden_if_in" source="mode_conteneur_actif">
<param>oui</param> <param>oui</param>
<target type="variable">autosavevar</target> <target type="variable">autosavevar</target>
</condition> </condition>

View file

@ -19,7 +19,7 @@
</variables> </variables>
<constraints> <constraints>
<condition name="frozen_if_in" source="condition"> <condition name="hidden_if_in" source="condition">
<param>oui</param> <param>oui</param>
<target type="variable">mode_conteneur_actif</target> <target type="variable">mode_conteneur_actif</target>
<target type="variable">mode_conteneur_actif2</target> <target type="variable">mode_conteneur_actif2</target>

View file

@ -19,7 +19,7 @@
</variables> </variables>
<constraints> <constraints>
<condition name="frozen_if_in" source="condition"> <condition name="hidden_if_in" source="condition">
<param>oui</param> <param>oui</param>
<target type="variable">mode_conteneur_actif</target> <target type="variable">mode_conteneur_actif</target>
<target type="variable">mode_conteneur_actif2</target> <target type="variable">mode_conteneur_actif2</target>

View file

@ -22,7 +22,7 @@
<check name="valid_enum" target="condition"> <check name="valid_enum" target="condition">
<param>['tous', 'authentifié', 'aucun']</param> <param>['tous', 'authentifié', 'aucun']</param>
</check> </check>
<condition name="frozen_if_in" source="condition"> <condition name="hidden_if_in" source="condition">
<param>tous</param> <param>tous</param>
<param>authentifié</param> <param>authentifié</param>
<target type="variable">mode_conteneur_actif</target> <target type="variable">mode_conteneur_actif</target>

View file

@ -21,7 +21,7 @@
<check name="valid_enum" target="condition"> <check name="valid_enum" target="condition">
<param>['tous', 'authentifié', 'aucun']</param> <param>['tous', 'authentifié', 'aucun']</param>
</check> </check>
<condition name='frozen_if_in' source='condition'> <condition name='hidden_if_in' source='condition'>
<param>oui</param> <param>oui</param>
<param>non</param> <param>non</param>
<target type='variable'>mode_conteneur_actif</target> <target type='variable'>mode_conteneur_actif</target>

View file

@ -84,7 +84,7 @@ def launch_flattener(test_dir, test_ok=False):
eolobj.save(destfile) eolobj.save(destfile)
result_file = join(test_dir, 'result/00-base.xml') result_file = join(test_dir, 'result/00-base.xml')
if isfile(result_file): if isfile(result_file):
eolobj.save(result_file) #eolobj.save(result_file)
compare_xml(destfile, result_file) compare_xml(destfile, result_file)
elif test_ok: elif test_ok:
raise Exception(f'no test found for {test_dir}') raise Exception(f'no test found for {test_dir}')