Cleanup: use staticmethod where appropriate
authorCampbell Barton <ideasman42@gmail.com>
Fri, 19 Apr 2019 05:51:14 +0000 (07:51 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 19 Apr 2019 05:51:14 +0000 (07:51 +0200)
release/scripts/startup/bl_ui/properties_physics_dynamicpaint.py
release/scripts/startup/bl_ui/properties_physics_field.py
release/scripts/startup/bl_ui/properties_physics_fluid.py
release/scripts/startup/bl_ui/properties_physics_smoke.py
release/scripts/startup/bl_ui/space_dopesheet.py
release/scripts/startup/bl_ui/space_info.py
release/scripts/startup/bl_ui/space_time.py
release/scripts/startup/bl_ui/space_topbar.py
release/scripts/startup/bl_ui/space_userpref.py
release/scripts/startup/bl_ui/space_view3d.py

index 83a7524..fec8723 100644 (file)
@@ -62,10 +62,12 @@ class PhysicButtonsPanel:
     bl_region_type = 'WINDOW'
     bl_context = "physics"
 
+    @staticmethod
     def poll_dyn_paint(context):
         ob = context.object
         return (ob and ob.type == 'MESH') and context.dynamic_paint
 
+    @staticmethod
     def poll_dyn_canvas(context):
         if not PhysicButtonsPanel.poll_dyn_paint(context):
             return False
@@ -73,6 +75,7 @@ class PhysicButtonsPanel:
         md = context.dynamic_paint
         return (md and md.ui_type == 'CANVAS' and md.canvas_settings and md.canvas_settings.canvas_surfaces.active)
 
+    @staticmethod
     def poll_dyn_canvas_paint(context):
         if not PhysicButtonsPanel.poll_dyn_canvas(context):
             return False
@@ -80,6 +83,7 @@ class PhysicButtonsPanel:
         surface = context.dynamic_paint.canvas_settings.canvas_surfaces.active
         return (surface.surface_type == 'PAINT')
 
+    @staticmethod
     def poll_dyn_canvas_brush(context):
         if not PhysicButtonsPanel.poll_dyn_paint(context):
             return False
@@ -87,6 +91,7 @@ class PhysicButtonsPanel:
         md = context.dynamic_paint
         return (md and md.ui_type == 'BRUSH' and md.brush_settings)
 
+    @staticmethod
     def poll_dyn_output(context):
         if not PhysicButtonsPanel.poll_dyn_canvas(context):
             return False
@@ -94,6 +99,7 @@ class PhysicButtonsPanel:
         surface = context.dynamic_paint.canvas_settings.canvas_surfaces.active
         return (not (surface.surface_format == 'VERTEX' and (surface.surface_type in {'DISPLACE', 'WAVE'})))
 
+    @staticmethod
     def poll_dyn_output_maps(context):
         if not PhysicButtonsPanel.poll_dyn_output(context):
             return False
index 1b8c366..c38dad2 100644 (file)
@@ -32,10 +32,12 @@ class PhysicButtonsPanel:
     bl_region_type = 'WINDOW'
     bl_context = "physics"
 
+    @staticmethod
     def poll_force_field(context):
         ob = context.object
         return (ob and (ob.field) and (ob.field.type != 'NONE'))
 
+    @staticmethod
     def poll_collision(context):
         ob = context.object
         return (ob and ob.type == 'MESH') and (context.collision)
index b01d806..8817d35 100644 (file)
@@ -38,6 +38,7 @@ class PhysicButtonsPanel:
     bl_region_type = 'WINDOW'
     bl_context = "physics"
 
+    @staticmethod
     def poll_fluid(context):
         ob = context.object
         if not ((ob and ob.type == 'MESH') and (context.fluid)):
@@ -45,6 +46,7 @@ class PhysicButtonsPanel:
 
         return (bpy.app.build_options.mod_fluid)
 
+    @staticmethod
     def poll_fluid_settings(context):
         if not (PhysicButtonsPanel.poll_fluid(context)):
             return False
@@ -52,6 +54,7 @@ class PhysicButtonsPanel:
         md = context.fluid
         return md and md.settings and (md.settings.type != 'NONE')
 
+    @staticmethod
     def poll_fluid_domain(context):
         if not PhysicButtonsPanel.poll_fluid(context):
             return False
index 7770db7..898e1f3 100644 (file)
@@ -33,6 +33,7 @@ class PhysicButtonsPanel:
     bl_region_type = 'WINDOW'
     bl_context = "physics"
 
+    @staticmethod
     def poll_smoke(context):
         ob = context.object
         if not ((ob and ob.type == 'MESH') and (context.smoke)):
@@ -41,6 +42,7 @@ class PhysicButtonsPanel:
         md = context.smoke
         return md and (context.smoke.smoke_type != 'NONE') and (bpy.app.build_options.mod_smoke)
 
+    @staticmethod
     def poll_smoke_domain(context):
         if not PhysicButtonsPanel.poll_smoke(context):
             return False
index 5905e0b..61db708 100644 (file)
@@ -236,6 +236,7 @@ class DOPESHEET_HT_editor_buttons(Header):
     def draw(self, context):
         pass
 
+    @staticmethod
     def draw_header(context, layout):
         st = context.space_data
         tool_settings = context.tool_settings
index e22b0bf..196b12c 100644 (file)
@@ -28,7 +28,6 @@ class INFO_HT_header(Header):
         layout.template_header()
 
         # Empty for now until info editor gets turned into log editor
-        pass
 
 
 # Not really info, just add to re-usable location.
index 5c7f2c1..d2c41f1 100644 (file)
@@ -30,6 +30,7 @@ class TIME_HT_editor_buttons(Header):
     def draw(self, context):
         pass
 
+    @staticmethod
     def draw_header(context, layout):
         scene = context.scene
         tool_settings = context.tool_settings
index fad1faf..79769f1 100644 (file)
@@ -260,6 +260,7 @@ class TOPBAR_MT_file_new(Menu):
 
         return sorted(app_templates)
 
+    @staticmethod
     def draw_ex(layout, _context, *, use_splash=False, use_more=False):
         layout.operator_context = 'EXEC_DEFAULT'
 
@@ -639,7 +640,6 @@ class TOPBAR_PT_gpencil_fill(Panel):
     bl_region_type = 'HEADER'
     bl_label = "Advanced"
 
-    @staticmethod
     def draw(self, context):
         paint = context.tool_settings.gpencil_paint
         brush = paint.brush
index a852213..1ee154b 100644 (file)
@@ -697,6 +697,7 @@ class USERPREF_MT_interface_theme_presets(Menu):
     )
     draw = Menu.draw_preset
 
+    @staticmethod
     def reset_cb(context):
         bpy.ops.preferences.reset_default_theme()
 
index ecb629f..a4b96b7 100644 (file)
@@ -3482,15 +3482,15 @@ class VIEW3D_MT_edit_mesh_extrude(Menu):
 
     _extrude_funcs = {
         'VERT': lambda layout:
-            layout.operator("mesh.extrude_vertices_move", text="Extrude Vertices"),
+        layout.operator("mesh.extrude_vertices_move", text="Extrude Vertices"),
         'EDGE': lambda layout:
-            layout.operator("mesh.extrude_edges_move", text="Extrude Edges"),
+        layout.operator("mesh.extrude_edges_move", text="Extrude Edges"),
         'REGION': lambda layout:
-            layout.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Faces"),
+        layout.operator("view3d.edit_mesh_extrude_move_normal", text="Extrude Faces"),
         'REGION_VERT_NORMAL': lambda layout:
-            layout.operator("view3d.edit_mesh_extrude_move_shrink_fatten", text="Extrude Faces Along Normals"),
+        layout.operator("view3d.edit_mesh_extrude_move_shrink_fatten", text="Extrude Faces Along Normals"),
         'FACE': lambda layout:
-            layout.operator("mesh.extrude_faces_move", text="Extrude Individual Faces"),
+        layout.operator("mesh.extrude_faces_move", text="Extrude Individual Faces"),
     }
 
     @staticmethod
@@ -5991,6 +5991,7 @@ class VIEW3D_PT_context_properties(Panel):
     bl_label = "Properties"
     bl_options = {'DEFAULT_CLOSED'}
 
+    @staticmethod
     def _active_context_member(context):
         obj = context.object
         if obj: