Code clean-up: Use standard-conformal {'sets'} for .report and operator return values
authorSebastian Nell <codemanx@gmx.de>
Wed, 23 May 2012 22:11:53 +0000 (22:11 +0000)
committerSebastian Nell <codemanx@gmx.de>
Wed, 23 May 2012 22:11:53 +0000 (22:11 +0000)
12 files changed:
btrace/bTrace.py
cmu_mocap_browser/__init__.py
curve_tools.py
geodesic_domes/third_domes_panel.py
io_export_marmalade.py
mesh_show_vgroup_weights.py
object_mangle_tools.py
particle_hair_lab.py
presets/keyconfig/blender_2012_experimental.py
sequencer_tools/export_strips.py
space_view3d_enhanced_3d_cursor.py
text_editor_pasteall.py

index c4769e837887af9f429354c465db9c47d0099240..4b87516d460c92d4a713ad7bbe3c6ee3227f9dc0 100644 (file)
@@ -646,7 +646,7 @@ class OBJECT_OT_objecttrace(bpy.types.Operator):
                 addtracemat(bpy.context.object.data)
             if Btrace.animate:
                 bpy.ops.curve.btgrow()
-        return{"FINISHED"}
+        return {'FINISHED'}
 
 
 ################## ################## ################## ############
@@ -734,7 +734,7 @@ class OBJECT_OT_objectconnect(bpy.types.Operator):
         bpy.ops.object.group_link(group="Btrace") # add to Btrace group
         if Btrace.animate:
             bpy.ops.curve.btgrow() # Add grow curve
-        return{"FINISHED"}
+        return {'FINISHED'}
 
 
 ################## ################## ################## ############
@@ -811,7 +811,7 @@ class OBJECT_OT_particletrace(bpy.types.Operator):
         if Btrace.animate:
             bpy.ops.curve.btgrow()  # Add grow curve
 
-        return{"FINISHED"}
+        return {'FINISHED'}
 
 
 ###########################################################################
@@ -837,7 +837,7 @@ class OBJECT_OT_traceallparticles(bpy.types.Operator):
 
         # Grids distribution not supported
         if set.distribution == 'GRID':
-            self.report('INFO',"Grid distribution mode for particles not supported.")
+            self.report({'INFO'},"Grid distribution mode for particles not supported.")
             return{'FINISHED'}
         
         Btrace = bpy.context.window_manager.curve_tracer
@@ -1040,11 +1040,11 @@ class OBJECT_OT_convertcurve(bpy.types.Operator):
         if Btrace.distort_curve: 
             scale = Btrace.distort_modscale
             if scale == 0:
-                return{"FINISHED"}
+                return {'FINISHED'}
             for u in obj.data.splines:
                 for v in u.bezier_points:
                     v.radius = scale*round(random.random(),3) 
-        return{"FINISHED"}
+        return {'FINISHED'}
 
 
 ################## ################## ################## ############
@@ -1439,7 +1439,7 @@ class OBJECT_OT_fcnoise(bpy.types.Operator):
                             n.strength = amplitude
                             n.scale = time_scale
                             n.phase = random.randint(0,999)
-        return{"FINISHED"}
+        return {'FINISHED'}
 
 ################## ################## ################## ############
 ## Curve Grow Animation
index b586dc7e8c8ba9340e70f08ff01a645643cf7f1e..bd0c97b08fa5824cbc9812335041dd88c223a065 100644 (file)
@@ -214,7 +214,7 @@ class CMUMocapDownloadImport(bpy.types.Operator):
             return {'RUNNING_MODAL'}
         else:
             self.import_or_open()
-        return {"FINISHED"}
+        return {'FINISHED'}
 
     def import_or_open(self):
         cml = bpy.data.scenes[0].cmu_mocap_lib
index 23c02e5ef10f06d885cc9d555c9ff50359f206fc..ffc144f34a7b556f165f0059de6452f296a3f3df 100644 (file)
@@ -781,7 +781,7 @@ class Birail1Operator(bpy.types.Operator):
         objs = bpy.selection
 
         if len(objs)!=3:
-            self.report("ERROR","Please select 3 curves")
+            self.report({'ERROR'},"Please select 3 curves")
             return {'FINISHED'}
 
         scn = context.scene
index 270f621ffb4ff0a4355cbfe618dfcbb854f2505b..b97b69763f2780d0625d36c2f67b8068331d23e1 100644 (file)
@@ -760,7 +760,7 @@ class GenerateGeodesicDome(bpy.types.Operator):
                 if obj_name == "None":
                     message = "fill in a name \nof an existing mesh\nto be imported"
                     context.scene.error_message = message
-                    self.report({"INFO"}, message)
+                    self.report({'INFO'}, message)
                     print("***INFO*** you have to fill in the name of an existing mesh")
                 else:
 #                    obj_in_scene = context.objects
index 16416777eb5f996b8604e6f574bda2b647c6fbd7..9026380b7d9214d03225ba9f419aa5f1632e6276 100644 (file)
@@ -1449,14 +1449,14 @@ class MarmaladeExporter(bpy.types.Operator):
             bpy.ops.object.mode_set(mode='OBJECT')
 
         ExportMadeWithMarmaladeGroup(Config)
-        return {"FINISHED"}
+        return {'FINISHED'}
 
     def invoke(self, context, event):
         if not self.filepath:
             self.filepath = bpy.path.ensure_ext(bpy.data.filepath, ".group")
         WindowManager = context.window_manager
         WindowManager.fileselect_add(self)
-        return {"RUNNING_MODAL"}
+        return {'RUNNING_MODAL'}
 
 
 def menu_func(self, context):
index d077a499ef2d93a894aa890805bd44a522b31a77..61830b7b7a73e6426c592843836da71980b8c014 100644 (file)
@@ -184,7 +184,7 @@ class ShowVGroupWeights(bpy.types.Operator):
                 clear_properties(full=False)
                 return {'RUNNING_MODAL'}
         else:
-            self.report({"WARNING"}, "View3D not found, can't run operator")
+            self.report({'WARNING'}, "View3D not found, can't run operator")
             return {'CANCELLED'}
 
 
index a0e13e10db93a2bf52f4fad6bb84246fedd5827a..24729d7fc7228a88f820371ac701351ca193544f 100644 (file)
@@ -77,7 +77,7 @@ class MeshManglerOperator(bpy.types.Operator):
         random.seed( time.time() )
 
         if mesh.shape_keys != None:
-            self.report( {"INFO"}, "Cannot mangle mesh: Shape keys present" )
+            self.report({'INFO'}, "Cannot mangle mesh: Shape keys present")
             return {'CANCELLED'}
         
         for vert in verts:
@@ -133,7 +133,7 @@ class CurveManglerOp(bpy.types.Operator):
 
         ob = context.active_object
         if ob.data.shape_keys != None:
-            self.report({"INFO"}, "Cannot mangle curve.  Shape keys present")
+            self.report({'INFO'}, "Cannot mangle curve.  Shape keys present")
             return {'CANCELLED'}
         splines = context.object.data.splines
         
index d05f04b2b28c674ab7fb2189619ec305a4ce6fad..23dcfa1ceddd09b82c4a8e9762db4826a56303ef 100644 (file)
@@ -48,7 +48,7 @@ class saveSelectionPanel(bpy.types.Panel):
     bl_region_type = 'TOOLS'
 
     bl_label = "Selection Save"
-    bl_options = {"DEFAULT_CLOSED"}
+    bl_options = {'DEFAULT_CLOSED'}
     bl_context = "particlemode"
     
 
@@ -99,7 +99,7 @@ class saveSelection(bpy.types.Operator):
     
     def execute(self, context):
         
-        return {"FINISHED"}
+        return {'FINISHED'}
 """
 class testScene1(bpy.types.Operator):
     bl_idname = "grass.switch_back"
@@ -112,7 +112,7 @@ class testScene1(bpy.types.Operator):
         scene = bpy.context.scene
         bpy.data.scenes.remove(scene)
         
-        return {"FINISHED"}
+        return {'FINISHED'}
         
         
 class testScene2(bpy.types.Operator):
@@ -199,7 +199,7 @@ class testScene2(bpy.types.Operator):
         bpy.ops.mesh.primitive_uv_sphere_add(size=0.1)
         bpy.ops.object.shade_smooth()
                
-        return {"FINISHED"}
+        return {'FINISHED'}
 
 
 class Generategrass(bpy.types.Operator):
@@ -560,7 +560,7 @@ class saveSelection(bpy.types.Operator):
     
     def execute(self, context):
         
-        return {"FINISHED"}
+        return {'FINISHED'}
 """
 class testScene3(bpy.types.Operator):
     bl_idname = "hair.switch_back"
@@ -573,7 +573,7 @@ class testScene3(bpy.types.Operator):
         scene = bpy.context.scene
         bpy.data.scenes.remove(scene)
         
-        return {"FINISHED"}
+        return {'FINISHED'}
         
         
 class testScene4(bpy.types.Operator):
@@ -658,7 +658,7 @@ class testScene4(bpy.types.Operator):
 # add sphere
         bpy.ops.mesh.primitive_uv_sphere_add(size=0.1)
         bpy.ops.object.shade_smooth()       
-        return {"FINISHED"}
+        return {'FINISHED'}
 
 
 class GenerateHair(bpy.types.Operator):
@@ -1013,7 +1013,7 @@ class saveSelection(bpy.types.Operator):
     
     def execute(self, context):
         
-        return {"FINISHED"}
+        return {'FINISHED'}
 """
 class testScene5(bpy.types.Operator):
     bl_idname = "fur.switch_back"
@@ -1026,7 +1026,7 @@ class testScene5(bpy.types.Operator):
         scene = bpy.context.scene
         bpy.data.scenes.remove(scene)
         
-        return {"FINISHED"}
+        return {'FINISHED'}
         
         
 class testScene6(bpy.types.Operator):
@@ -1111,7 +1111,7 @@ class testScene6(bpy.types.Operator):
 # add sphere
         bpy.ops.mesh.primitive_uv_sphere_add(size=0.1)
         bpy.ops.object.shade_smooth()       
-        return {"FINISHED"}
+        return {'FINISHED'}
 
 
 class GenerateFur(bpy.types.Operator):
index 8e003bd288351d3b634938e9e2c2226c20baf3da..e41f6c5ea2f204889b22b50bd7bd8ee06c2d49d5 100644 (file)
@@ -72,7 +72,7 @@ class ObjectDeleteNoConfirm(bpy.types.Operator):
     '''Deletes selected objects without the confirmation popup.'''
     bl_idname = "object.delete_no_confirm"
     bl_label = "Delete Objects No Confirm"
-    bl_options = {"UNDO"}
+    bl_options = {'UNDO'}
     
     @classmethod
     def poll(cls, context):
index c46e228fec7ffecee530c40e4c3add992b22affc..5857eb3caa87c7bfe440ba09c01ed28fc9f3fc08 100644 (file)
@@ -61,12 +61,12 @@ class SEQExportStrip(bpy.types.Operator):
         sce.render.filepath = back_filepath
         sce.frame_start = back_start
         sce.frame_end = back_end
-        return {"FINISHED"}
+        return {'FINISHED'}
 
     def invoke(self, context, event):
         if not self.filepath:
             self.filepath = bpy.context.scene.render.filepath
         winman = context.window_manager
         winman.fileselect_add(self)
-        return {"RUNNING_MODAL"}
+        return {'RUNNING_MODAL'}
 
index 6815e61322c4bf04da4847aac5bc32ac838b831a..88b1cf063811cc9442ac092fce000f4a6eb2aae1 100644 (file)
@@ -3439,7 +3439,7 @@ class NewCursor3DBookmark(bpy.types.Operator):
             bookmark.pos = library.convert_from_abs(context.space_data,
                                                     cusor_pos, True)
         except Exception as exc:
-            self.report('ERROR_INVALID_CONTEXT', exc.args[0])
+            self.report({'ERROR_INVALID_CONTEXT'}, exc.args[0])
             return {'CANCELLED'}
         
         return {'FINISHED'}
@@ -3487,7 +3487,7 @@ class OverwriteCursor3DBookmark(bpy.types.Operator):
             bookmark.pos = library.convert_from_abs(context.space_data,
                                                     cusor_pos, True)
         except Exception as exc:
-            self.report('ERROR_INVALID_CONTEXT', exc.args[0])
+            self.report({'ERROR_INVALID_CONTEXT'}, exc.args[0])
             return {'CANCELLED'}
         
         CursorDynamicSettings.recalc_csu(context, 'PRESS')
@@ -3518,7 +3518,7 @@ class RecallCursor3DBookmark(bpy.types.Operator):
                                                   bookmark.pos, True)
             set_cursor_location(bookmark_pos, v3d=context.space_data)
         except Exception as exc:
-            self.report('ERROR_INVALID_CONTEXT', exc.args[0])
+            self.report({'ERROR_INVALID_CONTEXT'}, exc.args[0])
             return {'CANCELLED'}
         
         CursorDynamicSettings.recalc_csu(context)
@@ -3556,7 +3556,7 @@ class SwapCursor3DBookmark(bpy.types.Operator):
                                                     cusor_pos, True,
                 use_history=False)
         except Exception as exc:
-            self.report('ERROR_INVALID_CONTEXT', exc.args[0])
+            self.report({'ERROR_INVALID_CONTEXT'}, exc.args[0])
             return {'CANCELLED'}
         
         CursorDynamicSettings.recalc_csu(context)
@@ -3594,7 +3594,7 @@ class AddEmptyAtCursor3DBookmark(bpy.types.Operator):
                                         v3d=context.space_data, warn=True)
             bookmark_pos = matrix * bookmark.pos
         except Exception as exc:
-            self.report('ERROR_INVALID_CONTEXT', exc.args[0])
+            self.report({'ERROR_INVALID_CONTEXT'}, exc.args[0])
             return {'CANCELLED'}
         
         name = "{}.{}".format(library.name, bookmark.name)
index ec9fa6683a76e1a86683818839900dcdd9d04101..a6565f6c07c76c75715bb47baaeaf5ad59783cf8 100644 (file)
@@ -110,7 +110,7 @@ class TEXT_OT_pasteall(bpy.types.Operator):
             try:
                 webbrowser.open_new_tab(page)
             except:
-                self.report('WARNING', "Error in opening the page %s." % (page))
+                self.report({'WARNING'}, "Error in opening the page %s." % (page))
 
         return {'FINISHED'}