fix: tiramisu_display_name could display only description

This commit is contained in:
egarette@silique.fr 2025-05-08 22:10:28 +02:00
parent 70b6f3d274
commit 6be773de3c
2 changed files with 33 additions and 16 deletions

View file

@ -42,17 +42,29 @@ def tiramisu_display_name(
with_quote: bool = False,
) -> str:
"""Replace the Tiramisu display_name function to display path + description"""
doc = kls._get_information(subconfig, "doc", None)
comment = f" ({doc})" if doc and doc != kls.impl_getname() else ""
config_bag = subconfig.config_bag
context = config_bag.context
values = context.get_values()
context_subconfig = context.get_root(config_bag)
doc = values.get_information(subconfig, "doc", None)
comment = doc if doc and doc != kls.impl_getname() else ""
if "{{ identifier }}" in comment and subconfig.identifiers:
comment = comment.replace("{{ identifier }}", str(subconfig.identifiers[-1]))
path = kls.impl_getpath()
if "{{ identifier }}" in path and subconfig.identifiers:
path = path.replace(
"{{ identifier }}", normalize_family(str(subconfig.identifiers[-1]))
)
if with_quote:
return f'"{path}"{comment}'
path_in_description = values.get_information(context_subconfig, 'path_in_description', True)
if path_in_description or not comment:
comment = f" ({comment})" if comment else ""
if path_in_description is False:
path = kls.impl_getname()
else:
path = kls.impl_getpath()
if "{{ identifier }}" in path and subconfig.identifiers:
path = path.replace(
"{{ identifier }}", normalize_family(str(subconfig.identifiers[-1]))
)
if with_quote and not path_in_description:
return f'"{path}"{comment}'
else:
path = ""
return f"{path}{comment}"

View file

@ -223,7 +223,7 @@ def _rougail_config(
add_extra_options: bool = True,
) -> "OptionDescription":
rougail_options = f"""default_dictionary_format_version:
description: Dictionary format version by default, if not specified in dictionary file
description: {_('Structure format version by default, if not specified in structure file')}
alternative_name: v
choices:
- '1.0'
@ -370,13 +370,13 @@ secret_manager:
for process in processes:
if processes[process]:
objects = processes[process]
rougail_process += """
process_name = normalize_family(process)
tr_process_name = _(process_name)
rougail_process += f"""
{NAME}:
description: Select for {NAME}
""".format(
NAME=normalize_family(process),
)
{process_name}:
description: {_('Select for {0}').format(tr_process_name)}
"""
if process != "structural":
rougail_process += """
alternative_name: {NAME[0]}
@ -454,8 +454,13 @@ secret_manager:
PROP=prop,
)
rougail_process += f"""
define_default_params: false # {_('Override default parameters for option type')}
default_params:
description: {_("Default parameters for option type")}
disabled:
variable: _.define_default_params
when: false
"""
for typ, params in get_convert_option_types():