Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-10-08 20:19:05 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-10-08 20:46:00 +0300
commite1293da01404ce2ae865e8a184c444715f747431 (patch)
tree6caf2ac0c7c4d03d7128dc15bb148e51e3c8232e /release/scripts/startup/bl_operators/presets.py
parent6a41691a0d92e2582bd0f4f42f59affc2d8b850d (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/presets.py')
-rw-r--r--release/scripts/startup/bl_operators/presets.py16
1 files changed, 13 insertions, 3 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"""