diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-10-08 20:19:05 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-10-08 20:46:00 +0300 |
commit | e1293da01404ce2ae865e8a184c444715f747431 (patch) | |
tree | 6caf2ac0c7c4d03d7128dc15bb148e51e3c8232e /release/scripts/startup/bl_operators | |
parent | 6a41691a0d92e2582bd0f4f42f59affc2d8b850d (diff) |
Splash: add themes to first time setup in splash screen.
* Add default theme as Blender Dark.
* Rename Flatty Light to Blender Light.
* When setting theme, reset to default first for consistent results.
Diffstat (limited to 'release/scripts/startup/bl_operators')
-rw-r--r-- | release/scripts/startup/bl_operators/presets.py | 16 | ||||
-rw-r--r-- | release/scripts/startup/bl_operators/wm.py | 10 |
2 files changed, 20 insertions, 6 deletions
diff --git a/release/scripts/startup/bl_operators/presets.py b/release/scripts/startup/bl_operators/presets.py index 9cc1591494a..59bcae2a789 100644 --- a/release/scripts/startup/bl_operators/presets.py +++ b/release/scripts/startup/bl_operators/presets.py @@ -238,6 +238,13 @@ class ExecutePreset(Operator): ext = splitext(filepath)[1].lower() + if ext not in {".py", ".xml"}: + self.report({'ERROR'}, "unknown filetype: %r" % ext) + return {'CANCELLED'} + + if hasattr(preset_class, "pre_cb"): + preset_class.pre_cb(context) + # execute the preset using script.python_file_run if ext == ".py": bpy.ops.script.python_file_run(filepath=filepath) @@ -246,9 +253,9 @@ class ExecutePreset(Operator): rna_xml.xml_file_run(context, filepath, preset_class.preset_xml_map) - else: - self.report({'ERROR'}, "unknown filetype: %r" % ext) - return {'CANCELLED'} + + if hasattr(preset_class, "post_cb"): + preset_class.post_cb(context) return {'FINISHED'} @@ -564,6 +571,9 @@ class AddPresetInterfaceTheme(AddPresetBase, Operator): preset_menu = "USERPREF_MT_interface_theme_presets" preset_subdir = "interface_theme" + def pre_cb(self, context): + bpy.ops.ui.reset_default_theme() + class AddPresetKeyconfig(AddPresetBase, Operator): """Add or remove a Key-config Preset""" diff --git a/release/scripts/startup/bl_operators/wm.py b/release/scripts/startup/bl_operators/wm.py index 52b645685ba..4fcadbf63e3 100644 --- a/release/scripts/startup/bl_operators/wm.py +++ b/release/scripts/startup/bl_operators/wm.py @@ -2559,8 +2559,6 @@ class WM_MT_splash(Menu): col = split.column() - col.label() - sub = col.column(align=True) sub.label(text="Input and Shortcuts:") text = bpy.path.display_name(context.window_manager.keyconfigs.active.name) @@ -2570,6 +2568,13 @@ class WM_MT_splash(Menu): col.separator() + sub = col.column(align=True) + sub.label(text="Theme:") + label = bpy.types.USERPREF_MT_interface_theme_presets.bl_label + if label == "Presets": + label = "Blender Dark" + sub.menu("USERPREF_MT_interface_theme_presets", text=label) + # We need to make switching to a language easier first #sub = col.column(align=False) # sub.label(text="Language:") @@ -2577,7 +2582,6 @@ class WM_MT_splash(Menu): #sub.prop(userpref.system, "language", text="") col.label() - col.label() layout.label() |