From ef22f22c255c4db72ff4ac5a330c28e1a3458fcc Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 8 Apr 2025 17:08:16 +1000 Subject: [PATCH] UI: resolve glitch where resetting the theme left the old name Co-authored-by: quackarooni --- scripts/startup/bl_ui/space_userpref.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/startup/bl_ui/space_userpref.py b/scripts/startup/bl_ui/space_userpref.py index e4194bc7775..d08da19a09c 100644 --- a/scripts/startup/bl_ui/space_userpref.py +++ b/scripts/startup/bl_ui/space_userpref.py @@ -947,7 +947,9 @@ class ThemePanel: class USERPREF_MT_interface_theme_presets(Menu): + # NOTE: this label is currently not used, see: !134844. bl_label = "Presets" + preset_subdir = "interface_theme" preset_operator = "script.execute_preset" preset_type = 'XML' @@ -1021,7 +1023,12 @@ class USERPREF_PT_theme(ThemePanel, Panel): if filepath := context.preferences.themes[0].filepath: preset_label = bpy.path.display_name(os.path.basename(filepath)) else: - preset_label = USERPREF_MT_interface_theme_presets.bl_label + # If the `filepath` is empty, assume the theme was reset and use the default theme name as a label. + # This would typically be: + # `preset_label = USERPREF_MT_interface_theme_presets.bl_label` + # However the operator to reset the preferences doesn't clear the value, + # so it's simplest to hard-code "Presets" here. + preset_label = "Presets" row.menu("USERPREF_MT_interface_theme_presets", text=preset_label) del filepath, preset_label