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:
authorCampbell Barton <ideasman42@gmail.com>2019-05-13 08:59:27 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-05-13 09:29:35 +0300
commit741f29d499eaaa5c10be218a632f9b6fab67840e (patch)
treeaf5ff8dfab8c97b599a1c8af17e4fdbd9fd6480a /release
parent3d923f3eaf998ebd73f6c93eb87a05288b579e22 (diff)
Preferences: auto-save on exit
Save modified preferences on exit by default, with the option to disable this.
Diffstat (limited to 'release')
-rw-r--r--release/scripts/startup/bl_ui/space_userpref.py29
1 files changed, 18 insertions, 11 deletions
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index ca82c5fb264..0033ae18264 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -30,18 +30,28 @@ from bpy.app.translations import contexts as i18n_contexts
class USERPREF_HT_header(Header):
bl_space_type = 'PREFERENCES'
- def draw(self, _context):
+ @staticmethod
+ def draw_buttons(layout, context, *, is_vertical=False):
+ if is_vertical:
+ sub = layout.column(align=True)
+ else:
+ sub = layout.row(align=True)
+
+ sub.operator("wm.save_userpref")
+ sub.operator("wm.read_userpref")
+ sub.operator("wm.read_factory_userpref")
+
+ prefs = context.preferences
+ layout.prop(prefs, "use_preferences_save")
+
+ def draw(self, context):
layout = self.layout
layout.operator_context = 'EXEC_AREA'
layout.template_header()
layout.separator_spacer()
-
- row = layout.row(align=True)
- row.operator("wm.save_userpref")
- row.operator("wm.read_userpref")
- row.operator("wm.read_factory_userpref")
+ self.draw_buttons(layout, context)
class USERPREF_PT_navigation_bar(Panel):
@@ -77,17 +87,14 @@ class USERPREF_PT_save_preferences(Panel):
return False
- def draw(self, _context):
+ def draw(self, context):
layout = self.layout
layout.operator_context = 'EXEC_AREA'
layout.scale_x = 1.3
layout.scale_y = 1.3
- col = layout.column(align=True)
- col.operator("wm.save_userpref")
- col.operator("wm.read_userpref")
- col.operator("wm.read_factory_userpref")
+ USERPREF_HT_header.draw_buttons(layout, context, is_vertical=True)
# Panel mix-in.