diff --git a/Scripts/Global.gd b/Scripts/Global.gd index a5fd5addd..375454858 100644 --- a/Scripts/Global.gd +++ b/Scripts/Global.gd @@ -199,6 +199,9 @@ var palette_import_file_dialog : FileDialog var error_dialog : AcceptDialog func _ready() -> void: + # Load settings from the config file + config_cache.load("user://cache.ini") + undo_redo = UndoRedo.new() image_clipboard = Image.new() diff --git a/Scripts/Main.gd b/Scripts/Main.gd index 691149b0c..275c52ee3 100644 --- a/Scripts/Main.gd +++ b/Scripts/Main.gd @@ -33,9 +33,6 @@ func _ready() -> void: # Make sure locales are always sorted, in the same order Global.loaded_locales.sort() - # Load settings from the config file - Global.config_cache.load("user://cache.ini") - # Restore the window position/size if values are present in the configuration cache if Global.config_cache.has_section_key("window", "screen"): OS.current_screen = Global.config_cache.get_value("window", "screen") diff --git a/Scripts/PreferencesDialog.gd b/Scripts/PreferencesDialog.gd index 593ed922a..f61f95d52 100644 --- a/Scripts/PreferencesDialog.gd +++ b/Scripts/PreferencesDialog.gd @@ -1,5 +1,11 @@ extends AcceptDialog +func _ready() -> void: + if Global.config_cache.has_section_key("preferences", "theme"): + var theme_id = Global.config_cache.get_value("preferences", "theme") + change_theme(theme_id) + $VBoxContainer/OptionsContainer/ThemeOption.selected = theme_id + func _on_LanguageOption_item_selected(ID : int) -> void: if ID == 0: TranslationServer.set_locale(OS.get_locale()) @@ -14,6 +20,12 @@ func _on_LanguageOption_item_selected(ID : int) -> void: Global.config_cache.save("user://cache.ini") func _on_ThemeOption_item_selected(ID : int) -> void: + change_theme(ID) + + Global.config_cache.set_value("preferences", "theme", ID) + Global.config_cache.save("user://cache.ini") + +func change_theme(ID : int) -> void: var main_theme var top_menu_style var ruler_style