pep8 cleanup
authorCampbell Barton <ideasman42@gmail.com>
Sun, 10 Feb 2013 08:54:10 +0000 (08:54 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 10 Feb 2013 08:54:10 +0000 (08:54 +0000)
release/scripts/presets/keyconfig/maya.py
release/scripts/startup/bl_operators/rigidbody.py
release/scripts/startup/bl_ui/properties_paint_common.py
release/scripts/startup/bl_ui/properties_particle.py
release/scripts/startup/bl_ui/properties_physics_common.py
release/scripts/startup/bl_ui/properties_physics_rigidbody.py
release/scripts/startup/bl_ui/properties_physics_rigidbody_constraint.py
release/scripts/startup/bl_ui/properties_scene.py
release/scripts/startup/bl_ui/space_clip.py
release/scripts/startup/bl_ui/space_image.py
release/scripts/startup/bl_ui/space_view3d.py

index cea2f45..ad6a2be 100644 (file)
@@ -218,7 +218,7 @@ kmi.properties.use = True
 kmi = km.keymap_items.new('transform.mirror', 'M', 'PRESS', ctrl=True)
 kmi = km.keymap_items.new('wm.context_toggle', 'TAB', 'PRESS', shift=True)
 kmi.properties.data_path = 'tool_settings.use_snap'
-kmi = km.keymap_items.new('WM_OT_context_menu_enum', 'TAB', 'PRESS', shift=True, ctrl=True);
+kmi = km.keymap_items.new('WM_OT_context_menu_enum', 'TAB', 'PRESS', shift=True, ctrl=True)
 kmi.properties.data_path = 'tool_settings.snap_element'
 
 kmi = km.keymap_items.new('view3d.enable_manipulator', 'W', 'PRESS')
index 1613491..bb3a9a6 100644 (file)
@@ -54,7 +54,7 @@ class CopyRigidbodySettings(Operator):
             for o in objects:
                 if o.rigid_body is None:
                     continue
-                
+
                 o.rigid_body.type = obj.rigid_body.type
                 o.rigid_body.kinematic = obj.rigid_body.kinematic
                 o.rigid_body.mass = obj.rigid_body.mass
@@ -144,7 +144,7 @@ class BakeToKeyframes(Operator):
                         # this is a little roundabout but there's no better way right now
                         aa = mat.to_quaternion().to_axis_angle()
                         obj.rotation_axis_angle = (aa[1], ) + aa[0][:]
-                    else: # euler
+                    else:  # euler
                         # make sure euler rotation is compatible to previous frame
                         obj.rotation_euler = mat.to_euler(rot_mode, obj_prev.rotation_euler)
 
@@ -190,7 +190,8 @@ class BakeToKeyframes(Operator):
 
 
 class ConnectRigidBodies(Operator):
-    '''Create rigid body constraints between selected and active rigid bodies'''
+    """Create rigid body constraints between """ \
+    """selected and active rigid bodies"""
     bl_idname = "rigidbody.connect"
     bl_label = "Connect Rigid Bodies"
     bl_options = {'REGISTER', 'UNDO'}
@@ -232,7 +233,11 @@ class ConnectRigidBodies(Operator):
                 loc = obj.location
             else:
                 loc = (obj_act.location + obj.location) / 2.0
-            bpy.ops.object.add(type='EMPTY', view_align=False, enter_editmode=False, location=loc)
+            # TODO: use bpy.data.objects.new(...)
+            bpy.ops.object.add(type='EMPTY',
+                               view_align=False,
+                               enter_editmode=False,
+                               location=loc)
             bpy.ops.rigidbody.constraint_add()
             con_obj = context.active_object
             con_obj.empty_draw_type = 'ARROWS'
@@ -241,12 +246,12 @@ class ConnectRigidBodies(Operator):
             con.object1 = obj_act
             con.object2 = obj
             change = True
-        
+
         if change:
             # restore selection
             bpy.ops.object.select_all(action='DESELECT')
             for obj in objects:
-                obj.select = True;
+                obj.select = True
             scene.objects.active = obj_act
             return {'FINISHED'}
         else:
index 022f250..7c06aef 100644 (file)
@@ -82,7 +82,7 @@ def brush_texture_settings(layout, brush, sculpt):
     else:
         layout.row().prop(tex_slot, "tex_paint_map_mode", text="")
         layout.separator()
-        
+
     # angle and texture_angle_source
     col = layout.column()
     if sculpt:
@@ -101,7 +101,7 @@ def brush_texture_settings(layout, brush, sculpt):
     split = layout.split()
     split.prop(tex_slot, "offset")
     split.prop(tex_slot, "scale")
-    
+
     if sculpt:
         # texture_sample_bias
         col = layout.column(align=True)
index aef860e..ee8c74a 100644 (file)
@@ -543,7 +543,7 @@ class PARTICLE_PT_physics(ParticleButtonsPanel, Panel):
                     # spacing between particles when the fluid is at rest. This
                     # makes it easier to set stable initial conditions.
                     particle_volume = part.mass / fluid.rest_density
-                    spacing = pow(particle_volume, 1/3)
+                    spacing = pow(particle_volume, 1.0 / 3.0)
                     sub = col.row()
                     sub.label(text="Spacing: %g" % spacing)
 
index 17a44a5..a640cb2 100644 (file)
@@ -44,6 +44,7 @@ def physics_add(self, layout, md, name, type, typeicon, toggles):
     else:
         sub.operator("object.modifier_add", text=name, icon=typeicon).type = type
 
+
 def physics_add_special(self, layout, data, name, addop, removeop, typeicon):
     sub = layout.row(align=True)
     if data:
@@ -51,6 +52,7 @@ def physics_add_special(self, layout, data, name, addop, removeop, typeicon):
     else:
         sub.operator(addop, text=name, icon=typeicon)
 
+
 class PHYSICS_PT_add(PhysicButtonsPanel, Panel):
     bl_label = ""
     bl_options = {'HIDE_HEADER'}
@@ -86,13 +88,13 @@ class PHYSICS_PT_add(PhysicButtonsPanel, Panel):
             physics_add_special(self, col, ob.rigid_body, "Rigid Body",
                                 "rigidbody.object_add",
                                 "rigidbody.object_remove",
-                                'MESH_ICOSPHERE') # XXX: need dedicated icon
+                                'MESH_ICOSPHERE')  # XXX: need dedicated icon
 
         # all types of objects can have rigid body constraint
         physics_add_special(self, col, ob.rigid_body_constraint, "Rigid Body Constraint",
                             "rigidbody.constraint_add",
                             "rigidbody.constraint_remove",
-                            'CONSTRAINT') # RB_TODO needs better icon
+                            'CONSTRAINT')  # RB_TODO needs better icon
 
 
 # cache-type can be 'PSYS' 'HAIR' 'SMOKE' etc
index f335c56..922eee6 100644 (file)
@@ -32,22 +32,22 @@ class PHYSICS_PT_rigid_body(PHYSICS_PT_rigidbody_panel, Panel):
 
     @classmethod
     def poll(cls, context):
-        ob = context.object
-        rd = context.scene.render
-        return (ob and ob.rigid_body and (not rd.use_game_engine))
+        obj = context.object
+        return (obj and obj.rigid_body and
+                (not context.scene.render.use_game_engine))
 
     def draw_header(self, context):
         obj = context.object
         rbo = obj.rigid_body
         if rbo is not None:
-            self.layout.prop(rbo, "enabled", text="");
+            self.layout.prop(rbo, "enabled", text="")
 
     def draw(self, context):
         layout = self.layout
 
         ob = context.object
         rbo = ob.rigid_body
-        
+
         if rbo is not None:
             layout.prop(rbo, "type", text="Type")
             layout.prop(rbo, "kinematic", text="Animated")
@@ -61,34 +61,35 @@ class PHYSICS_PT_rigid_body_collisions(PHYSICS_PT_rigidbody_panel, Panel):
 
     @classmethod
     def poll(cls, context):
-        return (context.object and context.object.rigid_body and 
+        obj = context.object
+        return (obj and obj.rigid_body and
                 (not context.scene.render.use_game_engine))
-        
+
     def draw(self, context):
         layout = self.layout
 
         ob = context.object
         rbo = ob.rigid_body
-        
+
         layout.prop(rbo, "collision_shape", text="Shape")
-        
+
         split = layout.split()
-        
+
         col = split.column()
         col.label(text="Surface Response:")
         col.prop(rbo, "friction")
         col.prop(rbo, "restitution", text="Bounciness")
-        
+
         col = split.column()
         col.label(text="Sensitivity:")
         if rbo.collision_shape in {'MESH', 'CONE'}:
             col.prop(rbo, "collision_margin", text="Margin")
         else:
-            col.prop(rbo, "use_margin");
+            col.prop(rbo, "use_margin")
             sub = col.column()
             sub.active = rbo.use_margin
             sub.prop(rbo, "collision_margin", text="Margin")
-            
+
         layout.prop(rbo, "collision_groups")
 
 
@@ -98,22 +99,23 @@ class PHYSICS_PT_rigid_body_dynamics(PHYSICS_PT_rigidbody_panel, Panel):
 
     @classmethod
     def poll(cls, context):
-        return (context.object and context.object.rigid_body and
-                context.object.rigid_body.type == 'ACTIVE' and
+        obj = context.object
+        return (obj and obj.rigid_body and
+                obj.rigid_body.type == 'ACTIVE' and
                 (not context.scene.render.use_game_engine))
-        
+
     def draw(self, context):
         layout = self.layout
 
         ob = context.object
         rbo = ob.rigid_body
-        
+
         #col = layout.column(align=1)
         #col.label(text="Activation:")
         # XXX: settings such as activate on collison/etc. 
-        
-        split = layout.split();
-        
+
+        split = layout.split()
+
         col = split.column()
         col.label(text="Deactivation:")
         col.prop(rbo, "use_deactivation")
@@ -123,7 +125,7 @@ class PHYSICS_PT_rigid_body_dynamics(PHYSICS_PT_rigidbody_panel, Panel):
         sub.prop(rbo, "deactivate_linear_velocity", text="Linear Vel")
         sub.prop(rbo, "deactivate_angular_velocity", text="Angular Vel")
         # TODO: other params such as time?
-        
+
         col = split.column()
         col.label(text="Damping:")
         col.prop(rbo, "linear_damping", text="Translation")
index 49b760e..e4e5b94 100644 (file)
@@ -173,7 +173,7 @@ class PHYSICS_PT_rigid_body_constraint(PHYSICS_PT_rigidbody_constraint_panel, Pa
             sub.prop(rbc, "limit_ang_z_lower", text="Lower")
             sub.prop(rbc, "limit_ang_z_upper", text="Upper")
 
-            if rbc.type == 'GENERIC_SPRING':                  
+            if rbc.type == 'GENERIC_SPRING':
                 col = layout.column(align=True)
                 col.label("Springs:")
 
index b9b5792..68a097e 100644 (file)
@@ -26,6 +26,7 @@ from bl_ui.properties_physics_common import (
     effector_weights_ui,
     )
 
+
 class SCENE_UL_keying_set_paths(UIList):
     def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
         # assert(isinstance(item, bpy.types.KeyingSetPath)
index 84f26ac..b61830a 100644 (file)
@@ -28,10 +28,14 @@ class CLIP_UL_tracking_objects(UIList):
         # assert(isinstance(item, bpy.types.MovieTrackingObject)
         tobj = item
         if self.layout_type in {'DEFAULT', 'COMPACT'}:
-            layout.label(text=tobj.name, translate=False, icon='CAMERA_DATA' if tobj.is_camera else 'OBJECT_DATA')
+            layout.label(text=tobj.name, translate=False,
+                         icon='CAMERA_DATA' if tobj.is_camera
+                         else 'OBJECT_DATA')
         elif self.layout_type in {'GRID'}:
             layout.alignment = 'CENTER'
-            layout.label(text="", icon='CAMERA_DATA' if tobj.is_camera else 'OBJECT_DATA')
+            layout.label(text="",
+                         icon='CAMERA_DATA' if tobj.is_camera
+                         else 'OBJECT_DATA')
 
 
 class CLIP_HT_header(Header):
index 6d08663..43535eb 100644 (file)
@@ -22,6 +22,7 @@ from bpy.types import Header, Menu, Panel
 from bl_ui.properties_paint_common import UnifiedPaintPanel
 from bl_ui.properties_paint_common import brush_texture_settings
 
+
 class ImagePaintPanel(UnifiedPaintPanel):
     bl_space_type = 'IMAGE_EDITOR'
     bl_region_type = 'UI'
@@ -722,7 +723,7 @@ class IMAGE_PT_tools_brush_texture(BrushButtonsPanel, Panel):
 
         col = layout.column()
         col.template_ID_preview(brush, "texture", new="texture.new", rows=3, cols=8)
-        
+
         brush_texture_settings(col, brush, 0)
 
 
index 6a0cf44..fcc2024 100644 (file)
@@ -2695,7 +2695,7 @@ class VIEW3D_PT_etch_a_ton(Panel):
 
             colsub = col.column(align=True)
             colsub.prop(toolsettings, "use_etch_autoname")
-            sub = colsub.column() 
+            sub = colsub.column()
             sub.enabled = not toolsettings.use_etch_autoname
             sub.prop(toolsettings, "etch_number")
             sub.prop(toolsettings, "etch_side")