1
1
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>gtk.glade.XML</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"><link rel="start" href="index.html" title="PyGTK 2.0 Reference Manual"><link rel="up" href="glade-class-reference.html" title="The gtk.glade Class Reference"><link rel="prev" href="glade-class-reference.html" title="The gtk.glade Class Reference"><link rel="next" href="pango-class-reference.html" title="The pango Class Reference"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">gtk.glade.XML</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="glade-class-reference.html">Prev</a> </td><th width="60%" align="center">The gtk.glade Class Reference</th><td width="20%" align="right"> <a accesskey="n" href="pango-class-reference.html">Next</a></td></tr></table><hr></div><div class="refentry" lang="en"><a name="class-gladexml"></a><div class="titlepage"></div><div class="refnamediv"><h2>gtk.glade.XML</h2><p>gtk.glade.XML — Allows dynamic loading of user interfaces
2
from XML descriptions.</p></div><div class="refsect1" lang="en"><a name="id3227366"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.glade.XML</span></span>(<span class="ooclass"><span class="classname"><PYGTKDOCLINK HREF="class-gobject">gobject.GObject</PYGTKDOCLINK></span></span>):
2
from XML descriptions.</p></div><div class="refsect1" lang="en"><a name="id3258040"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.glade.XML</span></span>(<span class="ooclass"><span class="classname"><PYGTKDOCLINK HREF="class-gobject">gobject.GObject</PYGTKDOCLINK></span></span>):
3
3
<code class="constructorsynopsis"> <span class="methodname"><a class="link" href="class-gladexml.html#constructor-gladexml" title="Constructor">gtk.glade.XML</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>fname</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>root</code></strong></span><span class="initializer">=None</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>domain</code></strong></span><span class="initializer">=""</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>typedict</code></strong></span><span class="initializer">={}</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gladexml.html#method-gladexml--signal-connect" title="gtk.glade.XML.signal_connect">signal_connect</a></span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>handler_name</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>func</code></em></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gladexml.html#method-gladexml--signal-autoconnect" title="gtk.glade.XML.signal_autoconnect">signal_autoconnect</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>dict</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gladexml.html#method-gladexml--get-widget" title="gtk.glade.XML.get_widget">get_widget</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>name</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gladexml.html#method-gladexml--get-widget-prefix" title="gtk.glade.XML.get_widget_prefix">get_widget_prefix</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>name</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gladexml.html#method-gladexml--relative-file" title="gtk.glade.XML.relative_file">relative_file</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>filename</code></strong></span></span>)</code><br></pre></td></tr></table><pre class="programlisting">
4
4
<span class="bold"><strong>Functions</strong></span>
6
<code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gladexml.html#function-glade--xml-new-from-buffer" title="gtk.glade.xml_new_from_buffer">gtk.glade.xml_new_from_buffer</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>buffer</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>size</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>root</code></strong></span><span class="initializer">=""</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>domain</code></strong></span><span class="initializer">=""</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>typedict</code></strong></span><span class="initializer">={}</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gladexml.html#function-glade--get-widget-name" title="gtk.glade.get_widget_name">gtk.glade.get_widget_name</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>widget</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gladexml.html#function-glade--get-widget-tree" title="gtk.glade.get_widget_tree">gtk.glade.get_widget_tree</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>widget</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gladexml.html#function-glade--set-custom-handler" title="gtk.glade.set_custom_handler">gtk.glade.set_custom_handler</a></span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>handler</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_data</code></em></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gladexml.html#function-glade--bindtextdomain" title="gtk.glade.bindtextdomain">gtk.glade.bindtextdomain</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>domainname</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dirname</code></strong></span><span class="initializer">=""</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gladexml.html#function-glade--textdomain" title="gtk.glade.textdomain">gtk.glade.textdomain</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>domainname</code></strong></span><span class="initializer">=""</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gladexml.html#function-glade--set-custom-widget-callbacks" title="gtk.glade.set_custom_widget_callbacks">gtk.glade.set_custom_widget_callbacks</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>dict</code></strong></span></span>)</code></pre></div><div class="refsect1" lang="en"><a name="id3290033"></a><h2>Ancestry</h2><pre class="synopsis">+-- <PYGTKDOCLINK HREF="class-gobject">gobject.GObject</PYGTKDOCLINK>
6
<code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gladexml.html#function-glade--xml-new-from-buffer" title="gtk.glade.xml_new_from_buffer">gtk.glade.xml_new_from_buffer</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>buffer</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>size</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>root</code></strong></span><span class="initializer">=""</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>domain</code></strong></span><span class="initializer">=""</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>typedict</code></strong></span><span class="initializer">={}</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gladexml.html#function-glade--get-widget-name" title="gtk.glade.get_widget_name">gtk.glade.get_widget_name</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>widget</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gladexml.html#function-glade--get-widget-tree" title="gtk.glade.get_widget_tree">gtk.glade.get_widget_tree</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>widget</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gladexml.html#function-glade--set-custom-handler" title="gtk.glade.set_custom_handler">gtk.glade.set_custom_handler</a></span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>handler</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>user_data</code></em></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gladexml.html#function-glade--bindtextdomain" title="gtk.glade.bindtextdomain">gtk.glade.bindtextdomain</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>domainname</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>dirname</code></strong></span><span class="initializer">=""</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gladexml.html#function-glade--textdomain" title="gtk.glade.textdomain">gtk.glade.textdomain</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>domainname</code></strong></span><span class="initializer">=""</span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-gladexml.html#function-glade--set-custom-widget-callbacks" title="gtk.glade.set_custom_widget_callbacks">gtk.glade.set_custom_widget_callbacks</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>dict</code></strong></span></span>)</code></pre></div><div class="refsect1" lang="en"><a name="id3170401"></a><h2>Ancestry</h2><pre class="synopsis">+-- <PYGTKDOCLINK HREF="class-gobject">gobject.GObject</PYGTKDOCLINK>
7
7
+-- <a class="link" href="class-gladexml.html" title="gtk.glade.XML">gtk.glade.XML</a>
8
</pre></div><div class="refsect1" lang="en"><a name="signal-prototypes-gladexml"></a><h2>gtk.glade.XML Signal Prototypes</h2><p><PYGTKDOCLINK HREF="signal-prototypes-gobject">gobject.GObject Signal Prototypes</PYGTKDOCLINK></p></div><div class="refsect1" lang="en"><a name="id3289996"></a><h2>Description</h2><p>This object represents an `instantiation' of an XML interface
8
</pre></div><div class="refsect1" lang="en"><a name="signal-prototypes-gladexml"></a><h2>gtk.glade.XML Signal Prototypes</h2><p><PYGTKDOCLINK HREF="signal-prototypes-gobject">gobject.GObject Signal Prototypes</PYGTKDOCLINK></p></div><div class="refsect1" lang="en"><a name="id3170364"></a><h2>Description</h2><p>This object represents an `instantiation' of an XML interface
9
9
description. When one of these objects is created, the XML file is read,
10
10
and the interface is created. The <a class="link" href="class-gladexml.html" title="gtk.glade.XML"><code class="classname">gtk.glade.XML</code></a> object
11
11
then provides an interface for accessing the widgets in the interface by the
25
25
say a toolbar or menu from the XML file, but not the window it is embedded
26
26
in. Note also that the XML parse tree is cached to speed up creating another
27
27
<a class="link" href="class-gladexml.html" title="gtk.glade.XML"><code class="classname">gtk.glade.XML</code></a>
28
object for the same file.</p></div><div class="refsect1" lang="en"><a name="id3096473"></a><h2>Methods</h2><div class="refsect2" lang="en"><a name="method-gladexml--signal-connect"></a><h3>gtk.glade.XML.signal_connect</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">signal_connect</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>handler_name</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>func</code></em></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><em class="parameter"><code>handler_name</code></em> :</span></p></td><td>the signal handler name</td></tr><tr><td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td><td>the signal handler function</td></tr></tbody></table><p>In the glade interface descriptions, signal handlers are
28
object for the same file.</p></div><div class="refsect1" lang="en"><a name="id3186728"></a><h2>Methods</h2><div class="refsect2" lang="en"><a name="method-gladexml--signal-connect"></a><h3>gtk.glade.XML.signal_connect</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">signal_connect</span>(<span class="methodparam"><span class="parameter"><em class="parameter"><code>handler_name</code></em></span></span>, <span class="methodparam"><span class="parameter"><em class="parameter"><code>func</code></em></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><em class="parameter"><code>handler_name</code></em> :</span></p></td><td>the signal handler name</td></tr><tr><td><p><span class="term"><em class="parameter"><code>func</code></em> :</span></p></td><td>the signal handler function</td></tr></tbody></table><p>In the glade interface descriptions, signal handlers are
29
29
specified for widgets by name. The <code class="methodname">signal_connect</code>()
30
30
method allows you to connect a callback specified by
31
31
<em class="parameter"><code>func</code></em> to all signals in the <a class="link" href="class-gladexml.html" title="gtk.glade.XML"><code class="classname">gtk.glade.XML</code></a> file
55
55
relative pathname specified by <em class="parameter"><code>filename</code></em>, using the
56
56
directory of the XML file as a base. If <em class="parameter"><code>filename</code></em>
57
57
contains an absolute pathname, then the original file name is
58
returned.</p></div></div><div class="refsect1" lang="en"><a name="id2816986"></a><h2>Functions</h2><div class="refsect2" lang="en"><a name="function-glade--xml-new-from-buffer"></a><h3>gtk.glade.xml_new_from_buffer</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.image_new_from_buffer</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>buffer</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>size</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>root</code></strong></span><span class="initializer">=""</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>domain</code></strong></span><span class="initializer">=""</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>typedict</code></strong></span><span class="initializer">={}</span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>buffer</code></strong> :</span></p></td><td>the string containing the XML buffer</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>size</code></strong> :</span></p></td><td>size of the string</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>root</code></strong> :</span></p></td><td>the widget node in fname to start building from
58
returned.</p></div></div><div class="refsect1" lang="en"><a name="id3221172"></a><h2>Functions</h2><div class="refsect2" lang="en"><a name="function-glade--xml-new-from-buffer"></a><h3>gtk.glade.xml_new_from_buffer</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">gtk.image_new_from_buffer</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>buffer</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>size</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>root</code></strong></span><span class="initializer">=""</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>domain</code></strong></span><span class="initializer">=""</span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>typedict</code></strong></span><span class="initializer">={}</span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>buffer</code></strong> :</span></p></td><td>the string containing the XML buffer</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>size</code></strong> :</span></p></td><td>size of the string</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>root</code></strong> :</span></p></td><td>the widget node in fname to start building from
59
59
(or <code class="literal">""</code>)</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>domain</code></strong> :</span></p></td><td>the translation domain for the XML file (or
60
60
<code class="literal">""</code> for default)</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>typedict</code></strong> :</span></p></td><td>A dictionary used to lookup types (or
61
61
<code class="literal">{}</code> for default)</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a new <a class="link" href="class-gladexml.html" title="gtk.glade.XML"><code class="classname">gtk.glade.XML</code></a>