1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>pango.AttrIterator</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="PyGTK 2.0 Reference Manual"><link rel="up" href="pango-class-reference.html" title="The pango Class Reference"><link rel="previous" href="class-pangoattribute.html" title="pango.Attribute"><link rel="next" href="class-pangoattrlist.html" title="pango.AttrList"></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">pango.AttrIterator</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-pangoattribute.html">Prev</a></td><th width="60%" align="center">The pango Class Reference</th><td width="20%" align="right"><a accesskey="n" href="class-pangoattrlist.html">Next</a></td></tr></table><hr></div><div class="refentry" lang="en"><a name="class-pangoattriterator"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2>pango.AttrIterator</h2><p>pango.AttrIterator — an object pointing to a location in a <a href="class-pangoattrlist.html" title="pango.AttrList"><tt class="classname">pango.AttrList</tt></a>.</p></div><div class="refsect1" lang="en"><a name="id3128362"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">pango.AttrIterator</span></span>:
<code class="methodsynopsis"> def <span class="methodname"><a href="class-pangoattriterator.html#method-pangoattriterator--copy" title="pango.AttrIterator.copy">copy</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangoattriterator.html#method-pangoattriterator--range" title="pango.AttrIterator.range">range</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangoattriterator.html#method-pangoattriterator--next" title="pango.AttrIterator.next">next</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangoattriterator.html#method-pangoattriterator--get" title="pango.AttrIterator.get">get</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>type</tt></b></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangoattriterator.html#method-pangoattriterator--get-font" title="pango.AttrIterator.get_font">get_font</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a href="class-pangoattriterator.html#method-pangoattriterator--get-attrs" title="pango.AttrIterator.get_attrs">get_attrs</a></span>(<span class="methodparam"></span>)</code><br></pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3017099"></a><h2>Description</h2><p>The <a href="class-pangoattriterator.html" title="pango.AttrIterator"><tt class="classname">pango.AttrIterator</tt></a>
object contains a pointer into a <a href="class-pangoattrlist.html" title="pango.AttrList"><tt class="classname">pango.AttrList</tt></a>.
A <a href="class-pangoattriterator.html" title="pango.AttrIterator"><tt class="classname">pango.AttrIterator</tt></a>
object is created using the <a href="class-pangoattrlist.html#method-pangoattrlist--get-iterator" title="pango.AttrList.get_iterator"><tt class="methodname">pango.AttrList.get_iterator</tt>()</a>
method and then can be advanced through the attribute changes in the text
using the <a href="class-pangoattriterator.html#method-pangoattriterator--next" title="pango.AttrIterator.next"><tt class="methodname">next</tt>()</a>
method. The <a href="class-pangoattriterator.html" title="pango.AttrIterator"><tt class="classname">pango.AttrIterator</tt></a>
object can access information about the current attributes applied at the
iterator location (using the <a href="class-pangoattriterator.html#method-pangoattriterator--get" title="pango.AttrIterator.get"><tt class="methodname">get</tt>()</a>
method) and the range of text that the current attribute change applies to
(using the <a href="class-pangoattriterator.html#method-pangoattriterator--range" title="pango.AttrIterator.range"><tt class="methodname">range</tt>()</a>
method).</p><p>The <a href="class-pangoattriterator.html" title="pango.AttrIterator"><tt class="classname">pango.AttrIterator</tt></a>
object is only valid as long as the associated <a href="class-pangoattrlist.html" title="pango.AttrList"><tt class="classname">pango.AttrList</tt></a>
is not changed.</p></div><div class="refsect1" lang="en"><a name="id3196375"></a><h2>Methods</h2><div class="refsect2" lang="en"><a name="method-pangoattriterator--copy"></a><h3>pango.AttrIterator.copy</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">copy</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a new <a href="class-pangoattriterator.html" title="pango.AttrIterator"><tt class="classname">pango.AttrIterator</tt></a>
object</td></tr></tbody></table><p>The <tt class="methodname">copy</tt>() method returns a new <a href="class-pangoattriterator.html" title="pango.AttrIterator"><tt class="classname">pango.AttrIterator</tt></a>
object that is a copy of this attribute iterator.</p></div><div class="refsect2" lang="en"><a name="method-pangoattriterator--range"></a><h3>pango.AttrIterator.range</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">range</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a 2-tuple containing the start and end index of
the current attribute in the text.</td></tr></tbody></table><p>The <tt class="methodname">range</tt>() method returns a 2-tuple
containing the start and end index of the application of the current
attribute change in the text.</p></div><div class="refsect2" lang="en"><a name="method-pangoattriterator--next"></a><h3>pango.AttrIterator.next</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">next</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td><tt class="literal">FALSE</tt> if the iterator is at
the end of the <a href="class-pangoattrlist.html" title="pango.AttrList"><tt class="classname">pango.AttrList</tt></a>.</td></tr></tbody></table><p>The <tt class="methodname">next</tt>() method advances the iterator
to the next attribute change in its <a href="class-pangoattrlist.html" title="pango.AttrList"><tt class="classname">pango.AttrList</tt></a>.
The <tt class="methodname">next</tt> method returns <tt class="literal">FALSE</tt> if
the iterator is at the end of the <a href="class-pangoattrlist.html" title="pango.AttrList"><tt class="classname">pango.AttrList</tt></a>;
otherwise, <tt class="literal">TRUE</tt>. </p></div><div class="refsect2" lang="en"><a name="method-pangoattriterator--get"></a><h3>pango.AttrIterator.get</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>type</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>type</tt></b>:</span></td><td>the <a href="class-pangoattribute.html" title="pango.Attribute"><tt class="classname">pango.Attribute</tt></a>
type to find.</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>the <a href="class-pangoattribute.html" title="pango.Attribute"><tt class="classname">pango.Attribute</tt></a>
matching type or <tt class="literal">None</tt>.</td></tr></tbody></table><p>The <tt class="methodname">get</tt>() method returns the <a href="class-pangoattribute.html" title="pango.Attribute"><tt class="classname">pango.Attribute</tt></a>
at the iterator location that matches the specified
<i class="parameter"><tt>type</tt></i>. When multiple attributes of the same type
overlap, the attribute whose range starts closest to the current location is
returned. If no attribute matches, <tt class="literal">None</tt> is
returned.</p></div><div class="refsect2" lang="en"><a name="method-pangoattriterator--get-font"></a><h3>pango.AttrIterator.get_font</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_font</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a 3-tuple containing a <a href="class-pangofontdescription.html" title="pango.FontDescription"><tt class="classname">pango.FontDescription</tt></a>,
a <a href="class-pangolanguage.html" title="pango.Language"><tt class="classname">pango.Language</tt></a>
and a list of non-font <a href="class-pangoattribute.html" title="pango.Attribute"><tt class="classname">pango.Attribute</tt></a>
objects at the current iterator location.</td></tr></tbody></table><p>The <tt class="methodname">get_font</tt>() method returns a 3-tuple
containing a <a href="class-pangofontdescription.html" title="pango.FontDescription"><tt class="classname">pango.FontDescription</tt></a>
holding the current font attributes, a <a href="class-pangolanguage.html" title="pango.Language"><tt class="classname">pango.Language</tt></a>
object (if a language is set) or <tt class="literal">None</tt> and a list of
non-font <a href="class-pangoattribute.html" title="pango.Attribute"><tt class="classname">pango.Attribute</tt></a>
objects in effect at the current iterator location.</p></div><div class="refsect2" lang="en"><a name="method-pangoattriterator--get-attrs"></a><h3>pango.AttrIterator.get_attrs</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_attrs</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a tuple containing the <a href="class-pangoattribute.html" title="pango.Attribute"><tt class="classname">pango.Attribute</tt></a>
objects in effect at the current iterator
location.</td></tr></tbody></table><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Note</h3><p>This method is available in PyGTK 2.4 and above.</p></div><p>The <tt class="methodname">get_attrs</tt>() method returns a tuple
containing the <a href="class-pangoattribute.html" title="pango.Attribute"><tt class="classname">pango.Attribute</tt></a>
objects in effect at the current iterator location.</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="class-pangoattribute.html">Prev</a></td><td width="20%" align="center"><a accesskey="u" href="pango-class-reference.html">Up</a></td><td width="40%" align="right"><a accesskey="n" href="class-pangoattrlist.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">pango.Attribute</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">pango.AttrList</td></tr></table></div></body></html>
|