support auto_freeze with hidden_if_in
This commit is contained in:
parent
1a77416e6d
commit
d5ed39c1f3
|
@ -452,19 +452,15 @@ class ConstrainteAnnotator:
|
|||
main_action = actions[0]
|
||||
if getattr(leader_or_variable, main_action, False) is True:
|
||||
continue
|
||||
if isinstance(leader_or_variable, self.objectspace.variable) and \
|
||||
(leader_or_variable.auto_save or leader_or_variable.auto_freeze) and \
|
||||
'force_default_on_freeze' in actions:
|
||||
xmlfiles = self.objectspace.display_xmlfiles(leader_or_variable.xmlfiles)
|
||||
msg = _(f'cannot have auto_freeze or auto_store with the hidden_if_in or '
|
||||
f'hidden_if_not_in variable "{leader_or_variable.name}" '
|
||||
f'in {xmlfiles}')
|
||||
raise DictConsistencyError(msg, 51)
|
||||
self.build_property(leader_or_variable,
|
||||
text,
|
||||
condition,
|
||||
main_action,
|
||||
)
|
||||
if isinstance(leader_or_variable, self.objectspace.variable) and \
|
||||
(leader_or_variable.auto_save or leader_or_variable.auto_freeze) and \
|
||||
'force_default_on_freeze' in actions:
|
||||
continue
|
||||
for action in actions[1:]:
|
||||
# other actions are set to the variable or children of family
|
||||
for variable in variables:
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<rougail>
|
||||
<variables>
|
||||
<family name="general">
|
||||
<variable name="module_instancie" type="oui/non" description="No change">
|
||||
<value>non</value>
|
||||
</variable>
|
||||
<variable name="mode_conteneur_actif" type="oui/non" description="No change" auto_freeze="True">
|
||||
<value>non</value>
|
||||
</variable>
|
||||
</family>
|
||||
<separators/>
|
||||
</variables>
|
||||
<constraints>
|
||||
<fill name="calc_val" target="mode_conteneur_actif">
|
||||
<param>oui</param>
|
||||
</fill>
|
||||
<condition name="hidden_if_in" source="module_instancie">
|
||||
<param>oui</param>
|
||||
<target type="variable">mode_conteneur_actif</target>
|
||||
</condition>
|
||||
</constraints>
|
||||
</rougail>
|
||||
<!-- vim: ts=4 sw=4 expandtab
|
||||
-->
|
|
@ -0,0 +1 @@
|
|||
{"rougail.general.module_instancie": "non", "rougail.general.mode_conteneur_actif": "oui"}
|
|
@ -0,0 +1,15 @@
|
|||
from importlib.machinery import SourceFileLoader
|
||||
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||
for key, value in dict(locals()).items():
|
||||
if key != ['SourceFileLoader', 'func']:
|
||||
setattr(func, key, value)
|
||||
try:
|
||||
from tiramisu3 import *
|
||||
except:
|
||||
from tiramisu import *
|
||||
from rougail.tiramisu import ConvertDynOptionDescription
|
||||
option_3 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='module_instancie', doc='No change', multi=False, default='non', values=('oui', 'non'))
|
||||
option_4 = ChoiceOption(properties=frozenset({'auto_freeze', 'basic', 'force_store_value', 'mandatory', Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')})), Calculation(calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))}), name='mode_conteneur_actif', doc='No change', multi=False, default=Calculation(func.calc_val, Params((ParamValue("oui")), kwargs={})), values=('oui', 'non'))
|
||||
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'basic'}), children=[option_3, option_4])
|
||||
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
||||
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
|
|
@ -0,0 +1 @@
|
|||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.autosavevar": "oui"}
|
|
@ -0,0 +1,15 @@
|
|||
from importlib.machinery import SourceFileLoader
|
||||
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||
for key, value in dict(locals()).items():
|
||||
if key != ['SourceFileLoader', 'func']:
|
||||
setattr(func, key, value)
|
||||
try:
|
||||
from tiramisu3 import *
|
||||
except:
|
||||
from tiramisu import *
|
||||
from rougail.tiramisu import ConvertDynOptionDescription
|
||||
option_3 = ChoiceOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non', values=('oui', 'non'))
|
||||
option_4 = StrOption(properties=frozenset({'basic', 'force_store_value', Calculation(calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue('oui')}))}), name='autosavevar', doc='autosave variable', multi=False, default=Calculation(func.calc_val, Params((ParamValue("oui")), kwargs={})))
|
||||
option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'basic'}), children=[option_3, option_4])
|
||||
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
||||
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
|
Loading…
Reference in New Issue