[Bf-blender-cvs] [7cf1f30a99f] userpref_redesign: Initial panel & subpanel based layout for theme section
Julian Eisel
noreply at git.blender.org
Sun Dec 16 22:10:15 CET 2018
Commit: 7cf1f30a99f37963194ca1b99047c8b4c4016280
Author: Julian Eisel
Date: Sun Dec 16 21:58:33 2018 +0100
Branches: userpref_redesign
https://developer.blender.org/rB7cf1f30a99f37963194ca1b99047c8b4c4016280
Initial panel & subpanel based layout for theme section
Panels/subpanels for the editor theming are dynamically generated from the RNA
API.
Widget theming doesn't use subpanels yet.
===================================================================
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 b10bfcbbe0f..44b8e0302df 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -127,6 +127,7 @@ class USERPREF_PT_interface_display_info(PreferencePanel):
layout.prop(view, "show_view_name", text="View Name")
layout.prop(view, "show_playback_fps", text="Playback FPS")
+
class USERPREF_PT_interface_develop(PreferencePanel):
bl_label = "Develop"
bl_options = {'DEFAULT_CLOSED'}
@@ -371,6 +372,7 @@ class USERPREF_PT_edit_gpencil(PreferencePanel):
layout.prop(edit, "grease_pencil_manhattan_distance", text="Manhattan Distance")
layout.prop(edit, "grease_pencil_euclidean_distance", text="Euclidean Distance")
+
class USERPREF_PT_edit_annotations(PreferencePanel):
bl_label = "Annotations"
bl_options = {'DEFAULT_CLOSED'}
@@ -406,6 +408,7 @@ class USERPREF_PT_edit_animation(PreferencePanel):
layout.prop(edit, "use_visual_keying")
layout.prop(edit, "use_keyframe_insert_needed", text="Only Insert Needed")
+
class USERPREF_PT_edit_animation_autokey(PreferencePanel):
bl_label = "Auto-Keyframing"
bl_options = {'DEFAULT_CLOSED'}
@@ -424,6 +427,7 @@ class USERPREF_PT_edit_animation_autokey(PreferencePanel):
layout.prop(edit, "use_auto_keying_warning")
layout.prop(edit, "use_keyframe_insert_available", text="Only Insert Available")
+
class USERPREF_PT_edit_animation_fcurves(PreferencePanel):
bl_label = "F-Curves"
bl_options = {'DEFAULT_CLOSED'}
@@ -587,6 +591,7 @@ class USERPREF_PT_interface_system_opengl(PreferencePanel):
layout.prop(system, "use_gpu_mipmap")
layout.prop(system, "use_16bit_textures")
+
class USERPREF_PT_interface_system_opengl_selection(PreferencePanel):
bl_label = "Selection"
bl_parent_id = "USERPREF_PT_interface_system_opengl"
@@ -714,85 +719,40 @@ class USERPREF_PT_theme(Panel):
bl_region_type = 'WINDOW'
bl_options = {'HIDE_HEADER'}
- # not essential, hard-coded UI delimiters for the theme layout
- ui_delimiters = {
- 'VIEW_3D': {
- "text_grease_pencil",
- "text_keyframe",
- "speaker",
- "freestyle_face_mark",
- "split_normal",
- "bone_solid",
- "paint_curve_pivot",
- },
- 'GRAPH_EDITOR': {
- "handle_vertex_select",
- },
- 'IMAGE_EDITOR': {
- "paint_curve_pivot",
- },
- 'NODE_EDITOR': {
- "layout_node",
- },
- 'CLIP_EDITOR': {
- "handle_vertex_select",
- }
- }
-
- @staticmethod
- def _theme_generic(layout, themedata, theme_area):
-
- col = layout.column()
+ @classmethod
+ def poll(cls, context):
+ userpref = context.user_preferences
+ return (userpref.active_section == 'THEMES')
- def theme_generic_recurse(data):
- col.label(text=data.rna_type.name)
- row = col.row()
- subsplit = row.split(factor=0.95)
+ def draw(self, context):
+ layout = self.layout
- padding1 = subsplit.split(factor=0.15)
- padding1.column()
+ theme = context.user_preferences.themes[0]
- subsplit = row.split(factor=0.85)
+ row = layout.row()
- padding2 = subsplit.split(factor=0.15)
- padding2.column()
+ row.operator("wm.theme_install", text="Install", icon='FILEBROWSER')
+ row.operator("ui.reset_default_theme", text="Reset", icon='LOOP_BACK')
- colsub_pair = padding1.column(), padding2.column()
+ subrow = row.row(align=True)
+ subrow.menu("USERPREF_MT_interface_theme_presets", text=USERPREF_MT_interface_theme_presets.bl_label)
+ subrow.operator("wm.interface_theme_preset_add", text="", icon='ADD')
+ subrow.operator("wm.interface_theme_preset_add", text="", icon='REMOVE').remove_active = True
- props_type = {}
+ # TODO theme_area should be deprecated
+ row.prop(theme, "theme_area", text="")
- for i, prop in enumerate(data.rna_type.properties):
- if prop.identifier == "rna_type":
- continue
- props_type.setdefault((prop.type, prop.subtype), []).append(prop)
+class USERPREF_PT_theme_user_interface(PreferencePanel):
+ bl_space_type = 'USER_PREFERENCES'
+ bl_region_type = 'WINDOW'
+ bl_label = "User Interface"
+ bl_options = {'DEFAULT_CLOSED'}
- th_delimiters = USERPREF_PT_theme.ui_delimiters.get(theme_area)
- for props_type, props_ls in sorted(props_type.items()):
- if props_type[0] == 'POINTER':
- for i, prop in enumerate(props_ls):
- theme_generic_recurse(getattr(data, prop.identifier))
- else:
- if th_delimiters is None:
- # simple, no delimiters
- for i, prop in enumerate(props_ls):
- colsub_pair[i % 2].row().prop(data, prop.identifier)
- else:
- # add hard coded delimiters
- i = 0
- for prop in props_ls:
- colsub = colsub_pair[i]
- colsub.row().prop(data, prop.identifier)
- i = (i + 1) % 2
- if prop.identifier in th_delimiters:
- if i:
- colsub = colsub_pair[1]
- colsub.row().label(text="")
- colsub_pair[0].row().label(text="")
- colsub_pair[1].row().label(text="")
- i = 0
-
- theme_generic_recurse(themedata)
+ @classmethod
+ def poll(cls, context):
+ userpref = context.user_preferences
+ return (userpref.active_section == 'THEMES')
@staticmethod
def _theme_widget_style(layout, widget_style):
@@ -820,199 +780,258 @@ class USERPREF_PT_theme(Panel):
rowsub.prop(widget_style, "shadetop")
rowsub.prop(widget_style, "shadedown")
+ def draw_header(self, context):
+ layout = self.layout
- @staticmethod
- def _ui_font_style(layout, font_style):
+ layout.label(icon='WORKSPACE')
- split = layout.split()
+ def draw(self, context):
+ layout = self.layout
+ theme = context.user_preferences.themes[0]
+ ui = theme.user_interface
- col = split.column()
- col.label(text="Kerning Style:")
- col.row().prop(font_style, "font_kerning_style", expand=True)
- col.prop(font_style, "points")
+ col = layout.column()
- col = split.column()
- col.label(text="Shadow Offset:")
- col.prop(font_style, "shadow_offset_x", text="X")
- col.prop(font_style, "shadow_offset_y", text="Y")
+ col.label(text="Regular:")
+ self._theme_widget_style(col, ui.wcol_regular)
- col = split.column()
- col.prop(font_style, "shadow")
- col.prop(font_style, "shadow_alpha")
- col.prop(font_style, "shadow_value")
+ col.label(text="Tool:")
+ self._theme_widget_style(col, ui.wcol_tool)
- layout.separator()
+ col.label(text="Toolbar Item:")
+ self._theme_widget_style(col, ui.wcol_toolbar_item)
- @classmethod
- def poll(cls, context):
- userpref = context.user_preferences
- return (userpref.active_section == 'THEMES')
+ col.label(text="Radio Buttons:")
+ self._theme_widget_style(col, ui.wcol_radio)
- def draw(self, context):
- layout = self.layout
+ col.label(text="Text:")
+ self._theme_widget_style(col, ui.wcol_text)
- theme = context.user_preferences.themes[0]
+ col.label(text="Option:")
+ self._theme_widget_style(col, ui.wcol_option)
- row = layout.row()
+ col.label(text="Toggle:")
+ self._theme_widget_style(col, ui.wcol_toggle)
- row.operator("wm.theme_install", text="Install", icon='FILEBROWSER')
- row.operator("ui.reset_default_theme", text="Reset", icon='LOOP_BACK')
+ col.label(text="Number Field:")
+ self._theme_widget_style(col, ui.wcol_num)
- subrow = row.row(align=True)
- subrow.menu("USERPREF_MT_interface_theme_presets", text=USERPREF_MT_interface_theme_presets.bl_label)
- subrow.operator("wm.interface_theme_preset_add", text="", icon='ADD')
- subrow.operator("wm.interface_theme_preset_add", text="", icon='REMOVE').remove_active = True
+ col.label(text="Value Slider:")
+ self._theme_widget_style(col, ui.wcol_numslider)
- row.prop(theme, "theme_area", text="")
+ col.label(text="Box:")
+ self._theme_widget_style(col, ui.wcol_box)
+ col.label(text="Menu:")
+ self._theme_widget_style(col, ui.wcol_menu)
- if theme.theme_area == 'USER_INTERFACE':
- col = layout.column()
- ui = theme.user_interface
+ col.label(text="Pie Menu:")
+ self._theme_widget_style(col, ui.wcol_pie_menu)
- col.label(text="Regular:")
- self._theme_widget_style(col, ui.wcol_regular)
+ col.label(text="Pulldown:")
+ self._theme_widget_style(col, ui.wcol_pulldown)
- col.label(text="Tool:")
- self._theme_widget_style(col, ui.wcol_tool)
+ col.label(text="Menu Back:")
+ self._theme_widget_style(col, ui.wcol_menu_back)
- col.label(text="Toolbar Item:")
- self._theme_widget_style(col, ui.wcol_toolbar_item)
+ col.label(text="Tooltip:")
+ self._theme_widget_style(col, ui.wcol_tooltip)
- col.label(text="Radio Buttons:")
- self._theme_widget_style(col, ui.wcol_radio)
+ col.label(text="Menu Item:")
+ self._theme_widget_style(col, ui.wcol_menu_item)
- col.label(text="Text:"
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list