[Bf-blender-cvs] [6f9819e5fd5] master: UI: move preferences save options into submenu

William Reynish noreply at git.blender.org
Wed May 15 10:42:38 CEST 2019


Commit: 6f9819e5fd56985738941edc129422234dd30619
Author: William Reynish
Date:   Wed May 15 18:39:41 2019 +1000
Branches: master
https://developer.blender.org/rB6f9819e5fd56985738941edc129422234dd30619

UI: move preferences save options into submenu

Avoid clutter in the UI by moving save/revert options into submenu,
only show the save button when auto-save is disabled.

===================================================================

M	release/scripts/startup/bl_ui/space_userpref.py

===================================================================

diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index ca2d616a919..d0613b4ce84 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -34,15 +34,15 @@ class USERPREF_HT_header(Header):
     def draw_buttons(layout, context, *, is_vertical=False):
         prefs = context.preferences
 
-        row = layout.row()
-
-        row.operator("wm.save_userpref", text="Save")
-        row_revert = row.row(align=True)
-        row_revert.active = prefs.is_dirty
-        row_revert.operator("wm.read_userpref", text="Revert")
-        layout.operator("wm.read_factory_userpref", text="Load Factory Settings")
+        layout.scale_x = 1.0
+        layout.scale_y = 1.0
 
-        layout.prop(prefs, "use_preferences_save")
+        row = layout.row()
+        row.menu("USERPREF_MT_save_load", text="", icon='COLLAPSEMENU')
+        if not prefs.use_preferences_save:
+            sub_revert = row.row(align=True)
+            sub_revert.active = prefs.is_dirty
+            sub_revert.operator("wm.save_userpref")
 
     def draw(self, context):
         layout = self.layout
@@ -72,6 +72,25 @@ class USERPREF_PT_navigation_bar(Panel):
         col.prop(prefs, "active_section", expand=True)
 
 
+class USERPREF_MT_save_load(Menu):
+    bl_label = "Save & Load"
+
+    def draw(self, context):
+        layout = self.layout
+
+        prefs = context.preferences
+
+        layout.prop(prefs, "use_preferences_save", text="Auto-Save Preferences")
+
+        layout.separator()
+        if prefs.use_preferences_save:
+            layout.operator("wm.save_userpref", text="Save Current State")
+        sub_revert = layout.column(align=True)
+        sub_revert.active = prefs.is_dirty
+        sub_revert.operator("wm.read_userpref", text="Revert to Saved")
+        layout.operator("wm.read_factory_userpref", text="Reset to Defaults")
+
+
 class USERPREF_PT_save_preferences(Panel):
     bl_label = "Save Preferences"
     bl_space_type = 'PREFERENCES'
@@ -2040,6 +2059,7 @@ classes = (
     USERPREF_HT_header,
     USERPREF_PT_navigation_bar,
     USERPREF_PT_save_preferences,
+    USERPREF_MT_save_load,
 
     USERPREF_PT_interface_display,
     USERPREF_PT_interface_editors,



More information about the Bf-blender-cvs mailing list