Changeset View
Changeset View
Standalone View
Standalone View
doc/python_api/sphinx_doc_gen.py
| Context not available. | |||||
| doc = undocumented_message(module_name, type_name, identifier) | doc = undocumented_message(module_name, type_name, identifier) | ||||
| if type(descr) == GetSetDescriptorType: | if type(descr) == GetSetDescriptorType: | ||||
| fw(ident + ".. attribute:: %s\n\n" % identifier) | fw(ident + ".. attribute:: %s\n" % identifier) | ||||
| fw(ident + " :noindex:\n\n") | |||||
| write_indented_lines(ident + " ", fw, doc, False) | write_indented_lines(ident + " ", fw, doc, False) | ||||
| fw("\n") | fw("\n") | ||||
| elif type(descr) == MemberDescriptorType: # same as above but use 'data' | elif type(descr) == MemberDescriptorType: # same as above but use 'data' | ||||
| fw(ident + ".. data:: %s\n\n" % identifier) | fw(ident + ".. data:: %s\n" % identifier) | ||||
| fw(ident + " :noindex:\n\n") | |||||
| write_indented_lines(ident + " ", fw, doc, False) | write_indented_lines(ident + " ", fw, doc, False) | ||||
| fw("\n") | fw("\n") | ||||
| elif type(descr) in {MethodDescriptorType, ClassMethodDescriptorType}: | elif type(descr) in {MethodDescriptorType, ClassMethodDescriptorType}: | ||||
| Context not available. | |||||
| ''' | ''' | ||||
| # readonly properties use "data" directive, variables use "attribute" directive | # readonly properties use "data" directive, variables use "attribute" directive | ||||
| if py_prop.fset is None: | if py_prop.fset is None: | ||||
| fw(ident + ".. data:: %s\n\n" % identifier) | fw(ident + ".. data:: %s\n" % identifier) | ||||
| fw(ident + " :noindex:\n\n") | |||||
| else: | else: | ||||
| fw(ident + ".. attribute:: %s\n\n" % identifier) | fw(ident + ".. attribute:: %s\n" % identifier) | ||||
| fw(ident + " :noindex:\n\n") | |||||
| write_indented_lines(ident + " ", fw, py_prop.__doc__) | write_indented_lines(ident + " ", fw, py_prop.__doc__) | ||||
| if py_prop.fset is None: | if py_prop.fset is None: | ||||
| fw(ident + " (readonly)\n\n") | fw(ident + " (readonly)\n\n") | ||||
| Context not available. | |||||
| elif issubclass(value_type, (bool, int, float, str, tuple)): | elif issubclass(value_type, (bool, int, float, str, tuple)): | ||||
| # constant, not much fun we can do here except to list it. | # constant, not much fun we can do here except to list it. | ||||
| # TODO, figure out some way to document these! | # TODO, figure out some way to document these! | ||||
| fw(".. data:: %s\n\n" % attribute) | fw(".. data:: %s\n :noindex:\n\n" % attribute) | ||||
| write_indented_lines(" ", fw, "constant value %s" % repr(value), False) | write_indented_lines(" ", fw, "constant value %s" % repr(value), False) | ||||
| fw("\n") | fw("\n") | ||||
| else: | else: | ||||
| Context not available. | |||||
| type_descr = prop.get_type_description( | type_descr = prop.get_type_description( | ||||
| class_fmt=":class:`bpy.types.%s`", collection_id=_BPY_PROP_COLLECTION_ID) | class_fmt=":class:`bpy.types.%s`", collection_id=_BPY_PROP_COLLECTION_ID) | ||||
| fw(".. data:: %s\n\n" % prop.identifier) | fw(".. data:: %s\n :noindex:\n\n" % prop.identifier) | ||||
| if prop.description: | if prop.description: | ||||
| fw(" %s\n\n" % prop.description) | fw(" %s\n\n" % prop.description) | ||||
| Context not available. | |||||
| i = 0 | i = 0 | ||||
| while char_array[i] is not None: | while char_array[i] is not None: | ||||
| member = ctypes.string_at(char_array[i]).decode(encoding="ascii") | member = ctypes.string_at(char_array[i]).decode(encoding="ascii") | ||||
| fw(".. data:: %s\n\n" % member) | fw(".. data:: %s\n :noindex:\n\n" % member) | ||||
| member_type, is_seq = context_type_map[member] | member_type, is_seq = context_type_map[member] | ||||
| fw(" :type: %s :class:`bpy.types.%s`\n\n" % ("sequence of " if is_seq else "", member_type)) | fw(" :type: %s :class:`bpy.types.%s`\n\n" % ("sequence of " if is_seq else "", member_type)) | ||||
| unique.add(member) | unique.add(member) | ||||
| Context not available. | |||||
| fw(title_string(title, "=")) | fw(title_string(title, "=")) | ||||
| fw(".. module:: %s\n\n" % struct_module_name) | fw(".. module:: %s.%s\n\n" % (struct_module_name, struct_id)) | ||||
| # docs first?, ok | # docs first?, ok | ||||
| write_example_ref("", fw, "%s.%s" % (struct_module_name, struct_id)) | write_example_ref("", fw, "%s.%s" % (struct_module_name, struct_id)) | ||||
| Context not available. | |||||
| type_descr = prop.get_type_description(class_fmt=":class:`%s`", collection_id=_BPY_PROP_COLLECTION_ID) | type_descr = prop.get_type_description(class_fmt=":class:`%s`", collection_id=_BPY_PROP_COLLECTION_ID) | ||||
| # readonly properties use "data" directive, variables properties use "attribute" directive | # readonly properties use "data" directive, variables properties use "attribute" directive | ||||
| if 'readonly' in type_descr: | if 'readonly' in type_descr: | ||||
| fw(" .. data:: %s\n\n" % prop.identifier) | fw(" .. data:: %s\n :noindex:\n\n" % prop.identifier) | ||||
| else: | else: | ||||
| fw(" .. attribute:: %s\n\n" % prop.identifier) | fw(" .. attribute:: %s\n :noindex:\n\n" % prop.identifier) | ||||
| if prop.description: | if prop.description: | ||||
| fw(" %s\n\n" % prop.description) | fw(" %s\n\n" % prop.description) | ||||
| Context not available. | |||||
| fw(title_string(class_name, "=")) | fw(title_string(class_name, "=")) | ||||
| fw(".. module:: %s\n" % class_module_name) | fw(".. module:: %s.%s\n" % (class_module_name, class_name)) | ||||
| fw("\n") | fw("\n") | ||||
| if use_subclasses: | if use_subclasses: | ||||
| Context not available. | |||||