File: pygtk-pangoattrlist.xml

package info (click to toggle)
pygtk 2.24.0-5.1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 26,760 kB
  • ctags: 8,260
  • sloc: xml: 182,079; sh: 10,297; python: 10,161; ansic: 2,861; makefile: 1,358
file content (399 lines) | stat: -rw-r--r-- 15,480 bytes parent folder | download | duplicates (5)
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
<?xml version="1.0" standalone="no"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
    "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">

<refentry id="class-pangoattrlist">
  <refnamediv>
    <refname>pango.AttrList</refname>
    <refpurpose>an object holding attributes that apply to a section of
text</refpurpose>
  </refnamediv>

  <refsect1>
    <title>Synopsis</title>

    <classsynopsis language="python">
      <ooclass><classname>pango.AttrList</classname></ooclass>
      <ooclass><classname>gobject.GBoxed</classname></ooclass>
      <constructorsynopsis language="python">
	<methodname><link
linkend="constructor-pangoattrlist">pango.AttrList</link></methodname>
	<methodparam></methodparam>  </constructorsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-pangoattrlist--copy">copy</link></methodname>
	<methodparam></methodparam>  </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-pangoattrlist--insert">insert</link></methodname>
	<methodparam><parameter
		       role="keyword">attr</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-pangoattrlist--insert-before">insert_before</link></methodname>
	<methodparam><parameter
		       role="keyword">attr</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-pangoattrlist--change">change</link></methodname>
	<methodparam><parameter
		       role="keyword">attr</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-pangoattrlist--splice">splice</link></methodname>
	<methodparam><parameter
		       role="keyword">other</parameter></methodparam>
	<methodparam><parameter role="keyword">pos</parameter></methodparam>
	<methodparam><parameter role="keyword">len</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-pangoattrlist--get-iterator">get_iterator</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-pangoattrlist--filter">filter</link></methodname>
	<methodparam><parameter role="keyword">func</parameter></methodparam>
	<methodparam><parameter role="keyword">data</parameter><initializer>None</initializer></methodparam>
      </methodsynopsis>

    </classsynopsis>

    <programlisting>
<emphasis role="bold">Functions</emphasis>

<methodsynopsis language="python">
	<methodname><link
linkend="function-pango--parse-markup">pango.parse_markup</link></methodname>
	<methodparam><parameter
		       role="keyword">markup_text</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">accel_marker</parameter><initializer>u'\x00'</initializer></methodparam>
      </methodsynopsis></programlisting>

  </refsect1>

  <refsect1>
    <title>Description</title>

    <para>The <link
linkend="class-pangoattrlist"><classname>pango.AttrList</classname></link>
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 <link
linkend="method-pangoattrlist--change"><methodname>change</methodname>()</link> 
method, the overlap between properties will meet stricter criteria. Since
the <link
linkend="class-pangoattrlist"><classname>pango.AttrList</classname></link>
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 <link
linkend="class-pangoattrlist"><classname>pango.AttrList</classname></link>
for more than one paragraph of text.</para>

  </refsect1>

  <refsect1 id="constructor-pangoattrlist">
    <title>Constructor</title>

    <programlisting><constructorsynopsis language="python">
	<methodname>pango.AttrList</methodname>
	<methodparam></methodparam>  </constructorsynopsis></programlisting>
    <variablelist>
      <varlistentry>
	<term><emphasis>Returns</emphasis>&nbsp;:</term>
	<listitem><simpara>a new <link
linkend="class-pangoattrlist"><classname>pango.AttrList</classname></link>
object.</simpara></listitem>
      </varlistentry>
    </variablelist>

    <para>Creates a new <link
linkend="class-pangoattrlist"><classname>pango.AttrList</classname></link>
object.</para>

  </refsect1>

  <refsect1>
    <title>Methods</title>

    <refsect2 id="method-pangoattrlist--copy">
      <title>pango.AttrList.copy</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>copy</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a new <link
linkend="class-pangoattrlist"><classname>pango.AttrList</classname></link>
object</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>copy</methodname>() method returns
a new <link
linkend="class-pangoattrlist"><classname>pango.AttrList</classname></link>
object that is a copy of the attribute list </para>

    </refsect2>

    <refsect2 id="method-pangoattrlist--insert">
      <title>pango.AttrList.insert</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>insert</methodname>
	  <methodparam><parameter role="keyword">attr</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">attr</parameter>&nbsp;:</term>
	  <listitem><simpara>the <link
linkend="class-pangoattribute"><classname>pango.Attribute</classname></link>
to insert.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>insert</methodname>() method
inserts the <link
linkend="class-pangoattribute"><classname>pango.Attribute</classname></link>
specified by <parameter>attr</parameter> into the attribute list. It will be
inserted after all other attributes with a matching "start_index".</para>

    </refsect2>

    <refsect2 id="method-pangoattrlist--insert-before">
      <title>pango.AttrList.insert_before</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>insert_before</methodname>
	  <methodparam><parameter role="keyword">attr</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">attr</parameter>&nbsp;:</term>
	  <listitem><simpara>the <link
linkend="class-pangoattribute"><classname>pango.Attribute</classname></link>
to insert.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>insert_before</methodname>()
method inserts the <link
linkend="class-pangoattribute"><classname>pango.Attribute</classname></link>
specified by attr into the attribute list. It will be inserted before all
other attributes with a matching "start_index".</para>

    </refsect2>

    <refsect2 id="method-pangoattrlist--change">
      <title>pango.AttrList.change</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>change</methodname>
	  <methodparam><parameter role="keyword">attr</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">attr</parameter>&nbsp;:</term>
	  <listitem><simpara>the <link
linkend="class-pangoattribute"><classname>pango.Attribute</classname></link>
to insert.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>change</methodname>() method
inserts the <link
linkend="class-pangoattribute"><classname>pango.Attribute</classname></link>
specified by <parameter>attr</parameter> 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
<link
linkend="method-pangoattrlist--insert"><function>insert()</function></link>
method for creating an attribute list in order (potentially much slower for
large lists). However, the <link
linkend="method-pangoattrlist--insert"><function>insert()</function></link>
method is not suitable for continually changing a set of attributes since it
never removes or combines existing attributes.</para>

    </refsect2>

    <refsect2 id="method-pangoattrlist--splice">
      <title>pango.AttrList.splice</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>splice</methodname>
	  <methodparam><parameter role="keyword">other</parameter></methodparam>
	  <methodparam><parameter role="keyword">pos</parameter></methodparam>
	  <methodparam><parameter role="keyword">len</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">other</parameter>&nbsp;:</term>
	  <listitem><simpara>another <link
linkend="class-pangoattrlist"><classname>pango.AttrList</classname></link></simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">pos</parameter>&nbsp;:</term>
	  <listitem><simpara>the position in this attribute list to insert
<parameter>other</parameter></simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">len</parameter>&nbsp;:</term>
	  <listitem><simpara>the length of the spliced segment. (Note that
this must be specified since the attributes in <parameter>other</parameter>
may only be present at some subsection of this range)</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>splice</methodname>() method
splices the <link
linkend="class-pangoattrlist"><classname>pango.AttrList</classname></link>
specified by <parameter>other</parameter> into this attribute list. This
method stretches each attribute with a range including the position
specified by <parameter>pos</parameter> in the list by the amount specified
by <parameter>len</parameter>, and then calls the <link
linkend="method-pangoattrlist--change"><methodname>change</methodname>()</link> 
method with a copy of each attribute in <parameter>other</parameter> in
sequence (offset in position by <parameter>pos</parameter>).</para>

    </refsect2>

    <refsect2 id="method-pangoattrlist--get-iterator">
      <title>pango.AttrList.get_iterator</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_iterator</methodname>
	  <methodparam></methodparam>  </methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a new <link
linkend="class-pangoattriterator"><classname>pango.AttrIterator</classname></link>.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>get_iterator</methodname>() method creates and
returns a <link
linkend="class-pangoattriterator"><classname>pango.AttrIterator</classname></link> 
initialized to the beginning of the attribute list.</para>

    </refsect2>

    <refsect2 id="method-pangoattrlist--filter">
      <title>pango.AttrList.filter</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>filter</methodname>
	  <methodparam><parameter role="keyword">func</parameter></methodparam>
	  <methodparam><parameter role="keyword">data</parameter><initializer>None</initializer></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">func</parameter>&nbsp;:</term>
	  <listitem><simpara>a callback function that returns
	  <literal>True</literal> if an attribute should be filtered
	  out.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">data</parameter>&nbsp;:</term>
	  <listitem><simpara>data to be passed to
	  <parameter>func</parameter></simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a new <link
	  linkend="class-pangoattrlist"><classname>pango.AttrList</classname></link>
	  or <literal>None</literal>.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.4 and above.</para>
      </note>

      <para>The <methodname>filter</methodname>() method arranges for the
callback function specified by <parameter>function</parameter> to be called
on each <link
linkend="class-pangoattribute"><classname>pango.Attribute</classname></link>
in the attribute list with the optional user data specified by
<literal>data</literal>. The callback function signature is:</para>

      <programlisting>
  def func(attribute, user_data)
</programlisting>

      <para>where <parameter>attribute</parameter> is an attribute of the
attribute list and <parameter>user_data</parameter> is
<parameter>data</parameter>. The callback function returns
<literal>True</literal> if the attribute should be filtered out of the
attribute list. The <methodname>filter</methodname> method returns a new
<link
linkend="class-pangoattrlist"><classname>pango.AttrList</classname></link>
containing the attributes that were filtered out (removed from) the
attribute list.</para>

    </refsect2>

  </refsect1>

  <refsect1>
    <title>Functions</title>

    <refsect2 id="function-pango--parse-markup">
      <title>pango.parse_markup</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>pango.parse_markup</methodname>
	  <methodparam><parameter
			 role="keyword">markup_text</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">accel_marker</parameter><initializer>u'\x00'</initializer></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter
role="keyword">markup_text</parameter>&nbsp;:</term>
	  <listitem><simpara>a string containing the markup to
parse.</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter
role="keyword">accel_marker</parameter>&nbsp;:</term>
	  <listitem><simpara>the Unicode character that precedes an
accelerator, or u'\x00' for none</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a 3-tuple containing a <link
linkend="class-pangoattrlist"><classname>pango.AttrList</classname></link>,
the plain text in <parameter>markup_text</parameter>, and the first
accelerator character in the text.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <function>parse_markup</function>() function parses the text
specified by <parameter>markup_text</parameter> and returns a 3-tuple
containing a <link
linkend="class-pangoattrlist"><classname>pango.AttrList</classname></link>,
the plain text from <parameter>markup_text</parameter> and the first
accelerator character that is preceded by the Unicode character specified by
<parameter>accel_marker</parameter>. The returned accelerator character is a
Unicode character that may be u'\x00' if there is no accelerator
character.</para>

      <para>See the <link linkend="pango-markup-language">The Pango Markup
Language</link> reference for more information.</para>

      <para>The GError exception is raised if an error occurs while parsing
the markup text.</para>

    </refsect2>

  </refsect1>

</refentry>