[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38294] trunk/blender/release/scripts: make python3.3 compatible, __class__ is no longer in the class methods namespace.

Campbell Barton ideasman42 at gmail.com
Mon Jul 11 07:50:49 CEST 2011


Revision: 38294
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38294
Author:   campbellbarton
Date:     2011-07-11 05:50:49 +0000 (Mon, 11 Jul 2011)
Log Message:
-----------
make python3.3 compatible, __class__ is no longer in the class methods namespace.

Modified Paths:
--------------
    trunk/blender/release/scripts/modules/bpy/ops.py
    trunk/blender/release/scripts/startup/bl_operators/presets.py
    trunk/blender/release/scripts/startup/bl_ui/space_userpref.py
    trunk/blender/release/scripts/startup/bl_ui/space_userpref_keymap.py
    trunk/blender/release/scripts/startup/bl_ui/space_view3d.py
    trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py

Modified: trunk/blender/release/scripts/modules/bpy/ops.py
===================================================================
--- trunk/blender/release/scripts/modules/bpy/ops.py	2011-07-10 23:49:59 UTC (rev 38293)
+++ trunk/blender/release/scripts/modules/bpy/ops.py	2011-07-11 05:50:49 UTC (rev 38294)
@@ -29,7 +29,7 @@
 op_get_rna = ops_module.get_rna
 
 
-class bpy_ops(object):
+class BPyOps(object):
     '''
     Fake module like class.
 
@@ -42,7 +42,7 @@
         '''
         if module.startswith('__'):
             raise AttributeError(module)
-        return bpy_ops_submodule(module)
+        return BPyOpsSubMod(module)
 
     def __dir__(self):
 
@@ -67,7 +67,7 @@
         return "<module like class 'bpy.ops'>"
 
 
-class bpy_ops_submodule(object):
+class BPyOpsSubMod(object):
     '''
     Utility class to fake submodules.
 
@@ -84,7 +84,7 @@
         '''
         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 @@
         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 @@
         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 @@
         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 @@
         return "<function bpy.ops.%s.%s at 0x%x'>" % \
                 (self.module, self.func, id(self))
 
-ops_fake_module = bpy_ops()
+ops_fake_module = BPyOps()

Modified: trunk/blender/release/scripts/startup/bl_operators/presets.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_operators/presets.py	2011-07-10 23:49:59 UTC (rev 38293)
+++ trunk/blender/release/scripts/startup/bl_operators/presets.py	2011-07-11 05:50:49 UTC (rev 38294)
@@ -315,7 +315,7 @@
 
     @property
     def preset_subdir(self):
-        return __class__.operator_path(self.operator)
+        return AddPresetOperator.operator_path(self.operator)
 
     @property
     def preset_values(self):

Modified: trunk/blender/release/scripts/startup/bl_ui/space_userpref.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_userpref.py	2011-07-10 23:49:59 UTC (rev 38293)
+++ trunk/blender/release/scripts/startup/bl_ui/space_userpref.py	2011-07-11 05:50:49 UTC (rev 38294)
@@ -986,7 +986,7 @@
                         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 @@
 
             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 @@
             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 @@
         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 @@
     # 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):

Modified: trunk/blender/release/scripts/startup/bl_ui/space_userpref_keymap.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_userpref_keymap.py	2011-07-10 23:49:59 UTC (rev 38293)
+++ trunk/blender/release/scripts/startup/bl_ui/space_userpref_keymap.py	2011-07-11 05:50:49 UTC (rev 38294)
@@ -234,7 +234,7 @@
         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 @@
             # 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:

Modified: trunk/blender/release/scripts/startup/bl_ui/space_view3d.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_view3d.py	2011-07-10 23:49:59 UTC (rev 38293)
+++ trunk/blender/release/scripts/startup/bl_ui/space_view3d.py	2011-07-11 05:50:49 UTC (rev 38294)
@@ -2410,7 +2410,7 @@
 
     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

Modified: trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py
===================================================================
--- trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py	2011-07-10 23:49:59 UTC (rev 38293)
+++ trunk/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py	2011-07-11 05:50:49 UTC (rev 38294)
@@ -465,7 +465,7 @@
     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 @@
     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 @@
     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 @@
     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 @@
     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




More information about the Bf-blender-cvs mailing list