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=utf-8"><title>pango.AttrIterator</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="pango-class-reference.html" title="The pango Class Reference"><link rel="prev" 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 class="refnamediv"><h2>pango.AttrIterator</h2><p>pango.AttrIterator — an object pointing to a location in a <a class="link" href="class-pangoattrlist.html" title="pango.AttrList"><code class="classname">pango.AttrList</code></a>.</p></div><div class="refsect1" lang="en"><a name="id2764300"></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 class="link" 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 class="link" 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 class="link" 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 class="link" href="class-pangoattriterator.html#method-pangoattriterator--get" title="pango.AttrIterator.get">get</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>type</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" 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 class="link" 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="id2593361"></a><h2>Description</h2><p>The <a class="link" href="class-pangoattriterator.html" title="pango.AttrIterator"><code class="classname">pango.AttrIterator</code></a>
object contains a pointer into a <a class="link" href="class-pangoattrlist.html" title="pango.AttrList"><code class="classname">pango.AttrList</code></a>.
A <a class="link" href="class-pangoattriterator.html" title="pango.AttrIterator"><code class="classname">pango.AttrIterator</code></a>
object is created using the <a class="link" href="class-pangoattrlist.html#method-pangoattrlist--get-iterator" title="pango.AttrList.get_iterator"><code class="methodname">pango.AttrList.get_iterator</code>()</a>
method and then can be advanced through the attribute changes in the text
using the <a class="link" href="class-pangoattriterator.html#method-pangoattriterator--next" title="pango.AttrIterator.next"><code class="methodname">next</code>()</a>
method. The <a class="link" href="class-pangoattriterator.html" title="pango.AttrIterator"><code class="classname">pango.AttrIterator</code></a>
object can access information about the current attributes applied at the
iterator location (using the <a class="link" href="class-pangoattriterator.html#method-pangoattriterator--get" title="pango.AttrIterator.get"><code class="methodname">get</code>()</a>
method) and the range of text that the current attribute change applies to
(using the <a class="link" href="class-pangoattriterator.html#method-pangoattriterator--range" title="pango.AttrIterator.range"><code class="methodname">range</code>()</a>
method).</p><p>The <a class="link" href="class-pangoattriterator.html" title="pango.AttrIterator"><code class="classname">pango.AttrIterator</code></a>
object is only valid as long as the associated <a class="link" href="class-pangoattrlist.html" title="pango.AttrList"><code class="classname">pango.AttrList</code></a>
is not changed.</p></div><div class="refsect1" lang="en"><a name="id2930981"></a><h2>Methods</h2><div class="refsect2" lang="en"><a name="method-pangoattriterator--copy"></a><h3>pango.AttrIterator.copy</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">copy</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a new <a class="link" href="class-pangoattriterator.html" title="pango.AttrIterator"><code class="classname">pango.AttrIterator</code></a>
object</td></tr></tbody></table><p>The <code class="methodname">copy</code>() method returns a new <a class="link" href="class-pangoattriterator.html" title="pango.AttrIterator"><code class="classname">pango.AttrIterator</code></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><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">range</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a 2-tuple containing the start and end index of
the current attribute in the text.</td></tr></tbody></table><p>The <code class="methodname">range</code>() 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><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">next</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td><code class="literal">False</code> if the iterator is at
the end of the <a class="link" href="class-pangoattrlist.html" title="pango.AttrList"><code class="classname">pango.AttrList</code></a>.</td></tr></tbody></table><p>The <code class="methodname">next</code>() method advances the iterator
to the next attribute change in its <a class="link" href="class-pangoattrlist.html" title="pango.AttrList"><code class="classname">pango.AttrList</code></a>.
The <code class="methodname">next</code> method returns <code class="literal">False</code> if
the iterator is at the end of the <a class="link" href="class-pangoattrlist.html" title="pango.AttrList"><code class="classname">pango.AttrList</code></a>;
otherwise, <code class="literal">True</code>. </p></div><div class="refsect2" lang="en"><a name="method-pangoattriterator--get"></a><h3>pango.AttrIterator.get</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>type</code></strong></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>type</code></strong> :</span></p></td><td>the <a class="link" href="class-pangoattribute.html" title="pango.Attribute"><code class="classname">pango.Attribute</code></a>
type to find.</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the <a class="link" href="class-pangoattribute.html" title="pango.Attribute"><code class="classname">pango.Attribute</code></a>
matching type or <code class="literal">None</code>.</td></tr></tbody></table><p>The <code class="methodname">get</code>() method returns the <a class="link" href="class-pangoattribute.html" title="pango.Attribute"><code class="classname">pango.Attribute</code></a>
at the iterator location that matches the specified
<em class="parameter"><code>type</code></em>. When multiple attributes of the same type
overlap, the attribute whose range starts closest to the current location is
returned. If no attribute matches, <code class="literal">None</code> is
returned.</p></div><div class="refsect2" lang="en"><a name="method-pangoattriterator--get-font"></a><h3>pango.AttrIterator.get_font</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_font</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a 3-tuple containing a <a class="link" href="class-pangofontdescription.html" title="pango.FontDescription"><code class="classname">pango.FontDescription</code></a>,
a <a class="link" href="class-pangolanguage.html" title="pango.Language"><code class="classname">pango.Language</code></a>
and a list of non-font <a class="link" href="class-pangoattribute.html" title="pango.Attribute"><code class="classname">pango.Attribute</code></a>
objects at the current iterator location.</td></tr></tbody></table><p>The <code class="methodname">get_font</code>() method returns a 3-tuple
containing a <a class="link" href="class-pangofontdescription.html" title="pango.FontDescription"><code class="classname">pango.FontDescription</code></a>
holding the current font attributes, a <a class="link" href="class-pangolanguage.html" title="pango.Language"><code class="classname">pango.Language</code></a>
object (if a language is set) or <code class="literal">None</code> and a list of
non-font <a class="link" href="class-pangoattribute.html" title="pango.Attribute"><code class="classname">pango.Attribute</code></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><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_attrs</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a tuple containing the <a class="link" href="class-pangoattribute.html" title="pango.Attribute"><code class="classname">pango.Attribute</code></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 <code class="methodname">get_attrs</code>() method returns a tuple
containing the <a class="link" href="class-pangoattribute.html" title="pango.Attribute"><code class="classname">pango.Attribute</code></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>
|