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, with_quote: bool = False,
) -> str: ) -> str:
"""Replace the Tiramisu display_name function to display path + description""" """Replace the Tiramisu display_name function to display path + description"""
doc = kls._get_information(subconfig, "doc", None) config_bag = subconfig.config_bag
comment = f" ({doc})" if doc and doc != kls.impl_getname() else "" 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: if "{{ identifier }}" in comment and subconfig.identifiers:
comment = comment.replace("{{ identifier }}", str(subconfig.identifiers[-1])) comment = comment.replace("{{ identifier }}", str(subconfig.identifiers[-1]))
path = kls.impl_getpath() path_in_description = values.get_information(context_subconfig, 'path_in_description', True)
if "{{ identifier }}" in path and subconfig.identifiers: if path_in_description or not comment:
path = path.replace( comment = f" ({comment})" if comment else ""
"{{ identifier }}", normalize_family(str(subconfig.identifiers[-1])) if path_in_description is False:
) path = kls.impl_getname()
if with_quote: else:
return f'"{path}"{comment}' 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}" return f"{path}{comment}"

View file

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