[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [38869] trunk/blender: py api: sphinx doc corrections, pep8 cleanup and style edits, also added __all__ to some modules which were missing it.

Campbell Barton ideasman42 at gmail.com
Sun Jul 31 05:15:39 CEST 2011


Revision: 38869
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38869
Author:   campbellbarton
Date:     2011-07-31 03:15:37 +0000 (Sun, 31 Jul 2011)
Log Message:
-----------
py api: sphinx doc corrections, pep8 cleanup and style edits, also added __all__ to some modules which were missing it.

Modified Paths:
--------------
    trunk/blender/build_files/cmake/cmake_consistency_check.py
    trunk/blender/build_files/cmake/cmake_netbeans_project.py
    trunk/blender/build_files/cmake/cmake_qtcreator_project.py
    trunk/blender/doc/python_api/rst/bge.constraints.rst
    trunk/blender/doc/python_api/rst/bge.events.rst
    trunk/blender/doc/python_api/rst/bge.logic.rst
    trunk/blender/doc/python_api/rst/bge.render.rst
    trunk/blender/doc/python_api/rst/bge.texture.rst
    trunk/blender/doc/python_api/rst/bge.types.rst
    trunk/blender/doc/python_api/rst/bgl.rst
    trunk/blender/doc/python_api/sphinx_doc_gen.py
    trunk/blender/release/scripts/modules/addon_utils.py
    trunk/blender/release/scripts/modules/bpy/__init__.py
    trunk/blender/release/scripts/modules/bpy/path.py
    trunk/blender/release/scripts/modules/bpy/utils.py
    trunk/blender/release/scripts/modules/bpy_extras/__init__.py
    trunk/blender/release/scripts/modules/bpy_extras/image_utils.py
    trunk/blender/release/scripts/modules/bpy_extras/io_utils.py
    trunk/blender/release/scripts/modules/bpy_extras/mesh_utils.py
    trunk/blender/release/scripts/modules/bpy_extras/object_utils.py
    trunk/blender/release/scripts/modules/bpy_extras/view3d_utils.py
    trunk/blender/release/scripts/modules/keyingsets_utils.py
    trunk/blender/source/blender/python/intern/bpy_rna.c

Modified: trunk/blender/build_files/cmake/cmake_consistency_check.py
===================================================================
--- trunk/blender/build_files/cmake/cmake_consistency_check.py	2011-07-31 03:06:00 UTC (rev 38868)
+++ trunk/blender/build_files/cmake/cmake_consistency_check.py	2011-07-31 03:15:37 UTC (rev 38869)
@@ -39,7 +39,7 @@
     file_handle = open(f, 'r')
     data = file_handle.readlines()
     file_handle.close()
-    
+
     l = data[i]
     ws = l[:len(l) - len(l.lstrip())]
 

Modified: trunk/blender/build_files/cmake/cmake_netbeans_project.py
===================================================================
--- trunk/blender/build_files/cmake/cmake_netbeans_project.py	2011-07-31 03:06:00 UTC (rev 38868)
+++ trunk/blender/build_files/cmake/cmake_netbeans_project.py	2011-07-31 03:15:37 UTC (rev 38869)
@@ -37,7 +37,7 @@
                           source_list,
                           is_project_file,
                           is_c_header,
-                          is_py,
+                          # is_py,
                           cmake_advanced_info,
                           cmake_compiler_defines,
                           )

Modified: trunk/blender/build_files/cmake/cmake_qtcreator_project.py
===================================================================
--- trunk/blender/build_files/cmake/cmake_qtcreator_project.py	2011-07-31 03:06:00 UTC (rev 38868)
+++ trunk/blender/build_files/cmake/cmake_qtcreator_project.py	2011-07-31 03:15:37 UTC (rev 38869)
@@ -33,7 +33,7 @@
 
 from project_info import (SIMPLE_PROJECTFILE,
                           SOURCE_DIR,
-                          CMAKE_DIR,
+                          # CMAKE_DIR,
                           PROJECT_DIR,
                           source_list,
                           is_project_file,

Modified: trunk/blender/doc/python_api/rst/bge.constraints.rst
===================================================================
--- trunk/blender/doc/python_api/rst/bge.constraints.rst	2011-07-31 03:06:00 UTC (rev 38868)
+++ trunk/blender/doc/python_api/rst/bge.constraints.rst	2011-07-31 03:15:37 UTC (rev 38869)
@@ -1,6 +1,6 @@
 
 Physics Constraints (bge.constraints)
-==================================
+=====================================
 
 .. function:: createConstraint(physicsid, physicsid2, constrainttype, [pivotX, pivotY, pivotZ, [axisX, axisY, axisZ, [flag]]]])
 

Modified: trunk/blender/doc/python_api/rst/bge.events.rst
===================================================================
--- trunk/blender/doc/python_api/rst/bge.events.rst	2011-07-31 03:06:00 UTC (rev 38868)
+++ trunk/blender/doc/python_api/rst/bge.events.rst	2011-07-31 03:15:37 UTC (rev 38869)
@@ -1,6 +1,6 @@
 
 Game Keys (bge.events)
-=============================
+======================
 
 *****
 Intro

Modified: trunk/blender/doc/python_api/rst/bge.logic.rst
===================================================================
--- trunk/blender/doc/python_api/rst/bge.logic.rst	2011-07-31 03:06:00 UTC (rev 38868)
+++ trunk/blender/doc/python_api/rst/bge.logic.rst	2011-07-31 03:15:37 UTC (rev 38869)
@@ -1,6 +1,7 @@
 
 Game Logic (bge.logic)
-============================
+======================
+
 *****
 Intro
 *****

Modified: trunk/blender/doc/python_api/rst/bge.render.rst
===================================================================
--- trunk/blender/doc/python_api/rst/bge.render.rst	2011-07-31 03:06:00 UTC (rev 38868)
+++ trunk/blender/doc/python_api/rst/bge.render.rst	2011-07-31 03:15:37 UTC (rev 38869)
@@ -1,6 +1,6 @@
 
 Rasterizer (bge.render)
-=============================
+=======================
 
 *****
 Intro
@@ -16,8 +16,8 @@
    import bge.render
    import bge.logic
 
-   # SCALE sets the speed of motion
-   SCALE=[1, 0.5]
+   # scale sets the speed of motion
+   scale = 1.0, 0.5
    
    co = bge.logic.getCurrentController()
    obj = co.getOwner()
@@ -27,8 +27,8 @@
    
    # Transform the mouse coordinates to see how far the mouse has moved.
    def mousePos():
-      x = (bge.render.getWindowWidth()/2 - mouse.getXPosition())*SCALE[0]
-      y = (bge.render.getWindowHeight()/2 - mouse.getYPosition())*SCALE[1]
+      x = (bge.render.getWindowWidth() / 2 - mouse.getXPosition()) * scale[0]
+      y = (bge.render.getWindowHeight() / 2 - mouse.getYPosition()) * scale[1]
       return (x, y)
    
    pos = mousePos()
@@ -43,7 +43,7 @@
    bge.logic.addActiveActuator(wmotion, True)
    
    # Centre the mouse
-   bge.render.setMousePosition(bge.render.getWindowWidth()/2, bge.render.getWindowHeight()/2)
+   bge.render.setMousePosition(bge.render.getWindowWidth() / 2, bge.render.getWindowHeight() / 2)
 
 *********
 Constants

Modified: trunk/blender/doc/python_api/rst/bge.texture.rst
===================================================================
--- trunk/blender/doc/python_api/rst/bge.texture.rst	2011-07-31 03:06:00 UTC (rev 38868)
+++ trunk/blender/doc/python_api/rst/bge.texture.rst	2011-07-31 03:15:37 UTC (rev 38869)
@@ -1,6 +1,6 @@
 
 Video Texture (bge.texture)
-==============================
+===========================
 
 *****
 Intro

Modified: trunk/blender/doc/python_api/rst/bge.types.rst
===================================================================
--- trunk/blender/doc/python_api/rst/bge.types.rst	2011-07-31 03:06:00 UTC (rev 38868)
+++ trunk/blender/doc/python_api/rst/bge.types.rst	2011-07-31 03:15:37 UTC (rev 38869)
@@ -1,6 +1,6 @@
 
 Game Types (bge.types)
-=============================
+======================
 
 .. module:: bge.types
 

Modified: trunk/blender/doc/python_api/rst/bgl.rst
===================================================================
--- trunk/blender/doc/python_api/rst/bgl.rst	2011-07-31 03:06:00 UTC (rev 38868)
+++ trunk/blender/doc/python_api/rst/bgl.rst	2011-07-31 03:15:37 UTC (rev 38869)
@@ -1,6 +1,6 @@
 
 OpenGL Wrapper (bgl)
-===========================
+====================
 
 .. module:: bgl
 
@@ -71,8 +71,8 @@
    .. seealso:: `OpenGL Docs <http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/begin.html>`_
 
    :type mode: Enumerated constant
-   :arg mode: Specifies the primitive that will be create from vertices between glBegin and
-      glEnd.
+   :arg mode: Specifies the primitive that will be create from vertices between
+      glBegin and glEnd.
 
 
 .. function:: glBindTexture(target, texture):
@@ -1886,4 +1886,3 @@
          the Buffer. If a template is not passed in all fields will be initialized to 0.
       :rtype: Buffer object
       :return: The newly created buffer as a PyObject.
-

Modified: trunk/blender/doc/python_api/sphinx_doc_gen.py
===================================================================
--- trunk/blender/doc/python_api/sphinx_doc_gen.py	2011-07-31 03:06:00 UTC (rev 38868)
+++ trunk/blender/doc/python_api/sphinx_doc_gen.py	2011-07-31 03:15:37 UTC (rev 38869)
@@ -416,6 +416,7 @@
     del key, descr
 
     classes = []
+    submodules = []
 
     for attribute in module_dir:
         if not attribute.startswith("_"):
@@ -437,6 +438,8 @@
                 py_c_func2sphinx("", fw, module_name, None, attribute, value, is_class=False)
             elif value_type == type:
                 classes.append((attribute, value))
+            elif issubclass(value_type, types.ModuleType):
+                submodules.append((attribute, value))
             elif value_type in (bool, int, float, str, tuple):
                 # constant, not much fun we can do here except to list it.
                 # TODO, figure out some way to document these!
@@ -444,12 +447,26 @@
                 write_indented_lines("   ", fw, "constant value %s" % repr(value), False)
                 fw("\n")
             else:
-                print("\tnot documenting %s.%s" % (module_name, attribute))
+                print("\tnot documenting %s.%s of %r type" % (module_name, attribute, value_type.__name__))
                 continue
 
             attribute_set.add(attribute)
             # TODO, more types...
 
+    # TODO, bpy_extras does this already, mathutils not.
+    """
+    if submodules:
+        fw("\n"
+           "**********\n"
+           "Submodules\n"
+           "**********\n"
+           "\n"
+           )
+        for attribute, submod in submodules:
+            fw("* :mod:`%s.%s`\n" % (module_name, attribute))
+        fw("\n")
+    """
+
     # write collected classes now
     for (type_name, value) in classes:
         # May need to be its own function

Modified: trunk/blender/release/scripts/modules/addon_utils.py
===================================================================
--- trunk/blender/release/scripts/modules/addon_utils.py	2011-07-31 03:06:00 UTC (rev 38868)
+++ trunk/blender/release/scripts/modules/addon_utils.py	2011-07-31 03:15:37 UTC (rev 38869)
@@ -16,7 +16,7 @@
 #
 # ##### END GPL LICENSE BLOCK #####
 
-# <pep8 compliant>
+# <pep8-80 compliant>
 
 __all__ = (
     "paths",
@@ -26,7 +26,7 @@
     "disable",
     "reset_all",
     "module_bl_info",
-)
+    )
 
 import bpy as _bpy
 
@@ -129,7 +129,12 @@
                     error_duplicates = True
 
                 elif mod.__time__ != os.path.getmtime(mod_path):
-                    print("reloading addon:", mod_name, mod.__time__, os.path.getmtime(mod_path), mod_path)
+                    print("reloading addon:",
+                          mod_name,
+                          mod.__time__,
+                          os.path.getmtime(mod_path),
+                          mod_path,
+                          )
                     del module_cache[mod_name]
                     mod = None
 
@@ -144,7 +149,9 @@
     del modules_stale
 
     mod_list = list(module_cache.values())
-    mod_list.sort(key=lambda mod: (mod.bl_info['category'], mod.bl_info['name']))
+    mod_list.sort(key=lambda mod: (mod.bl_info['category'],
+                                   mod.bl_info['name'],
+                                   ))
     return mod_list
 
 
@@ -164,8 +171,9 @@
     loaded_state = mod and getattr(mod, "__addon_enabled__", Ellipsis)
 
     if loaded_state is Ellipsis:
-        print("Warning: addon-module %r found module but without"
-               " __addon_enabled__ field, possible name collision from file: %r" %
+        print("Warning: addon-module %r found module "
+               "but without __addon_enabled__ field, "
+               "possible name collision from file: %r" %
                (module_name, getattr(mod, "__file__", "<unknown>")))
 
         loaded_state = False

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list