[Bf-blender-cvs] [fac39dc160e] master: UI: avoid sub-classing mix-ins for user-prefs
Campbell Barton
noreply at git.blender.org
Wed Mar 13 03:33:56 CET 2019
Commit: fac39dc160e4212d2fd11a5e9d73944f5b311734
Author: Campbell Barton
Date: Wed Mar 13 13:24:46 2019 +1100
Branches: master
https://developer.blender.org/rBfac39dc160e4212d2fd11a5e9d73944f5b311734
UI: avoid sub-classing mix-ins for user-prefs
Also remove redundant staticmethod use.
===================================================================
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 562429aebeb..f20141bb13d 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -83,7 +83,8 @@ class USERPREF_PT_save_preferences(Panel):
layout.operator("wm.save_userpref")
-class PreferencePanel(Panel):
+# Panel mix-in.
+class PreferencePanel:
"""
Base class for panels to center align contents with some horizontal margin.
Deriving classes need to implement a ``draw_props(context, layout)`` function.
@@ -114,7 +115,7 @@ class PreferencePanel(Panel):
row.label() # Needed so col above is centered.
-class USERPREF_PT_interface_display(PreferencePanel):
+class USERPREF_PT_interface_display(PreferencePanel, Panel):
bl_label = "Display"
@classmethod
@@ -142,7 +143,7 @@ class USERPREF_PT_interface_display(PreferencePanel):
flow.prop(view, "show_large_cursors")
-class USERPREF_PT_interface_text(PreferencePanel):
+class USERPREF_PT_interface_text(PreferencePanel, Panel):
bl_label = "Text Rendering"
bl_options = {'DEFAULT_CLOSED'}
@@ -166,7 +167,7 @@ class USERPREF_PT_interface_text(PreferencePanel):
flow.prop(view, "font_path_ui_mono")
-class USERPREF_PT_interface_translation(PreferencePanel):
+class USERPREF_PT_interface_translation(PreferencePanel, Panel):
bl_label = "Translation"
@classmethod
@@ -195,7 +196,7 @@ class USERPREF_PT_interface_translation(PreferencePanel):
flow.prop(view, "use_translate_new_dataname", text="New Data")
-class USERPREF_PT_interface_editors(PreferencePanel):
+class USERPREF_PT_interface_editors(PreferencePanel, Panel):
bl_label = "Editors"
@classmethod
@@ -231,7 +232,7 @@ class USERPREF_PT_interface_menus(Panel):
pass
-class USERPREF_PT_interface_menus_mouse_over(PreferencePanel):
+class USERPREF_PT_interface_menus_mouse_over(PreferencePanel, Panel):
bl_label = "Open on Mouse Over"
bl_parent_id = "USERPREF_PT_interface_menus"
@@ -253,7 +254,7 @@ class USERPREF_PT_interface_menus_mouse_over(PreferencePanel):
flow.prop(view, "open_sublevel_delay", text="Sub Level")
-class USERPREF_PT_interface_menus_pie(PreferencePanel):
+class USERPREF_PT_interface_menus_pie(PreferencePanel, Panel):
bl_label = "Pie Menus"
bl_parent_id = "USERPREF_PT_interface_menus"
@@ -284,7 +285,7 @@ class USERPREF_PT_edit_objects(Panel):
def draw(self, context):
pass
-class USERPREF_PT_edit_objects_new(PreferencePanel):
+class USERPREF_PT_edit_objects_new(PreferencePanel, Panel):
bl_label = "New Objects"
bl_parent_id = "USERPREF_PT_edit_objects"
@@ -299,7 +300,7 @@ class USERPREF_PT_edit_objects_new(PreferencePanel):
flow.prop(edit, "use_enter_edit_mode", text="Enter Edit Mode")
-class USERPREF_PT_edit_objects_duplicate_data(PreferencePanel):
+class USERPREF_PT_edit_objects_duplicate_data(PreferencePanel, Panel):
bl_label = "Duplicate Data"
bl_parent_id = "USERPREF_PT_edit_objects"
@@ -326,7 +327,7 @@ class USERPREF_PT_edit_objects_duplicate_data(PreferencePanel):
col.prop(edit, "use_duplicate_texture", text="Texture")
-class USERPREF_PT_edit_cursor(PreferencePanel):
+class USERPREF_PT_edit_cursor(PreferencePanel, Panel):
bl_label = "3D Cursor"
@classmethod
@@ -344,7 +345,7 @@ class USERPREF_PT_edit_cursor(PreferencePanel):
flow.prop(edit, "use_cursor_lock_adjust")
-class USERPREF_PT_edit_gpencil(PreferencePanel):
+class USERPREF_PT_edit_gpencil(PreferencePanel, Panel):
bl_label = "Grease Pencil"
bl_options = {'DEFAULT_CLOSED'}
@@ -363,7 +364,7 @@ class USERPREF_PT_edit_gpencil(PreferencePanel):
flow.prop(edit, "grease_pencil_euclidean_distance", text="Euclidean Distance")
-class USERPREF_PT_edit_annotations(PreferencePanel):
+class USERPREF_PT_edit_annotations(PreferencePanel, Panel):
bl_label = "Annotations"
@classmethod
@@ -381,7 +382,7 @@ class USERPREF_PT_edit_annotations(PreferencePanel):
flow.prop(edit, "grease_pencil_eraser_radius", text="Eraser Radius")
flow.prop(edit, "use_grease_pencil_simplify_stroke", text="Simplify Stroke")
-class USERPREF_PT_edit_weight_paint(PreferencePanel):
+class USERPREF_PT_edit_weight_paint(PreferencePanel, Panel):
bl_label = "Weight Paint"
bl_options = {'DEFAULT_CLOSED'}
@@ -401,7 +402,7 @@ class USERPREF_PT_edit_weight_paint(PreferencePanel):
col.template_color_ramp(view, "weight_color_range", expand=True)
-class USERPREF_PT_edit_misc(PreferencePanel):
+class USERPREF_PT_edit_misc(PreferencePanel, Panel):
bl_label = "Miscellaneous"
bl_options = {'DEFAULT_CLOSED'}
@@ -420,7 +421,7 @@ class USERPREF_PT_edit_misc(PreferencePanel):
flow.prop(edit, "node_margin", text="Node Auto-offset Margin")
-class USERPREF_PT_animation_timeline(PreferencePanel):
+class USERPREF_PT_animation_timeline(PreferencePanel, Panel):
bl_label = "Timeline"
@classmethod
@@ -449,7 +450,7 @@ class USERPREF_PT_animation_timeline(PreferencePanel):
flow.prop(view, "view_frame_keyframes")
-class USERPREF_PT_animation_keyframes(PreferencePanel):
+class USERPREF_PT_animation_keyframes(PreferencePanel, Panel):
bl_label = "Keyframes"
@classmethod
@@ -467,7 +468,7 @@ class USERPREF_PT_animation_keyframes(PreferencePanel):
flow.prop(edit, "use_keyframe_insert_needed", text="Only Insert Needed")
-class USERPREF_PT_animation_autokey(PreferencePanel):
+class USERPREF_PT_animation_autokey(PreferencePanel, Panel):
bl_label = "Auto-Keyframing"
bl_parent_id = "USERPREF_PT_animation_keyframes"
@@ -482,7 +483,7 @@ class USERPREF_PT_animation_autokey(PreferencePanel):
flow.prop(edit, "use_auto_keying", text="Enable in New Scenes")
-class USERPREF_PT_animation_fcurves(PreferencePanel):
+class USERPREF_PT_animation_fcurves(PreferencePanel, Panel):
bl_label = "F-Curves"
@classmethod
@@ -502,7 +503,7 @@ class USERPREF_PT_animation_fcurves(PreferencePanel):
flow.prop(edit, "use_insertkey_xyz_to_rgb", text="XYZ to RGB")
-class USERPREF_PT_system_sound(PreferencePanel):
+class USERPREF_PT_system_sound(PreferencePanel, Panel):
bl_label = "Sound"
@classmethod
@@ -524,7 +525,7 @@ class USERPREF_PT_system_sound(PreferencePanel):
sub.prop(system, "audio_sample_format", text="Sample Format")
-class USERPREF_PT_system_cycles_devices(PreferencePanel):
+class USERPREF_PT_system_cycles_devices(PreferencePanel, Panel):
bl_label = "Cycles Render Devices"
@classmethod
@@ -551,7 +552,7 @@ class USERPREF_PT_system_cycles_devices(PreferencePanel):
# col.row().prop(system, "opensubdiv_compute_type", text="")
-class USERPREF_PT_viewport_display(PreferencePanel):
+class USERPREF_PT_viewport_display(PreferencePanel, Panel):
bl_label = "Display"
@classmethod
@@ -590,7 +591,7 @@ class USERPREF_PT_viewport_display(PreferencePanel):
sub.prop(view, "mini_axis_brightness", text="Brightness")
-class USERPREF_PT_viewport_quality(PreferencePanel):
+class USERPREF_PT_viewport_quality(PreferencePanel, Panel):
bl_label = "Quality"
@classmethod
@@ -611,7 +612,7 @@ class USERPREF_PT_viewport_quality(PreferencePanel):
flow.prop(system, "use_edit_mode_smooth_wire")
-class USERPREF_PT_viewport_textures(PreferencePanel):
+class USERPREF_PT_viewport_textures(PreferencePanel, Panel):
bl_label = "Textures"
@classmethod
@@ -631,7 +632,7 @@ class USERPREF_PT_viewport_textures(PreferencePanel):
flow.prop(system, "image_draw_method", text="Image Display Method")
-class USERPREF_PT_viewport_selection(PreferencePanel):
+class USERPREF_PT_viewport_selection(PreferencePanel, Panel):
bl_label = "Selection"
bl_options = {'DEFAULT_CLOSED'}
@@ -649,7 +650,7 @@ class USERPREF_PT_viewport_selection(PreferencePanel):
flow.prop(system, "use_select_pick_depth")
-class USERPREF_PT_system_memory(PreferencePanel):
+class USERPREF_PT_system_memory(PreferencePanel, Panel):
bl_label = "Memory & Limits"
@classmethod
@@ -724,7 +725,7 @@ class USERPREF_PT_theme(Panel):
row.operator("preferences.reset_default_theme", text="Reset", icon='LOOP_BACK')
-class USERPREF_PT_theme_user_interface(PreferencePanel):
+class USERPREF_PT_theme_user_interface(PreferencePanel, Panel):
bl_space_type = 'PREFERENCES'
bl_region_type = 'WINDOW'
bl_label = "User Interface"
@@ -745,12 +746,11 @@ class USERPREF_PT_theme_user_interface(PreferencePanel):
# Base class for dynamically defined widget color panels.
-class PreferenceThemeWidgetColorPanel(Panel):
+class PreferenceThemeWidgetColorPanel:
bl_space_type = 'PREFERENCES'
bl_region_type = 'WINDOW'
bl_parent_id = "USERPREF_PT_theme_user_interface"
- @staticmethod
def draw(self, context):
theme = context.preferences.themes[0]
ui = theme.user_interface
@@ -786,7 +786,7 @@ class PreferenceThemeWidgetColorPanel(Panel):
return (prefs.active_section == 'THEMES')
-class USERPREF_PT_theme_interface_state(PreferencePanel):
+class USERPREF_PT_theme_interface_state(PreferencePanel, Panel):
bl_label = "State"
bl_options = {'DEFAULT_CLOSED'}
bl_parent_id = "USERPREF_PT_theme_user_interface"
@@ -821,7 +821,7 @@ class USERPREF_PT_theme_interface_state(PreferencePanel):
col.prop(ui_state, "blend")
-class USERPREF_PT_theme_interface_styles(PreferencePanel):
+class USERPREF_PT_theme_interface_styles(PreferencePanel, Panel):
bl_label = "Styles"
bl_options = {'DEFAULT_CLOSED'}
bl_parent_id = "USERPREF_PT_theme_user_interface"
@@ -840,7 +840,7 @@ class USERPREF_PT_theme_interface_styles(PreferencePanel):
flow.prop(ui, "widget_emboss")
-class USERPREF_PT_theme_interface_gizmos(PreferencePanel):
+class USERPREF_PT_theme_interface_gizmos(PreferencePanel, Panel):
bl_label = "Axis & Gizmo Colors"
bl_options = {'DEFAULT_CLOSED'}
bl_parent_id = "USERPREF_PT_theme_
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list