make python3.3 compatible, __class__ is no longer in the class methods namespace.
authorCampbell Barton <ideasman42@gmail.com>
Mon, 11 Jul 2011 05:50:49 +0000 (05:50 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 11 Jul 2011 05:50:49 +0000 (05:50 +0000)
release/scripts/modules/bpy/ops.py
release/scripts/startup/bl_operators/presets.py
release/scripts/startup/bl_ui/space_userpref.py
release/scripts/startup/bl_ui/space_userpref_keymap.py
release/scripts/startup/bl_ui/space_view3d.py
release/scripts/startup/bl_ui/space_view3d_toolbar.py

index f54b0a1fefc9fc376146e04f5038cee2e3a075b6..64c5a1a5f5fcf52d9e90f93110623bbf805091e1 100644 (file)
@@ -29,7 +29,7 @@ op_as_string = ops_module.as_string
 op_get_rna = ops_module.get_rna
 
 
-class bpy_ops(object):
+class BPyOps(object):
     '''
     Fake module like class.
 
@@ -42,7 +42,7 @@ class bpy_ops(object):
         '''
         if module.startswith('__'):
             raise AttributeError(module)
-        return bpy_ops_submodule(module)
+        return BPyOpsSubMod(module)
 
     def __dir__(self):
 
@@ -67,7 +67,7 @@ class bpy_ops(object):
         return "<module like class 'bpy.ops'>"
 
 
-class bpy_ops_submodule(object):
+class BPyOpsSubMod(object):
     '''
     Utility class to fake submodules.
 
@@ -84,7 +84,7 @@ class bpy_ops_submodule(object):
         '''
         if func.startswith('__'):
             raise AttributeError(func)
-        return bpy_ops_submodule_op(self.module, func)
+        return BPyOpsSubModOp(self.module, func)
 
     def __dir__(self):
 
@@ -103,7 +103,7 @@ class bpy_ops_submodule(object):
         return "<module like class 'bpy.ops.%s'>" % self.module
 
 
-class bpy_ops_submodule_op(object):
+class BPyOpsSubModOp(object):
     '''
     Utility class to fake submodule operators.
 
@@ -151,7 +151,7 @@ class bpy_ops_submodule_op(object):
         self.func = func
 
     def poll(self, *args):
-        C_dict, C_exec = __class__._parse_args(args)
+        C_dict, C_exec = BPyOpsSubModOp._parse_args(args)
         return op_poll(self.idname_py(), C_dict, C_exec)
 
     def idname(self):
@@ -170,16 +170,16 @@ class bpy_ops_submodule_op(object):
         wm = context.window_manager
 
         # run to account for any rna values the user changes.
-        __class__._scene_update(context)
+        BPyOpsSubModOp._scene_update(context)
 
         if args:
-            C_dict, C_exec = __class__._parse_args(args)
+            C_dict, C_exec = BPyOpsSubModOp._parse_args(args)
             ret = op_call(self.idname_py(), C_dict, kw, C_exec)
         else:
             ret = op_call(self.idname_py(), None, kw)
 
         if 'FINISHED' in ret and context.window_manager == wm:
-            __class__._scene_update(context)
+            BPyOpsSubModOp._scene_update(context)
 
         return ret
 
@@ -208,4 +208,4 @@ class bpy_ops_submodule_op(object):
         return "<function bpy.ops.%s.%s at 0x%x'>" % \
                 (self.module, self.func, id(self))
 
-ops_fake_module = bpy_ops()
+ops_fake_module = BPyOps()
index 2175d7528a460db1293f9c6c27d23c100fb358e6..f3c799c9ac28ed85035aef91d65c3cdcb5aa1a7b 100644 (file)
@@ -315,7 +315,7 @@ class AddPresetOperator(AddPresetBase, bpy.types.Operator):
 
     @property
     def preset_subdir(self):
-        return __class__.operator_path(self.operator)
+        return AddPresetOperator.operator_path(self.operator)
 
     @property
     def preset_values(self):
index 24b9098895320c8e624750cc6d677b9d0a62cd0a..6a809aefb9dfbf98df6daae06ebe457258fa8dcf 100644 (file)
@@ -986,7 +986,7 @@ class USERPREF_PT_addons(bpy.types.Panel):
                         split.label(text="Warning:")
                         split.label(text='  ' + info["warning"], icon='ERROR')
 
-                    user_addon = __class__.is_user_addon(mod, user_addon_paths)
+                    user_addon = USERPREF_PT_addons.is_user_addon(mod, user_addon_paths)
                     tot_row = bool(info["wiki_url"]) + bool(info["tracker_url"]) + bool(user_addon)
 
                     if tot_row:
@@ -1136,7 +1136,7 @@ class WM_OT_addon_install(bpy.types.Operator):
 
             if self.overwrite:
                 for f in file_to_extract.namelist():
-                    __class__._module_remove(path_addons, f)
+                    WM_OT_addon_install._module_remove(path_addons, f)
             else:
                 for f in file_to_extract.namelist():
                     path_dest = os.path.join(path_addons, os.path.basename(f))
@@ -1160,7 +1160,7 @@ class WM_OT_addon_install(bpy.types.Operator):
             path_dest = os.path.join(path_addons, os.path.basename(pyfile))
 
             if self.overwrite:
-                __class__._module_remove(path_addons, os.path.basename(pyfile))
+                WM_OT_addon_install._module_remove(path_addons, os.path.basename(pyfile))
             elif os.path.exists(path_dest):
                 self.report({'WARNING'}, "File already installed to %r\n" % path_dest)
                 return {'CANCELLED'}
@@ -1225,7 +1225,7 @@ class WM_OT_addon_remove(bpy.types.Operator):
         return None, False
 
     def execute(self, context):
-        path, isdir = __class__.path_from_addon(self.module)
+        path, isdir = WM_OT_addon_remove.path_from_addon(self.module)
         if path is None:
             self.report('WARNING', "Addon path %r could not be found" % path)
             return {'CANCELLED'}
@@ -1245,7 +1245,7 @@ class WM_OT_addon_remove(bpy.types.Operator):
     # lame confirmation check
     def draw(self, context):
         self.layout.label(text="Remove Addon: %r?" % self.module)
-        path, isdir = __class__.path_from_addon(self.module)
+        path, isdir = WM_OT_addon_remove.path_from_addon(self.module)
         self.layout.label(text="Path: %r" % path)
 
     def invoke(self, context, event):
index 29ec6301fc1d3b6c4caab98d3f72c10c0e939c88..85764c5530481807d0b46e6bd60ca900487df530 100644 (file)
@@ -234,7 +234,7 @@ class InputKeyMapPanel:
         for pname, value in properties.bl_rna.properties.items():
             if pname != "rna_type" and not properties.is_property_hidden(pname):
                 if isinstance(value, bpy.types.OperatorProperties):
-                    __class__.draw_kmi_properties(box, value, title=pname)
+                    InputKeyMapPanel.draw_kmi_properties(box, value, title=pname)
                 else:
                     flow.prop(properties, pname)
 
@@ -325,7 +325,7 @@ class InputKeyMapPanel:
             # Operator properties
             props = kmi.properties
             if props is not None:
-                __class__.draw_kmi_properties(box, props)
+                InputKeyMapPanel.draw_kmi_properties(box, props)
 
             # Modal key maps attached to this operator
             if not km.is_modal:
index 2b58f2a216fbff9a615300c5f9eba99fb946c34c..aef6accb4e1bff3011260bf21313f4ce3ebe0786 100644 (file)
@@ -2410,7 +2410,7 @@ class VIEW3D_PT_context_properties(bpy.types.Panel):
 
     def draw(self, context):
         import rna_prop_ui
-        member = __class__._active_context_member(context)
+        member = VIEW3D_PT_context_properties._active_context_member(context)
 
         if member:
             # Draw with no edit button
index 9a85b87a9eb4716738f514efc943a1a313a5be8b..e1efeed87ea5fc7ed386dffda15443a4d040f8f2 100644 (file)
@@ -465,7 +465,7 @@ class VIEW3D_PT_tools_brush(PaintPanel, bpy.types.Panel):
     def draw(self, context):
         layout = self.layout
 
-        settings = __class__.paint_settings(context)
+        settings = self.paint_settings(context)
         brush = settings.brush
 
         if not context.particle_edit_object:
@@ -686,7 +686,7 @@ class VIEW3D_PT_tools_brush_texture(PaintPanel, bpy.types.Panel):
     def draw(self, context):
         layout = self.layout
 
-        settings = __class__.paint_settings(context)
+        settings = self.paint_settings(context)
         brush = settings.brush
         tex_slot = brush.texture_slot
 
@@ -785,7 +785,7 @@ class VIEW3D_PT_tools_brush_tool(PaintPanel, bpy.types.Panel):
     def draw(self, context):
         layout = self.layout
 
-        settings = __class__.paint_settings(context)
+        settings = self.paint_settings(context)
         brush = settings.brush
 
         col = layout.column(align=True)
@@ -820,7 +820,7 @@ class VIEW3D_PT_tools_brush_stroke(PaintPanel, bpy.types.Panel):
     def draw(self, context):
         layout = self.layout
 
-        settings = __class__.paint_settings(context)
+        settings = self.paint_settings(context)
         brush = settings.brush
         image_paint = context.image_paint_object
 
@@ -1003,7 +1003,7 @@ class VIEW3D_PT_tools_brush_appearance(PaintPanel, bpy.types.Panel):
     def draw(self, context):
         layout = self.layout
 
-        settings = __class__.paint_settings(context)
+        settings = self.paint_settings(context)
         brush = settings.brush
 
         if brush is None:  # unlikely but can happen