Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-02-22 08:23:20 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-02-22 08:23:20 +0300
commitdd8383e469369a116c00b479af23028b77827b42 (patch)
treed5e8b9fccb575e5b50f5070ecc77134882bde358 /doc
parenta8f04dfb521ae0578c419691e6e7fc2c83736bce (diff)
make doc generation close files (py3.2 complains about this),
minor formatting changes for C docstrings.
Diffstat (limited to 'doc')
-rw-r--r--doc/python_api/sphinx_doc_gen.py64
1 files changed, 36 insertions, 28 deletions
diff --git a/doc/python_api/sphinx_doc_gen.py b/doc/python_api/sphinx_doc_gen.py
index 4112e24d6e0..8058ebeb137 100644
--- a/doc/python_api/sphinx_doc_gen.py
+++ b/doc/python_api/sphinx_doc_gen.py
@@ -511,6 +511,8 @@ def pycontext2sphinx(BASEPATH):
else:
pass # will have raised an error above
+ file.close()
+
def pyrna2sphinx(BASEPATH):
""" bpy.types and bpy.ops
@@ -731,6 +733,7 @@ def pyrna2sphinx(BASEPATH):
# docs last?, disable for now
# write_example_ref("", fw, "bpy.types.%s" % struct.identifier)
+ file.close()
if "bpy.types" not in EXCLUDE_MODULES:
for struct in structs.values():
@@ -769,46 +772,51 @@ def pyrna2sphinx(BASEPATH):
for key, descr in descr_items:
if type(descr) == GetSetDescriptorType:
py_descr2sphinx(" ", fw, descr, "bpy.types", _BPY_STRUCT_FAKE, key)
+ file.close()
# operators
def write_ops():
API_BASEURL = "https://svn.blender.org/svnroot/bf-blender/trunk/blender/release/scripts"
- fw = None
- last_mod = ''
- for op_key in sorted(ops.keys()):
- op = ops[op_key]
+ op_modules = {}
+ for op in ops.values():
+ op_modules.setdefault(op.module_name, []).append(op)
+ del op
+
+ for op_module_name, ops_mod in op_modules.items():
+ filepath = os.path.join(BASEPATH, "bpy.ops.%s.rst" % op_module_name)
+ file = open(filepath, "w")
+ fw = file.write
+
+ title = "%s Operators" % op_module_name.replace("_", " ").title()
+ fw("%s\n%s\n\n" % (title, "=" * len(title)))
- if last_mod != op.module_name:
- filepath = os.path.join(BASEPATH, "bpy.ops.%s.rst" % op.module_name)
- file = open(filepath, "w")
- fw = file.write
+ fw(".. module:: bpy.ops.%s\n\n" % op_module_name)
- title = "%s Operators" % (op.module_name[0].upper() + op.module_name[1:])
- fw("%s\n%s\n\n" % (title, "=" * len(title)))
+ ops_mod.sort(key=lambda op: op.func_name)
- fw(".. module:: bpy.ops.%s\n\n" % op.module_name)
- last_mod = op.module_name
+ for op in ops_mod:
+ args_str = ", ".join(prop.get_arg_default(force=True) for prop in op.args)
+ fw(".. function:: %s(%s)\n\n" % (op.func_name, args_str))
- args_str = ", ".join(prop.get_arg_default(force=True) for prop in op.args)
- fw(".. function:: %s(%s)\n\n" % (op.func_name, args_str))
+ # if the description isn't valid, we output the standard warning
+ # with a link to the wiki so that people can help
+ if not op.description or op.description == "(undocumented operator)":
+ operator_description = undocumented_message('bpy.ops', op.module_name, op.func_name)
+ else:
+ operator_description = op.description
- # if the description isn't valid, we output the standard warning
- # with a link to the wiki so that people can help
- if not op.description or op.description == "(undocumented operator)":
- operator_description = undocumented_message('bpy.ops', op.module_name, op.func_name)
- else:
- operator_description = op.description
+ fw(" %s\n\n" % operator_description)
+ for prop in op.args:
+ write_param(" ", fw, prop)
+ if op.args:
+ fw("\n")
- fw(" %s\n\n" % operator_description)
- for prop in op.args:
- write_param(" ", fw, prop)
- if op.args:
- fw("\n")
+ location = op.get_location()
+ if location != (None, None):
+ fw(" :file: `%s <%s/%s>`_:%d\n\n" % (location[0], API_BASEURL, location[0], location[1]))
- location = op.get_location()
- if location != (None, None):
- fw(" :file: `%s <%s/%s>`_:%d\n\n" % (location[0], API_BASEURL, location[0], location[1]))
+ file.close()
if "bpy.ops" not in EXCLUDE_MODULES:
write_ops()