| Server IP : 182.53.201.61 / Your IP : 216.73.217.175 Web Server : Apache/2.2.15 (Fedora) System : Linux km10.dyndns.org 2.6.31.5-127.fc12.i686.PAE #1 SMP Sat Nov 7 21:25:57 EST 2009 i686 User : apache ( 48) PHP Version : 5.3.3 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/gtk-doc/html/pygtk/ |
Upload File : |
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>pango.AttrList</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-pangoattriterator.html" title="pango.AttrIterator"><link rel="next" href="class-pangocolor.html" title="pango.Color"></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.AttrList</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-pangoattriterator.html">Prev</a> </td><th width="60%" align="center">The pango Class Reference</th><td width="20%" align="right"> <a accesskey="n" href="class-pangocolor.html">Next</a></td></tr></table><hr></div><div class="refentry" lang="en"><a name="class-pangoattrlist"></a><div class="titlepage"></div><div class="refnamediv"><h2>pango.AttrList</h2><p>pango.AttrList — an object holding attributes that apply to a section of text</p></div><div class="refsect1" lang="en"><a name="id3097466"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">pango.AttrList</span></span>(<span class="ooclass"><span class="classname">gobject.GBoxed</span></span>): <code class="constructorsynopsis"> <span class="methodname"><a class="link" href="class-pangoattrlist.html#constructor-pangoattrlist" title="Constructor">pango.AttrList</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-pangoattrlist.html#method-pangoattrlist--copy" title="pango.AttrList.copy">copy</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-pangoattrlist.html#method-pangoattrlist--insert" title="pango.AttrList.insert">insert</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>attr</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-pangoattrlist.html#method-pangoattrlist--insert-before" title="pango.AttrList.insert_before">insert_before</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>attr</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-pangoattrlist.html#method-pangoattrlist--change" title="pango.AttrList.change">change</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>attr</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-pangoattrlist.html#method-pangoattrlist--splice" title="pango.AttrList.splice">splice</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>other</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>pos</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>len</code></strong></span></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-pangoattrlist.html#method-pangoattrlist--get-iterator" title="pango.AttrList.get_iterator">get_iterator</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-pangoattrlist.html#method-pangoattrlist--filter" title="pango.AttrList.filter">filter</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>func</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>data</code></strong></span><span class="initializer">=None</span></span>)</code><br></pre></td></tr></table><pre class="programlisting"> <span class="bold"><strong>Functions</strong></span> <code class="methodsynopsis"> def <span class="methodname"><a class="link" href="class-pangoattrlist.html#function-pango--parse-markup" title="pango.parse_markup">pango.parse_markup</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>markup_text</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>accel_marker</code></strong></span><span class="initializer">=u'\x00'</span></span>)</code></pre></div><div class="refsect1" lang="en"><a name="id3109769"></a><h2>Description</h2><p>The <a class="link" href="class-pangoattrlist.html" title="pango.AttrList"><code class="classname">pango.AttrList</code></a> object contains a list of attributes that apply to a section of text. The attributes are, in general, allowed to overlap in an arbitrary fashion, however, if the attributes are manipulated only through the <a class="link" href="class-pangoattrlist.html#method-pangoattrlist--change" title="pango.AttrList.change"><code class="methodname">change</code>()</a> method, the overlap between properties will meet stricter criteria. Since the <a class="link" href="class-pangoattrlist.html" title="pango.AttrList"><code class="classname">pango.AttrList</code></a> object is stored as a linear list, it is not suitable for storing attributes for large amounts of text. In general, you should not use a single <a class="link" href="class-pangoattrlist.html" title="pango.AttrList"><code class="classname">pango.AttrList</code></a> for more than one paragraph of text.</p></div><div class="refsect1" lang="en"><a name="constructor-pangoattrlist"></a><h2>Constructor</h2><pre class="programlisting"><code class="constructorsynopsis"> <span class="methodname">pango.AttrList</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-pangoattrlist.html" title="pango.AttrList"><code class="classname">pango.AttrList</code></a> object.</td></tr></tbody></table><p>Creates a new <a class="link" href="class-pangoattrlist.html" title="pango.AttrList"><code class="classname">pango.AttrList</code></a> object.</p></div><div class="refsect1" lang="en"><a name="id3281982"></a><h2>Methods</h2><div class="refsect2" lang="en"><a name="method-pangoattrlist--copy"></a><h3>pango.AttrList.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-pangoattrlist.html" title="pango.AttrList"><code class="classname">pango.AttrList</code></a> object</td></tr></tbody></table><p>The <code class="methodname">copy</code>() method returns a new <a class="link" href="class-pangoattrlist.html" title="pango.AttrList"><code class="classname">pango.AttrList</code></a> object that is a copy of the attribute list </p></div><div class="refsect2" lang="en"><a name="method-pangoattrlist--insert"></a><h3>pango.AttrList.insert</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">insert</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>attr</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>attr</code></strong> :</span></p></td><td>the <a class="link" href="class-pangoattribute.html" title="pango.Attribute"><code class="classname">pango.Attribute</code></a> to insert.</td></tr></tbody></table><p>The <code class="methodname">insert</code>() method inserts the <a class="link" href="class-pangoattribute.html" title="pango.Attribute"><code class="classname">pango.Attribute</code></a> specified by <em class="parameter"><code>attr</code></em> into the attribute list. It will be inserted after all other attributes with a matching "start_index".</p></div><div class="refsect2" lang="en"><a name="method-pangoattrlist--insert-before"></a><h3>pango.AttrList.insert_before</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">insert_before</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>attr</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>attr</code></strong> :</span></p></td><td>the <a class="link" href="class-pangoattribute.html" title="pango.Attribute"><code class="classname">pango.Attribute</code></a> to insert.</td></tr></tbody></table><p>The <code class="methodname">insert_before</code>() method inserts the <a class="link" href="class-pangoattribute.html" title="pango.Attribute"><code class="classname">pango.Attribute</code></a> specified by attr into the attribute list. It will be inserted before all other attributes with a matching "start_index".</p></div><div class="refsect2" lang="en"><a name="method-pangoattrlist--change"></a><h3>pango.AttrList.change</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">change</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>attr</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>attr</code></strong> :</span></p></td><td>the <a class="link" href="class-pangoattribute.html" title="pango.Attribute"><code class="classname">pango.Attribute</code></a> to insert.</td></tr></tbody></table><p>The <code class="methodname">change</code>() method inserts the <a class="link" href="class-pangoattribute.html" title="pango.Attribute"><code class="classname">pango.Attribute</code></a> specified by <em class="parameter"><code>attr</code></em> into the attribute list. It will replace any attributes of the same type on that segment and be merged with any adjoining attributes that are identical. This method is slower than the <a class="link" href="class-pangoattrlist.html#method-pangoattrlist--insert" title="pango.AttrList.insert"><code class="function">insert()</code></a> method for creating an attribute list in order (potentially much slower for large lists). However, the <a class="link" href="class-pangoattrlist.html#method-pangoattrlist--insert" title="pango.AttrList.insert"><code class="function">insert()</code></a> method is not suitable for continually changing a set of attributes since it never removes or combines existing attributes.</p></div><div class="refsect2" lang="en"><a name="method-pangoattrlist--splice"></a><h3>pango.AttrList.splice</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">splice</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>other</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>pos</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>len</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>other</code></strong> :</span></p></td><td>another <a class="link" href="class-pangoattrlist.html" title="pango.AttrList"><code class="classname">pango.AttrList</code></a></td></tr><tr><td><p><span class="term"><strong class="parameter"><code>pos</code></strong> :</span></p></td><td>the position in this attribute list to insert <em class="parameter"><code>other</code></em></td></tr><tr><td><p><span class="term"><strong class="parameter"><code>len</code></strong> :</span></p></td><td>the length of the spliced segment. (Note that this must be specified since the attributes in <em class="parameter"><code>other</code></em> may only be present at some subsection of this range)</td></tr></tbody></table><p>The <code class="methodname">splice</code>() method splices the <a class="link" href="class-pangoattrlist.html" title="pango.AttrList"><code class="classname">pango.AttrList</code></a> specified by <em class="parameter"><code>other</code></em> into this attribute list. This method stretches each attribute with a range including the position specified by <em class="parameter"><code>pos</code></em> in the list by the amount specified by <em class="parameter"><code>len</code></em>, and then calls the <a class="link" href="class-pangoattrlist.html#method-pangoattrlist--change" title="pango.AttrList.change"><code class="methodname">change</code>()</a> method with a copy of each attribute in <em class="parameter"><code>other</code></em> in sequence (offset in position by <em class="parameter"><code>pos</code></em>).</p></div><div class="refsect2" lang="en"><a name="method-pangoattrlist--get-iterator"></a><h3>pango.AttrList.get_iterator</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">get_iterator</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>.</td></tr></tbody></table><p>The <code class="methodname">get_iterator</code>() method creates and returns a <a class="link" href="class-pangoattriterator.html" title="pango.AttrIterator"><code class="classname">pango.AttrIterator</code></a> initialized to the beginning of the attribute list.</p></div><div class="refsect2" lang="en"><a name="method-pangoattrlist--filter"></a><h3>pango.AttrList.filter</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">filter</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>func</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>data</code></strong></span><span class="initializer">=None</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>func</code></strong> :</span></p></td><td>a callback function that returns <code class="literal">True</code> if an attribute should be filtered out.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>data</code></strong> :</span></p></td><td>data to be passed to <em class="parameter"><code>func</code></em></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-pangoattrlist.html" title="pango.AttrList"><code class="classname">pango.AttrList</code></a> or <code class="literal">None</code>.</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">filter</code>() method arranges for the callback function specified by <em class="parameter"><code>function</code></em> to be called on each <a class="link" href="class-pangoattribute.html" title="pango.Attribute"><code class="classname">pango.Attribute</code></a> in the attribute list with the optional user data specified by <code class="literal">data</code>. The callback function signature is:</p><pre class="programlisting"> def func(attribute, user_data) </pre><p>where <em class="parameter"><code>attribute</code></em> is an attribute of the attribute list and <em class="parameter"><code>user_data</code></em> is <em class="parameter"><code>data</code></em>. The callback function returns <code class="literal">True</code> if the attribute should be filtered out of the attribute list. The <code class="methodname">filter</code> method returns a new <a class="link" href="class-pangoattrlist.html" title="pango.AttrList"><code class="classname">pango.AttrList</code></a> containing the attributes that were filtered out (removed from) the attribute list.</p></div></div><div class="refsect1" lang="en"><a name="id3195201"></a><h2>Functions</h2><div class="refsect2" lang="en"><a name="function-pango--parse-markup"></a><h3>pango.parse_markup</h3><pre class="programlisting"><code class="methodsynopsis"> def <span class="methodname">pango.parse_markup</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>markup_text</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>accel_marker</code></strong></span><span class="initializer">=u'\x00'</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>markup_text</code></strong> :</span></p></td><td>a string containing the markup to parse.</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>accel_marker</code></strong> :</span></p></td><td>the Unicode character that precedes an accelerator, or u'\x00' for none</td></tr><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-pangoattrlist.html" title="pango.AttrList"><code class="classname">pango.AttrList</code></a>, the plain text in <em class="parameter"><code>markup_text</code></em>, and the first accelerator character in the text.</td></tr></tbody></table><p>The <code class="function">parse_markup</code>() function parses the text specified by <em class="parameter"><code>markup_text</code></em> and returns a 3-tuple containing a <a class="link" href="class-pangoattrlist.html" title="pango.AttrList"><code class="classname">pango.AttrList</code></a>, the plain text from <em class="parameter"><code>markup_text</code></em> and the first accelerator character that is preceded by the Unicode character specified by <em class="parameter"><code>accel_marker</code></em>. The returned accelerator character is a Unicode character that may be u'\x00' if there is no accelerator character.</p><p>See the <a class="link" href="pango-markup-language.html" title="The Pango Markup Language">The Pango Markup Language</a> reference for more information.</p><p>The GError exception is raised if an error occurs while parsing the markup text.</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-pangoattriterator.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-pangocolor.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">pango.AttrIterator </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> pango.Color</td></tr></table></div></body></html>