From 2e10cb02fbb9a85f38e9533541318bb3ed23497d Mon Sep 17 00:00:00 2001 From: Pablo Vazquez Date: Thu, 12 Sep 2019 16:03:49 +0200 Subject: UI: Two-column layout for User Interface theme settings. Group related settings in columns: * Align Inner, Inner Selected and Outline. * Align Text, Text Selected and Item. Place Shaded settings in its own sub-panel. --- release/scripts/startup/bl_ui/space_userpref.py | 59 ++++++++++++++++++------- 1 file changed, 44 insertions(+), 15 deletions(-) (limited to 'release') diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 14a15ace67e..24586745c4f 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -814,26 +814,21 @@ class PreferenceThemeWidgetColorPanel: layout.use_property_split = True - flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=False) + flow = layout.grid_flow(row_major=False, columns=2, even_columns=True, even_rows=False, align=False) - col = flow.column() - col.prop(widget_style, "outline") + col = flow.column(align=True) + col.prop(widget_style, "text") + col.prop(widget_style, "text_sel", text="Selected") col.prop(widget_style, "item", slider=True) - col.prop(widget_style, "inner", slider=True) - col.prop(widget_style, "inner_sel", slider=True) - col = flow.column() - col.prop(widget_style, "text") - col.prop(widget_style, "text_sel") - col.prop(widget_style, "roundness") + col = flow.column(align=True) + col.prop(widget_style, "inner", slider=True) + col.prop(widget_style, "inner_sel", text="Selected", slider=True) + col.prop(widget_style, "outline") - col = flow.column() - col.prop(widget_style, "show_shaded") + col.separator() - colsub = col.column() - colsub.active = widget_style.show_shaded - colsub.prop(widget_style, "shadetop") - colsub.prop(widget_style, "shadedown") + col.prop(widget_style, "roundness") @classmethod def poll(cls, context): @@ -841,6 +836,31 @@ class PreferenceThemeWidgetColorPanel: return (prefs.active_section == 'THEMES') +class PreferenceThemeWidgetShadePanel: + bl_space_type = 'PREFERENCES' + bl_region_type = 'WINDOW' + + def draw(self, context): + theme = context.preferences.themes[0] + ui = theme.user_interface + widget_style = getattr(ui, self.wcol) + layout = self.layout + + layout.use_property_split = True + + col = layout.column(align=True) + col.active = widget_style.show_shaded + col.prop(widget_style, "shadetop", text="Shade Top") + col.prop(widget_style, "shadedown", text="Down") + + def draw_header(self, context): + theme = context.preferences.themes[0] + ui = theme.user_interface + widget_style = getattr(ui, self.wcol) + + self.layout.prop(widget_style, "show_shaded", text="") + + class USERPREF_PT_theme_interface_state(PreferencePanel, Panel): bl_label = "State" bl_options = {'DEFAULT_CLOSED'} @@ -1137,6 +1157,15 @@ class ThemeGenericClassGenerator(): "wcol": wcol, }) + panel_shade_id = "USERPREF_PT_theme_interface_shade_" + wcol + yield type(panel_shade_id, (PreferenceThemeWidgetShadePanel, Panel), { + "bl_label": "Shaded", + "bl_options": {'DEFAULT_CLOSED'}, + "bl_parent_id": panel_id, + "draw": PreferenceThemeWidgetShadePanel.draw, + "wcol": wcol, + }) + @staticmethod def generate_theme_area_child_panel_classes(parent_id, rna_type, theme_area, datapath): def generate_child_panel_classes_recurse(parent_id, rna_type, theme_area, datapath): -- cgit v1.2.3