summaryrefslogtreecommitdiff
path: root/giscanner/doctemplates/Python
diff options
context:
space:
mode:
authorMark Doffman <mark.doffman@codethink.co.uk>2014-03-27 20:50:21 +0000
committerMark Doffman <mark.doffman@codethink.co.uk>2014-03-27 20:50:21 +0000
commit68ff94340891f1ae4ea24546acdbbc39c4dcbcd0 (patch)
tree46f02cba671bcb321482c7961acd91aeee57ced5 /giscanner/doctemplates/Python
parent19da3f81593614198206c45527f973a22cdd621e (diff)
parent89e84d06dffbc732bac26a105244b7270c42e3ec (diff)
downloadgobject-introspection-baserock/markdoffman/1_39_90-merge.tar.gz
Merge tag 'GOBJECT_INTROSPECTION_1_39_90' into baserock/markdoffman/1_39_90-mergebaserock/markdoffman/1_39_90-merge
Tag 1_39_90 Conflicts: autogen.sh configure.ac
Diffstat (limited to 'giscanner/doctemplates/Python')
-rw-r--r--giscanner/doctemplates/Python/class.tmpl17
-rw-r--r--giscanner/doctemplates/Python/constructor.tmpl1
-rw-r--r--giscanner/doctemplates/Python/default.tmpl1
-rw-r--r--giscanner/doctemplates/Python/enum.tmpl13
-rw-r--r--giscanner/doctemplates/Python/function.tmpl53
-rw-r--r--giscanner/doctemplates/Python/method.tmpl1
-rw-r--r--giscanner/doctemplates/Python/namespace.tmpl2
-rw-r--r--giscanner/doctemplates/Python/property.tmpl10
-rw-r--r--giscanner/doctemplates/Python/record.tmpl2
-rw-r--r--giscanner/doctemplates/Python/signal.tmpl42
-rw-r--r--giscanner/doctemplates/Python/vfunc.tmpl33
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>