diff options
author | Luca Bonavita <mindrones@gmail.com> | 2010-06-28 04:06:23 +0400 |
---|---|---|
committer | Luca Bonavita <mindrones@gmail.com> | 2010-06-28 04:06:23 +0400 |
commit | 1a6b9ea5d94716f376e6dcd0b77d140f41a12801 (patch) | |
tree | 1cbde4e13acc9183ee32ecc8950a4b320ed0e83b /source/blender/python/doc/sphinx_doc_gen.py | |
parent | a52632182c9d50d177abe56a037d7a76ed5d1003 (diff) |
== python api docs ==
- properties are now listed on alphabetical order
- readonly properties use "data" directive, so that we see them in green in the web docs
example (after Campbell will rebuild the docs):
http://www.blender.org/documentation/250PythonDoc/bpy.types.RenderLayer.html
(note that green attributes still need final CSS-ing, but smerch is a bit busy atm)
- fixed indentation in http://www.blender.org/documentation/250PythonDoc/bpy.data.html
Diffstat (limited to 'source/blender/python/doc/sphinx_doc_gen.py')
-rw-r--r-- | source/blender/python/doc/sphinx_doc_gen.py | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/source/blender/python/doc/sphinx_doc_gen.py b/source/blender/python/doc/sphinx_doc_gen.py index 195a91e7539..27524c66c36 100644 --- a/source/blender/python/doc/sphinx_doc_gen.py +++ b/source/blender/python/doc/sphinx_doc_gen.py @@ -178,7 +178,11 @@ def pyprop2sphinx(ident, fw, identifier, py_prop): ''' python property to sphinx ''' - fw(ident + ".. attribute:: %s\n\n" % identifier) + # readonly properties use "data" directive, variables use "attribute" directive + if py_prop.fset is None: + fw(ident + ".. data:: %s\n\n" % identifier) + else: + fw(ident + ".. attribute:: %s\n\n" % identifier) write_indented_lines(ident + " ", fw, py_prop.__doc__) if py_prop.fset is None: fw(ident + " (readonly)\n\n") @@ -420,9 +424,9 @@ def rna2sphinx(BASEPATH): fw("\n") fw("This module is used for all blender/python access.\n") fw("\n") - fw(" .. literalinclude:: ../examples/bpy.data.py\n") + fw(".. literalinclude:: ../examples/bpy.data.py\n") fw("\n") - fw(" .. data:: data\n") + fw(".. data:: data\n") fw("\n") fw(" Access to blenders internal data\n") fw("\n") @@ -547,12 +551,21 @@ def rna2sphinx(BASEPATH): fw(".. class:: %s\n\n" % struct.identifier) fw(" %s\n\n" % struct.description) - - for prop in struct.properties: - fw(" .. attribute:: %s\n\n" % prop.identifier) + + # properties sorted in alphabetical order + zip_props_ids = zip(struct.properties, [prop.identifier for prop in struct.properties]) + zip_props_ids = sorted(zip_props_ids, key=lambda p: p[1]) + sorted_struct_properties = [x[0] for x in zip_props_ids] + + for prop in sorted_struct_properties: + type_descr = prop.get_type_description(class_fmt=":class:`%s`") + # readonly properties use "data" directive, variables properties use "attribute" directive + if 'readonly' in type_descr: + fw(" .. data:: %s\n\n" % prop.identifier) + else: + fw(" .. attribute:: %s\n\n" % prop.identifier) if prop.description: fw(" %s\n\n" % prop.description) - type_descr = prop.get_type_description(class_fmt=":class:`%s`") fw(" :type: %s\n\n" % type_descr) # python attributes |