[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29754] trunk/blender/source/blender/ python/doc/sphinx_doc_gen.py: == python api docs ==
Luca Bonavita
mindrones at gmail.com
Mon Jun 28 02:06:23 CEST 2010
Revision: 29754
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29754
Author: mindrones
Date: 2010-06-28 02:06:23 +0200 (Mon, 28 Jun 2010)
Log Message:
-----------
== 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
Modified Paths:
--------------
trunk/blender/source/blender/python/doc/sphinx_doc_gen.py
Modified: trunk/blender/source/blender/python/doc/sphinx_doc_gen.py
===================================================================
--- trunk/blender/source/blender/python/doc/sphinx_doc_gen.py 2010-06-27 23:57:58 UTC (rev 29753)
+++ trunk/blender/source/blender/python/doc/sphinx_doc_gen.py 2010-06-28 00:06:23 UTC (rev 29754)
@@ -178,7 +178,11 @@
'''
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 @@
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 @@
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
More information about the Bf-blender-cvs
mailing list