From da9ec18ef3b5d43f787b7667b2a78ac58238dd73 Mon Sep 17 00:00:00 2001 From: Faraphel Date: Wed, 17 Aug 2022 19:00:35 +0200 Subject: [PATCH] mod_settings can now have a description from message.json --- Pack/MKWFaraphel/messages.json | 2 +- source/gui/mod_settings.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Pack/MKWFaraphel/messages.json b/Pack/MKWFaraphel/messages.json index 0afd35a..4cd1822 100644 --- a/Pack/MKWFaraphel/messages.json +++ b/Pack/MKWFaraphel/messages.json @@ -1,5 +1,5 @@ { - "specific_settings_description": { + "settings_description": { "text": { "fr": "* Ceci activera le mode \"triche\"", "en": "* This will enable the \"cheat\" mode" diff --git a/source/gui/mod_settings.py b/source/gui/mod_settings.py index df50528..64d64a4 100644 --- a/source/gui/mod_settings.py +++ b/source/gui/mod_settings.py @@ -62,6 +62,7 @@ class FrameSettings(ttk.Frame): """ return lambda event: enabled_variable.set(True) + index: int = 0 for index, (settings_name, settings_data) in enumerate(settings.items()): text = translate_external( 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 for child in frame.winfo_children(): child.bind("", 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)