pango.AttrList — an object holding attributes that apply to a section of text
class pango.AttrList(gobject.GBoxed): |
Functions
def pango.parse_markup(markup_text
, accel_marker
=u'\x00')
The pango.AttrList
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 change
()
method, the overlap between properties will meet stricter criteria. Since
the pango.AttrList
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 pango.AttrList
for more than one paragraph of text.
pango.AttrList()
Returns : | a new pango.AttrList
object. |
Creates a new pango.AttrList
object.
def copy()
Returns : | a new pango.AttrList
object |
The copy
() method returns
a new pango.AttrList
object that is a copy of the attribute list
def insert(attr
)
| the pango.Attribute
to insert. |
The insert
() method
inserts the pango.Attribute
specified by attr
into the attribute list. It will be
inserted after all other attributes with a matching "start_index".
def insert_before(attr
)
| the pango.Attribute
to insert. |
The insert_before
()
method inserts the pango.Attribute
specified by attr into the attribute list. It will be inserted before all
other attributes with a matching "start_index".
def change(attr
)
| the pango.Attribute
to insert. |
The change
() method
inserts the pango.Attribute
specified by attr
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
insert()
method for creating an attribute list in order (potentially much slower for
large lists). However, the insert()
method is not suitable for continually changing a set of attributes since it
never removes or combines existing attributes.
def splice(other
, pos
, len
)
| another pango.AttrList |
| the position in this attribute list to insert
other |
| the length of the spliced segment. (Note that
this must be specified since the attributes in other
may only be present at some subsection of this range) |
The splice
() method
splices the pango.AttrList
specified by other
into this attribute list. This
method stretches each attribute with a range including the position
specified by pos
in the list by the amount specified
by len
, and then calls the change
()
method with a copy of each attribute in other
in
sequence (offset in position by pos
).
def get_iterator()
Returns : | a new pango.AttrIterator . |
The get_iterator
() method creates and
returns a pango.AttrIterator
initialized to the beginning of the attribute list.
def filter(func
, data
=None)
| a callback function that returns
True if an attribute should be filtered
out. |
| data to be passed to
func |
Returns : | a new pango.AttrList
or None . |
This method is available in PyGTK 2.4 and above.
The filter
() method arranges for the
callback function specified by function
to be called
on each pango.Attribute
in the attribute list with the optional user data specified by
data
. The callback function signature is:
def func(attribute, user_data)
where attribute
is an attribute of the
attribute list and user_data
is
data
. The callback function returns
True
if the attribute should be filtered out of the
attribute list. The filter
method returns a new
pango.AttrList
containing the attributes that were filtered out (removed from) the
attribute list.
def pango.parse_markup(markup_text
, accel_marker
=u'\x00')
| a string containing the markup to parse. |
| the Unicode character that precedes an accelerator, or u'\x00' for none |
Returns : | a 3-tuple containing a pango.AttrList ,
the plain text in markup_text , and the first
accelerator character in the text. |
The parse_markup
() function parses the text
specified by markup_text
and returns a 3-tuple
containing a pango.AttrList
,
the plain text from markup_text
and the first
accelerator character that is preceded by the Unicode character specified by
accel_marker
. The returned accelerator character is a
Unicode character that may be u'\x00' if there is no accelerator
character.
See the The Pango Markup Language reference for more information.
The GError exception is raised if an error occurs while parsing the markup text.