File: class-pangoattrlist.html

package info (click to toggle)
python-gtk2-doc 2.5.2-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 8,304 kB
  • ctags: 3,741
  • sloc: makefile: 38
file content (79 lines) | stat: -rw-r--r-- 19,552 bytes parent folder | download
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>pango.AttrList</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-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><div></div></div><div class="refnamediv"><h2>pango.AttrList</h2><p>pango.AttrList &#8212; an object holding attributes that apply to a section of
text</p></div><div class="refsect1" lang="en"><a name="id2950927"></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 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 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 href="class-pangoattrlist.html#method-pangoattrlist--insert" title="pango.AttrList.insert">insert</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>attr</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-pangoattrlist.html#method-pangoattrlist--insert-before" title="pango.AttrList.insert_before">insert_before</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>attr</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-pangoattrlist.html#method-pangoattrlist--change" title="pango.AttrList.change">change</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>attr</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-pangoattrlist.html#method-pangoattrlist--splice" title="pango.AttrList.splice">splice</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>other</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>pos</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>len</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a 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 href="class-pangoattrlist.html#method-pangoattrlist--filter" title="pango.AttrList.filter">filter</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>func</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>data</tt></b></span><span class="initializer">=None</span></span>)</code><br></pre></td></tr></table><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
<span class="bold"><b>Functions</b></span>

<code class="methodsynopsis">    def <span class="methodname"><a href="class-pangoattrlist.html#function-pango--parse-markup" title="pango.parse_markup">pango.parse_markup</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>markup_text</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>accel_marker</tt></b></span></span>)</code></pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id2972751"></a><h2>Description</h2><p>The <a href="class-pangoattrlist.html" title="pango.AttrList"><tt class="classname">pango.AttrList</tt></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 href="class-pangoattrlist.html#method-pangoattrlist--change" title="pango.AttrList.change"><tt class="methodname">change</tt>()</a> 
method, the overlap between properties will meet stricter criteria. Since
the <a href="class-pangoattrlist.html" title="pango.AttrList"><tt class="classname">pango.AttrList</tt></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 href="class-pangoattrlist.html" title="pango.AttrList"><tt class="classname">pango.AttrList</tt></a>
for more than one paragraph of text.</p></div><div class="refsect1" lang="en"><a name="constructor-pangoattrlist"></a><h2>Constructor</h2><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="constructorsynopsis">    <span class="methodname">pango.AttrList</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-pangoattrlist.html" title="pango.AttrList"><tt class="classname">pango.AttrList</tt></a>
object.</td></tr></tbody></table><p>Creates a new <a href="class-pangoattrlist.html" title="pango.AttrList"><tt class="classname">pango.AttrList</tt></a>
object.</p></div><div class="refsect1" lang="en"><a name="id3183092"></a><h2>Methods</h2><div class="refsect2" lang="en"><a name="method-pangoattrlist--copy"></a><h3>pango.AttrList.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-pangoattrlist.html" title="pango.AttrList"><tt class="classname">pango.AttrList</tt></a>
object</td></tr></tbody></table><p>The <tt class="methodname">copy</tt>() method returns
a new <a href="class-pangoattrlist.html" title="pango.AttrList"><tt class="classname">pango.AttrList</tt></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><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">insert</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>attr</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>attr</tt></b>:</span></td><td>the <a href="class-pangoattribute.html" title="pango.Attribute"><tt class="classname">pango.Attribute</tt></a>
to insert.</td></tr></tbody></table><p>The <tt class="methodname">insert</tt>() method
inserts the <a href="class-pangoattribute.html" title="pango.Attribute"><tt class="classname">pango.Attribute</tt></a>
specified by <i class="parameter"><tt>attr</tt></i> 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><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">insert_before</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>attr</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>attr</tt></b>:</span></td><td>the <a href="class-pangoattribute.html" title="pango.Attribute"><tt class="classname">pango.Attribute</tt></a>
to insert.</td></tr></tbody></table><p>The <tt class="methodname">insert_before</tt>()
method inserts the <a href="class-pangoattribute.html" title="pango.Attribute"><tt class="classname">pango.Attribute</tt></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><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">change</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>attr</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>attr</tt></b>:</span></td><td>the <a href="class-pangoattribute.html" title="pango.Attribute"><tt class="classname">pango.Attribute</tt></a>
to insert.</td></tr></tbody></table><p>The <tt class="methodname">change</tt>() method
inserts the <a href="class-pangoattribute.html" title="pango.Attribute"><tt class="classname">pango.Attribute</tt></a>
specified by <i class="parameter"><tt>attr</tt></i> 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 href="class-pangoattrlist.html#method-pangoattrlist--insert" title="pango.AttrList.insert"><tt class="function">insert()</tt></a>
method for creating an attribute list in order (potentially much slower for
large lists). However, the <a href="class-pangoattrlist.html#method-pangoattrlist--insert" title="pango.AttrList.insert"><tt class="function">insert()</tt></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><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">splice</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>other</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>pos</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>len</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>other</tt></b>:</span></td><td>another <a href="class-pangoattrlist.html" title="pango.AttrList"><tt class="classname">pango.AttrList</tt></a></td></tr><tr><td><span class="term"><b class="parameter"><tt>pos</tt></b>:</span></td><td>the position in this attribute list to insert
<i class="parameter"><tt>other</tt></i></td></tr><tr><td><span class="term"><b class="parameter"><tt>len</tt></b>:</span></td><td>the length of the spliced segment. (Note that
this must be specified since the attributes in <i class="parameter"><tt>other</tt></i>
may only be present at some subsection of this range)</td></tr></tbody></table><p>The <tt class="methodname">splice</tt>() method
splices the <a href="class-pangoattrlist.html" title="pango.AttrList"><tt class="classname">pango.AttrList</tt></a>
specified by <i class="parameter"><tt>other</tt></i> into this attribute list. This
method stretches each attribute with a range including the position
specified by <i class="parameter"><tt>pos</tt></i> in the list by the amount specified
by <i class="parameter"><tt>len</tt></i>, and then calls the <a href="class-pangoattrlist.html#method-pangoattrlist--change" title="pango.AttrList.change"><tt class="methodname">change</tt>()</a> 
method with a copy of each attribute in <i class="parameter"><tt>other</tt></i> in
sequence (offset in position by <i class="parameter"><tt>pos</tt></i>).</p></div><div class="refsect2" lang="en"><a name="method-pangoattrlist--get-iterator"></a><h3>pango.AttrList.get_iterator</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_iterator</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>.</td></tr></tbody></table><p>The <tt class="methodname">get_iterator</tt>() method creates and
returns a <a href="class-pangoattriterator.html" title="pango.AttrIterator"><tt class="classname">pango.AttrIterator</tt></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><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">filter</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>func</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>data</tt></b></span><span class="initializer">=None</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>func</tt></b>:</span></td><td>a callback function that returns
	  <tt class="literal">TRUE</tt> if an attribute should be filtered
	  out.</td></tr><tr><td><span class="term"><b class="parameter"><tt>data</tt></b>:</span></td><td>data to be passed to
	  <i class="parameter"><tt>func</tt></i></td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a new <a href="class-pangoattrlist.html" title="pango.AttrList"><tt class="classname">pango.AttrList</tt></a>
	  or <tt class="literal">None</tt>.</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">filter</tt>() method arranges for the
callback function specified by <i class="parameter"><tt>function</tt></i> to be called
on each <a href="class-pangoattribute.html" title="pango.Attribute"><tt class="classname">pango.Attribute</tt></a>
in the attribute list with the optional user data specified by
<tt class="literal">data</tt>. The callback function signature is:</p><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting">
  def func(attribute, user_data)
</pre></td></tr></table><p>where <i class="parameter"><tt>attribute</tt></i> is an attribute of the
attribute list and <i class="parameter"><tt>user_data</tt></i> is
<i class="parameter"><tt>data</tt></i>. The callback function returns
<tt class="literal">TRUE</tt> if the attribute should be filtered out of the
attribute list. The <tt class="methodname">filter</tt> method returns a new
<a href="class-pangoattrlist.html" title="pango.AttrList"><tt class="classname">pango.AttrList</tt></a>
containing the attributes that were filtered out (removed from) the
attribute list.</p></div></div><div class="refsect1" lang="en"><a name="id3123618"></a><h2>Functions</h2><div class="refsect2" lang="en"><a name="function-pango--parse-markup"></a><h3>pango.parse_markup</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">pango.parse_markup</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>markup_text</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>accel_marker</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>markup_text</tt></b>:</span></td><td>a string containing the markup to
parse.</td></tr><tr><td><span class="term"><b class="parameter"><tt>accel_marker</tt></b>:</span></td><td>the Unicode character that precedes an
accelerator, or 0 for none</td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a 3-tuple containing a <a href="class-pangoattrlist.html" title="pango.AttrList"><tt class="classname">pango.AttrList</tt></a>,
the plain text in <i class="parameter"><tt>markup_text</tt></i>, and the first
accelerator character in the text.</td></tr></tbody></table><p>The <tt class="function">parse_markup</tt>() function parses the text
specified by <i class="parameter"><tt>markup_text</tt></i> and returns a 3-tuple
containing a <a href="class-pangoattrlist.html" title="pango.AttrList"><tt class="classname">pango.AttrList</tt></a>,
the plain text from <i class="parameter"><tt>markup_text</tt></i> and the first
accelerator character that is preceded by the Unicode character specified by
<i class="parameter"><tt>accel_marker</tt></i>. The returned accelerator character is a
Unicode character that may be u'\x00' if there is no accelerator
character.</p><p>See the <a 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>