IBus.Text

g GObject.InitiallyUnowned GObject.InitiallyUnowned IBus.Object IBus.Object GObject.InitiallyUnowned->IBus.Object GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned IBus.Serializable IBus.Serializable IBus.Object->IBus.Serializable IBus.Text IBus.Text IBus.Serializable->IBus.Text

Subclasses:

None

Methods

Inherited:

IBus.Serializable (7), IBus.Object (2), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new_from_string (str)

class

new_from_ucs4 (str)

class

new_from_unichar (c)

append_attribute (type, value, start_index, end_index)

get_attributes ()

get_length ()

get_text ()

set_attributes (attrs)

Virtual Methods

Inherited:

IBus.Serializable (3), IBus.Object (1), GObject.Object (7)

Properties

None

Signals

Inherited:

IBus.Object (1), GObject.Object (1)

Fields

Inherited:

IBus.Object (1), GObject.Object (1)

Name

Type

Access

Description

attrs

IBus.AttrList

r

Associated IBusAttributes.

is_static

bool

r

Whether text is static, i.e., no need and will not be freed. Only True if IBus.Text is newed from ibus_text_new_from_static_string().

parent

IBus.Serializable

r

text

str

r

The string content of IBus.Text in UTF-8.

Class Details

class IBus.Text(**kwargs)
Bases:

IBus.Serializable

Abstract:

No

Structure:

IBus.TextClass

An IBus.Text is the main text object in IBus. The text is decorated according to associated IBus.Attribute, e.g. the foreground/background color, underline, and applied scope.

see_also: IBus.Attribute

classmethod new_from_string(str)
Parameters:

str (str) – An text string to be set.

Returns:

A newly allocated IBus.Text.

Return type:

IBus.Text

Creates a new IBus.Text from a string. str will be duplicated in IBus.Text, so feel free to free str after this function.

classmethod new_from_ucs4(str)
Parameters:

str (str) – An text string to be set.

Returns:

A newly allocated IBus.Text.

Return type:

IBus.Text

Creates a new IBus.Text from an UCS-4 encoded string. str will be duplicated in IBus.Text, so feel free to free str after this function.

classmethod new_from_unichar(c)
Parameters:

c (str) – A single UCS4-encoded character.

Returns:

A newly allocated IBus.Text.

Return type:

IBus.Text

Creates a new IBus.Text from a single UCS4-encoded character.

append_attribute(type, value, start_index, end_index)
Parameters:
  • type (int) – IBusAttributeType for self.

  • value (int) – Value for the type.

  • start_index (int) – The starting index, inclusive.

  • end_index (int) – The ending index, exclusive.

Append an IBus.Attribute for IBus.Text.

get_attributes()
Returns:

the attrs in self.

Return type:

IBus.AttrList

Return the attributes in an IBus.Text. Should not be freed.

get_length()
Returns:

Number of character in self, not counted by bytes.

Return type:

int

Return number of characters in an IBus.Text. This function is based on GLib.utf8_strlen(), so unlike strlen(), it does not count by bytes but characters instead.

get_text()
Returns:

the text in self.

Return type:

str

Return the text in an IBus.Text. Should not be freed.

set_attributes(attrs)
Parameters:

attrs (IBus.AttrList) – An IBus.AttrList