mirror of
https://github.com/Faraphel/Atlas-Install.git
synced 2025-07-03 03:08:29 +02:00
tracks prefix and suffix are now evaluated from mod_config.safe_eval instead of normal safe_eval
This commit is contained in:
parent
d25bc524c7
commit
340f985673
1 changed files with 5 additions and 5 deletions
|
@ -62,17 +62,17 @@ class Track:
|
||||||
multiple=True
|
multiple=True
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_tag_template(self, templates: dict[str, str], default: any = None) -> any:
|
def get_tag_template(self, mod_config: "ModConfig", templates: dict[str, str], default: any = None) -> any:
|
||||||
"""
|
"""
|
||||||
Return the tag template found in templates. If not found, return default
|
Return the tag template found in templates. If not found, return default
|
||||||
|
:param mod_config: mod configuration
|
||||||
:param templates: template with all the tags and its replacement
|
:param templates: template with all the tags and its replacement
|
||||||
:param default: default value if no tag template is found
|
:param default: default value if no tag template is found
|
||||||
:return: formatted representation of the tag
|
:return: formatted representation of the tag
|
||||||
"""
|
"""
|
||||||
for tag in filter(lambda tag: tag in templates, self.tags):
|
for tag in filter(lambda tag: tag in templates, self.tags):
|
||||||
template: str = templates[tag]
|
template: str = templates[tag]
|
||||||
# TODO: this should try to use mod_config for save_eval
|
return mod_config.safe_eval(template, env={"TAG": tag, "bmg_color_text": bmg_color_text}, multiple=True)
|
||||||
return multiple_safe_eval(template, env={"TAG": tag, "bmg_color_text": bmg_color_text})
|
|
||||||
return default
|
return default
|
||||||
|
|
||||||
def get_prefix(self, mod_config: "ModConfig", default: any = None) -> any:
|
def get_prefix(self, mod_config: "ModConfig", default: any = None) -> any:
|
||||||
|
@ -82,7 +82,7 @@ class Track:
|
||||||
:param mod_config: mod configuration
|
:param mod_config: mod configuration
|
||||||
:return: formatted representation of the track prefix
|
:return: formatted representation of the track prefix
|
||||||
"""
|
"""
|
||||||
return self.get_tag_template(mod_config.tags_prefix, default)
|
return self.get_tag_template(mod_config, mod_config.tags_prefix, default)
|
||||||
|
|
||||||
def get_suffix(self, mod_config: "ModConfig", default: any = None) -> any:
|
def get_suffix(self, mod_config: "ModConfig", default: any = None) -> any:
|
||||||
"""
|
"""
|
||||||
|
@ -91,7 +91,7 @@ class Track:
|
||||||
:param mod_config: mod configuration
|
:param mod_config: mod configuration
|
||||||
:return: formatted representation of the track suffix
|
:return: formatted representation of the track suffix
|
||||||
"""
|
"""
|
||||||
return self.get_tag_template(mod_config.tags_suffix, default)
|
return self.get_tag_template(mod_config, mod_config.tags_suffix, default)
|
||||||
|
|
||||||
def is_highlight(self, mod_config: "ModConfig", default: any = None) -> bool:
|
def is_highlight(self, mod_config: "ModConfig", default: any = None) -> bool:
|
||||||
...
|
...
|
||||||
|
|
Loading…
Reference in a new issue