From a7268d3db8db3b862e989108e913e1e50ce6a3a3 Mon Sep 17 00:00:00 2001 From: Matthieu Houdebine Date: Fri, 26 Apr 2024 14:27:53 +0200 Subject: [PATCH] Check if theme is valid for Configuration Wizard --- configure.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/configure.py b/configure.py index e374d19e..5cb3b688 100755 --- a/configure.py +++ b/configure.py @@ -271,11 +271,16 @@ def load_config_values(self): with open("config.yaml", "rt", encoding='utf8') as stream: self.config, ind, bsi = ruamel.yaml.util.load_yaml_guess_indent(stream) + # Check if theme is valid + if get_theme_data(self.config['config']['THEME']) is None: + # Theme from config.yaml is not valid: use first theme available default size 3.5" + self.config['config']['THEME'] = get_themes(SIZE_3_5_INCH)[0] + try: self.theme_cb.set(self.config['config']['THEME']) except: - self.theme_cb.current(0) - # self.load_theme_size() + self.theme_cb.set("") + self.load_theme_preview() try: @@ -361,7 +366,6 @@ def save_config_values(self): ruamel.yaml.YAML().dump(self.config, file) def on_theme_change(self, e=None): - # self.load_theme_size() self.load_theme_preview() def on_theme_editor_click(self):