diff options
author | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2013-09-04 16:13:21 +0000 |
---|---|---|
committer | Lars Wirzenius <lars.wirzenius@codethink.co.uk> | 2013-09-04 16:13:21 +0000 |
commit | a194122be492fbddd8748fe323a648434a866c36 (patch) | |
tree | f39293588b7922faa40f0c6b985a031f8f5cf0ae /giscanner/doctemplates/Python | |
parent | 8a2a9f9db169eaaf2a7eede18e0ceba0af44345f (diff) | |
parent | 85d02d59f101f9eb37829b16a81890ef9801824a (diff) | |
download | gobject-introspection-baserock/jonathan/fix-giscanner.tar.gz |
merge with GOBJECT_INTROSPECTION_1_37_6baserock/jonathan/fix-giscanner
Diffstat (limited to 'giscanner/doctemplates/Python')
-rw-r--r-- | giscanner/doctemplates/Python/class.tmpl | 17 | ||||
-rw-r--r-- | giscanner/doctemplates/Python/constructor.tmpl | 1 | ||||
-rw-r--r-- | giscanner/doctemplates/Python/default.tmpl | 1 | ||||
-rw-r--r-- | giscanner/doctemplates/Python/enum.tmpl | 13 | ||||
-rw-r--r-- | giscanner/doctemplates/Python/function.tmpl | 53 | ||||
-rw-r--r-- | giscanner/doctemplates/Python/method.tmpl | 1 | ||||
-rw-r--r-- | giscanner/doctemplates/Python/namespace.tmpl | 2 | ||||
-rw-r--r-- | giscanner/doctemplates/Python/property.tmpl | 10 | ||||
-rw-r--r-- | giscanner/doctemplates/Python/record.tmpl | 2 | ||||
-rw-r--r-- | giscanner/doctemplates/Python/signal.tmpl | 42 | ||||
-rw-r--r-- | giscanner/doctemplates/Python/vfunc.tmpl | 33 |
11 files changed, 175 insertions, 0 deletions
diff --git a/giscanner/doctemplates/Python/class.tmpl b/giscanner/doctemplates/Python/class.tmpl new file mode 100644 index 00000000..435b31a5 --- /dev/null +++ b/giscanner/doctemplates/Python/class.tmpl @@ -0,0 +1,17 @@ +<%inherit file="/class.tmpl"/> +<%block name="synopsis"> + <synopsis><code> +from gi.repository import ${namespace.name} + +${formatter.to_underscores(node.name).lower()} = ${namespace.name}.${node.name}(\ +% for ix, property_ in enumerate(node.properties): +% if property_.construct or property_.construct_only or property_.writable: +<link xref='${namespace.name}.${node.name}-${property_.name}'>${property_.name.replace('-', '_')}</link>=value\ +% if ix != len(node.properties) - 1: +, \ +% endif +% endif +% endfor +)\ + </code></synopsis> +</%block> diff --git a/giscanner/doctemplates/Python/constructor.tmpl b/giscanner/doctemplates/Python/constructor.tmpl new file mode 100644 index 00000000..a03d2825 --- /dev/null +++ b/giscanner/doctemplates/Python/constructor.tmpl @@ -0,0 +1 @@ +<%inherit file="./function.tmpl"/> diff --git a/giscanner/doctemplates/Python/default.tmpl b/giscanner/doctemplates/Python/default.tmpl new file mode 100644 index 00000000..b66ae926 --- /dev/null +++ b/giscanner/doctemplates/Python/default.tmpl @@ -0,0 +1 @@ +<%inherit file="/base.tmpl"/> diff --git a/giscanner/doctemplates/Python/enum.tmpl b/giscanner/doctemplates/Python/enum.tmpl new file mode 100644 index 00000000..35cdd439 --- /dev/null +++ b/giscanner/doctemplates/Python/enum.tmpl @@ -0,0 +1,13 @@ +<%inherit file="/base.tmpl"/> +<%block name="details"> +% if node.members: +<terms> +% for member in node.members: +<item> +<title><code>${node.name}.${member.name.upper()}</code></title> +${formatter.format(node, member.doc)} +</item> +% endfor +</terms> +% endif +</%block> diff --git a/giscanner/doctemplates/Python/function.tmpl b/giscanner/doctemplates/Python/function.tmpl new file mode 100644 index 00000000..072a1185 --- /dev/null +++ b/giscanner/doctemplates/Python/function.tmpl @@ -0,0 +1,53 @@ +<%inherit file="/base.tmpl"/> +<%block name="info"> + ${formatter.format_xref(node.parent, type="guide", group=page_kind)} + <api:function> + <api:returns> + <api:type>${formatter.format_type(node.retval.type) | x}</api:type> + </api:returns> + <api:name>${node.symbol}</api:name> +% for arg in formatter.get_parameters(node): +% if arg.type.ctype == '<varargs>': + <api:varargs/> +% else: + <api:arg> + <api:type>${formatter.format_type(arg.type) | x}</api:type> + <api:name>${formatter.format_parameter_name(node, arg)}</api:name> + </api:arg> +% endif +% endfor + </api:function> +</%block> +<%block name="synopsis"> +<synopsis><code mime="text/x-python"> +% if formatter.get_parameters(node): +@accepts(\ +${', '.join((formatter.format_type(arg.type) for arg in formatter.get_parameters(node)))}\ +) +% endif +@returns(${formatter.format_type(node.retval.type) | x}) +def \ +${node.name}(\ +${', '.join((formatter.format_parameter_name(node, arg) for arg in formatter.get_parameters(node)))}\ +): + # Python wrapper for ${node.symbol}() +</code></synopsis> +</%block> +<%block name="details"> +% if formatter.get_parameters(node) or node.retval: +<terms> +% for ix, arg in enumerate(formatter.get_parameters(node)): +<item> +<title><code>${formatter.format_parameter_name(node, arg)}</code></title> +${formatter.format(node, arg.doc)} +</item> +% endfor +% if node.retval and node.retval.type.ctype != 'void': +<item> +<title><code>Returns</code></title> +{formatter.format(node, node.retval.doc)} +</item> +% endif +</terms> +% endif +</%block> diff --git a/giscanner/doctemplates/Python/method.tmpl b/giscanner/doctemplates/Python/method.tmpl new file mode 100644 index 00000000..a03d2825 --- /dev/null +++ b/giscanner/doctemplates/Python/method.tmpl @@ -0,0 +1 @@ +<%inherit file="./function.tmpl"/> diff --git a/giscanner/doctemplates/Python/namespace.tmpl b/giscanner/doctemplates/Python/namespace.tmpl new file mode 100644 index 00000000..4d80c2a5 --- /dev/null +++ b/giscanner/doctemplates/Python/namespace.tmpl @@ -0,0 +1,2 @@ +<%! page_type="guide" %>\ +<%inherit file="/namespace.tmpl"/> diff --git a/giscanner/doctemplates/Python/property.tmpl b/giscanner/doctemplates/Python/property.tmpl new file mode 100644 index 00000000..3316a00c --- /dev/null +++ b/giscanner/doctemplates/Python/property.tmpl @@ -0,0 +1,10 @@ +<%inherit file="/base.tmpl"/> +<%block name="info"> + ${formatter.format_xref(node.parent, type="guide", group=page_kind)} + <title type="link" role="topic">${node.name}</title> +</%block> +<%block name="synopsis"> +<synopsis><code mime="text/x-python"> +"${node.name}" ${formatter.format_type(node.type)} : ${formatter.format_property_flags(node)} +</code></synopsis> +</%block> diff --git a/giscanner/doctemplates/Python/record.tmpl b/giscanner/doctemplates/Python/record.tmpl new file mode 100644 index 00000000..1523e0df --- /dev/null +++ b/giscanner/doctemplates/Python/record.tmpl @@ -0,0 +1,2 @@ +<%! page_type="guide" %>\ +<%inherit file="/base.tmpl"/> diff --git a/giscanner/doctemplates/Python/signal.tmpl b/giscanner/doctemplates/Python/signal.tmpl new file mode 100644 index 00000000..dc931107 --- /dev/null +++ b/giscanner/doctemplates/Python/signal.tmpl @@ -0,0 +1,42 @@ +<%inherit file="/base.tmpl"/> +<%block name="info"> + ${formatter.format_xref(node.parent, type="guide", group=page_kind)} + <title type="link" role="topic">${node.name}</title> +</%block> +<%block name="synopsis"> +<synopsis><code mime="text/x-python"> +def callback(${formatter.to_underscores(node.parent.name).lower()}, \ +% for arg in formatter.get_parameters(node): +${arg.argname}, \ +% endfor +user_param1, ...) +</code></synopsis> +</%block> +<%block name="details"> +<terms> +<item> +<title><code>${formatter.to_underscores(node.parent.name).lower()}</code></title> +<p>instance of ${formatter.format_xref(node.parent)} that is emitting the signal</p> +</item> +% for arg in formatter.get_parameters(node): +<item> +<title><code>${arg.argname}</code></title> +${formatter.format(node, arg.doc)} +</item> +% endfor +<title><code>user_param1</code></title> +<p>first user parameter (if any) specified with the connect() method</p> +<item> +<title><code>...</code></title> +<p>additional user parameters (if any)</p> +</item> +% if node.retval and \ + node.retval.type.ctype != 'void' and \ + node.retval.type.ctype is not None: +<item> +<title><code>Returns</code></title> +${formatter.format(node, node.retval.doc)} +</item> +% endif +</terms> +</%block> diff --git a/giscanner/doctemplates/Python/vfunc.tmpl b/giscanner/doctemplates/Python/vfunc.tmpl new file mode 100644 index 00000000..98a30932 --- /dev/null +++ b/giscanner/doctemplates/Python/vfunc.tmpl @@ -0,0 +1,33 @@ +<%inherit file="/base.tmpl"/> +<%block name="synopsis"> +<synopsis><code mime="text/x-python"> +% if formatter.get_parameters(node): +@accepts(\ +${', '.join((formatter.format_type(arg.type) for arg in formatter.get_parameters(node)))}\ +) +% endif +@returns(${formatter.format_type(node.retval.type) | x}) +def \ +do_${node.name}(\ +${', '.join((arg.argname for arg in formatter.get_parameters(node)))}\ +): +</code></synopsis> +</%block> +<%block name="details"> +% if formatter.get_parameters(node) or node.retval: +<terms> +% for arg in formatter.get_parameters(node): +<item> +<title><code>${arg.argname}</code></title> +${formatter.format(node, arg.doc)} +</item> +% endfor +% if node.retval and node.retval.type.ctype != 'void': +<item> +<title><code>Returns</code></title> +${formatter.format(node, node.retval.doc)} +</item> +% endif +</terms> +% endif +</%block> |