WIP: Expand the developer documentation #27
3 changed files with 16 additions and 8 deletions
|
|
@ -242,7 +242,7 @@ class Annotator(Walk): # pylint: disable=R0903
|
||||||
if calculated_variable.multi is None:
|
if calculated_variable.multi is None:
|
||||||
if (
|
if (
|
||||||
isinstance(calculated_variable.default, VariableCalculation)
|
isinstance(calculated_variable.default, VariableCalculation)
|
||||||
and variable.path == calculated_variable.default.path
|
and variable.path == calculated_variable.default.variable
|
||||||
):
|
):
|
||||||
msg = _(
|
msg = _(
|
||||||
'the "{0}" default value is a calculation with itself'
|
'the "{0}" default value is a calculation with itself'
|
||||||
|
|
|
||||||
|
|
@ -586,7 +586,6 @@ def _rougail_config(
|
||||||
|
|
||||||
tiram_obj = convert.save()
|
tiram_obj = convert.save()
|
||||||
optiondescription = {}
|
optiondescription = {}
|
||||||
print(tiram_obj)
|
|
||||||
exec(tiram_obj, {}, optiondescription) # pylint: disable=W0122
|
exec(tiram_obj, {}, optiondescription) # pylint: disable=W0122
|
||||||
return optiondescription["option_0"], extra_vars
|
return optiondescription["option_0"], extra_vars
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -266,7 +266,7 @@ class UserData:
|
||||||
for idx in range(len_leader - 1, -1, -1):
|
for idx in range(len_leader - 1, -1, -1):
|
||||||
option.value.pop(idx)
|
option.value.pop(idx)
|
||||||
try:
|
try:
|
||||||
self.set_value(option, value, options)
|
self.set_value(option, value, options, index)
|
||||||
value_is_set = True
|
value_is_set = True
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
if path != option.path():
|
if path != option.path():
|
||||||
|
|
@ -398,19 +398,24 @@ class UserData:
|
||||||
path, option, self.values[path].get("options", {}), value
|
path, option, self.values[path].get("options", {}), value
|
||||||
)
|
)
|
||||||
if option.isfollower():
|
if option.isfollower():
|
||||||
indexes = range(len(value))
|
if not isinstance(value, tuple):
|
||||||
|
indexes = range(len(value))
|
||||||
|
else:
|
||||||
|
indexes = range(len(option.parent().leader().value.get()))
|
||||||
values = value
|
values = value
|
||||||
else:
|
else:
|
||||||
indexes = [None]
|
indexes = [None]
|
||||||
for index in indexes:
|
for index in indexes:
|
||||||
try:
|
try:
|
||||||
if option.isfollower():
|
if option.isfollower():
|
||||||
value = values[index]
|
if not isinstance(value, tuple):
|
||||||
|
value = values[index]
|
||||||
if value is undefined or isinstance(value, CancelParam):
|
if value is undefined or isinstance(value, CancelParam):
|
||||||
continue
|
continue
|
||||||
option.index(index).value.set(value)
|
index_ = index
|
||||||
else:
|
else:
|
||||||
self.set_value(option, value, options.get("options", {}))
|
index_ = None
|
||||||
|
self.set_value(option, value, options.get("options", {}), index_)
|
||||||
except PropertiesOptionError as err:
|
except PropertiesOptionError as err:
|
||||||
if err.code == "property-error":
|
if err.code == "property-error":
|
||||||
properties = display_list(
|
properties = display_list(
|
||||||
|
|
@ -537,15 +542,19 @@ class UserData:
|
||||||
continue
|
continue
|
||||||
raise err from err
|
raise err from err
|
||||||
|
|
||||||
def set_value(self, option, value, options):
|
def set_value(self, option, value, options, index):
|
||||||
is_secret_manager = options.get("secret_manager", False)
|
is_secret_manager = options.get("secret_manager", False)
|
||||||
if is_secret_manager and isinstance(value, tuple):
|
if is_secret_manager and isinstance(value, tuple):
|
||||||
# it's a function
|
# it's a function
|
||||||
params = tuple([ParamValue(val) for val in value[1:]])
|
params = tuple([ParamValue(val) for val in value[1:]])
|
||||||
|
if index is not None:
|
||||||
|
option = option.forcepermissive.index(index)
|
||||||
value = Calculation(value[0], Params(params, kwargs={"option": ParamValue(option)}))
|
value = Calculation(value[0], Params(params, kwargs={"option": ParamValue(option)}))
|
||||||
option = option.forcepermissive
|
option = option.forcepermissive
|
||||||
add_validation = True
|
add_validation = True
|
||||||
else:
|
else:
|
||||||
|
if index is not None:
|
||||||
|
option = option.index(index)
|
||||||
add_validation = False
|
add_validation = False
|
||||||
option.value.set(value)
|
option.value.set(value)
|
||||||
if add_validation:
|
if add_validation:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue