else:
return parameter.argname
+ def format_fundamental_type(self, name):
+ fundamental_types = {
+ "utf8": "unicode",
+ "gunichar": "unicode",
+ "gchar": "str",
+ "guchar": "str",
+ "gboolean": "bool",
+ "gint": "int",
+ "guint": "int",
+ "glong": "int",
+ "gulong": "int",
+ "gint64": "int",
+ "guint64": "int",
+ "gfloat": "float",
+ "gdouble": "float",
+ "gchararray": "str",
+ "GParam": "GLib.Param",
+ "PyObject": "object",
+ "GStrv": "[str]",
+ "GVariant": "GLib.Variant",
+ }
+
+ return fundamental_types.get(name, name)
+
def format_type(self, type_):
if isinstance(type_, ast.Array):
return '[' + self.format_type(type_.element_type) + ']'
elif type_.target_giname is not None:
return type_.target_giname
else:
- return type_.target_fundamental
+ return self.format_fundamental_type(type_.target_fundamental)
def format_function_name(self, func):
if func.parent is not None:
</info>
<title>DocExamples.Obj:property-example</title>
<synopsis><code mime="text/x-python">
-"property-example" {utf8: gint8} : Read / Write
+"property-example" {unicode: gint8} : Read / Write
</code></synopsis>
<p>This is an example of how to document a property.</p>
</page>
</info>
<title>DocExamples.Obj.vfunc</title>
<synopsis><code mime="text/x-python">
-@accepts(gint)
+@accepts(int)
@returns(none)
def do_vfunc(self, first_arg):
</code></synopsis>
<link type="guide" xref="DocExamples.Obj" group="method"/>
<api:function>
<api:returns>
- <api:type>gboolean</api:type>
+ <api:type>bool</api:type>
</api:returns>
<api:name>doc_examples_obj_method</api:name>
<api:arg>
<api:name>self</api:name>
</api:arg>
<api:arg>
- <api:type>gint</api:type>
+ <api:type>int</api:type>
<api:name>first_arg</api:name>
</api:arg>
<api:arg>
- <api:type>gfloat</api:type>
+ <api:type>float</api:type>
<api:name>second_arg</api:name>
</api:arg>
<api:arg>
- <api:type>gboolean</api:type>
+ <api:type>bool</api:type>
<api:name>boolean_arg</api:name>
</api:arg>
<api:arg>
<api:name>pointer_arg</api:name>
</api:arg>
<api:arg>
- <api:type>utf8</api:type>
+ <api:type>unicode</api:type>
<api:name>string</api:name>
</api:arg>
</api:function>
</info>
<title>method</title>
<synopsis><code mime="text/x-python">
-@accepts(gint, gfloat, gboolean, gpointer, utf8)
-@returns(gboolean)
+@accepts(int, float, bool, gpointer, unicode)
+@returns(bool)
def method(self, first_arg, second_arg, boolean_arg, pointer_arg, string):
# Python wrapper for doc_examples_obj_method()
</code></synopsis>
<link type="guide" xref="DocExamples.Obj" group="function"/>
<api:function>
<api:returns>
- <api:type>gboolean</api:type>
+ <api:type>bool</api:type>
</api:returns>
<api:name>doc_examples_obj_static_method</api:name>
<api:arg>
- <api:type>gint</api:type>
+ <api:type>int</api:type>
<api:name>out_arg</api:name>
</api:arg>
</api:function>
</info>
<title>static_method</title>
<synopsis><code mime="text/x-python">
-@accepts(gint)
-@returns(gboolean)
+@accepts(int)
+@returns(bool)
def static_method(out_arg):
# Python wrapper for doc_examples_obj_static_method()
</code></synopsis>
<link type="guide" xref="index" group="function"/>
<api:function>
<api:returns>
- <api:type>[gint]</api:type>
+ <api:type>[int]</api:type>
</api:returns>
<api:name>doc_examples_array_function</api:name>
<api:arg>
- <api:type>gint</api:type>
+ <api:type>int</api:type>
<api:name>out_len</api:name>
</api:arg>
</api:function>
</info>
<title>array_function</title>
<synopsis><code mime="text/x-python">
-@accepts(gint)
-@returns([gint])
+@accepts(int)
+@returns([int])
def array_function(out_len):
# Python wrapper for doc_examples_array_function()
</code></synopsis>