diff options
author | William Reynish <billrey@me.com> | 2019-05-15 11:39:41 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-05-15 11:41:45 +0300 |
commit | 6f9819e5fd56985738941edc129422234dd30619 (patch) | |
tree | b36e38ff5f7a91719725ef60cf2039712bcd8d9b /release | |
parent | c2568394dd71853e67b607be5f0b10d24399421e (diff) |
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.
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/bl_ui/space_userpref.py | 36 |
1 files changed, 28 insertions, 8 deletions
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, |