mod_settings can now have a description from message.json

This commit is contained in:
Faraphel 2022-08-17 19:00:35 +02:00
parent 433bf08b9b
commit da9ec18ef3
2 changed files with 11 additions and 1 deletions

View file

@ -1,5 +1,5 @@
{ {
"specific_settings_description": { "settings_description": {
"text": { "text": {
"fr": "* Ceci activera le mode \"triche\"", "fr": "* Ceci activera le mode \"triche\"",
"en": "* This will enable the \"cheat\" mode" "en": "* This will enable the \"cheat\" mode"

View file

@ -62,6 +62,7 @@ class FrameSettings(ttk.Frame):
""" """
return lambda event: enabled_variable.set(True) return lambda event: enabled_variable.set(True)
index: int = 0
for index, (settings_name, settings_data) in enumerate(settings.items()): for index, (settings_name, settings_data) in enumerate(settings.items()):
text = translate_external( text = translate_external(
self.master.master.mod_config, self.master.master.mod_config,
@ -79,3 +80,12 @@ class FrameSettings(ttk.Frame):
# if any of the label child are clicked, automatically enable the option # if any of the label child are clicked, automatically enable the option
for child in frame.winfo_children(): for child in frame.winfo_children():
child.bind("<Button-1>", get_event_checkbox(enabled_variable)) child.bind("<Button-1>", get_event_checkbox(enabled_variable))
# add at the end a message from the mod creator where he can put some additional note about the settings.
if text := translate_external(
self.master.master.mod_config,
self.root.options["language"],
self.master.master.mod_config.messages.get("settings_description", {}).get("text", {})
):
self.label_description = ttk.Label(self, text="\n"+text, foreground="gray")
self.label_description.grid(row=index+1, column=1)