moved bmg_color_text in safe_eval to ModConfig

This commit is contained in:
Faraphel 2022-07-25 18:48:45 +02:00
parent abad5f8b5d
commit 5466a88c2d
2 changed files with 3 additions and 3 deletions

View file

@ -7,6 +7,7 @@ from PIL import Image
from source import threaded from source import threaded
from source.mkw import Tag from source.mkw import Tag
from source.mkw.Cup import Cup from source.mkw.Cup import Cup
from source.mkw.MKWColor import bmg_color_text
from source.mkw.Track import Track from source.mkw.Track import Track
import json import json
@ -116,7 +117,7 @@ class ModConfig:
""" """
return (multiple_safe_eval if multiple else safe_eval)( return (multiple_safe_eval if multiple else safe_eval)(
template, template,
env={"mod_config": self} | (env if env is not None else {}), env={"mod_config": self, "bmg_color_text": bmg_color_text} | (env if env is not None else {}),
macros=self.macros, macros=self.macros,
) )

View file

@ -1,7 +1,6 @@
from typing import Generator from typing import Generator
from source.mkw import Tag, Slot from source.mkw import Tag, Slot
from source.mkw.MKWColor import bmg_color_text
ModConfig: any ModConfig: any
@ -72,7 +71,7 @@ class Track:
""" """
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]
return mod_config.safe_eval(template, env={"TAG": tag, "bmg_color_text": bmg_color_text}, multiple=True) return mod_config.safe_eval(template, env={"TAG": tag}, multiple=True)
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: