Gtk.Buildable

g GObject.GInterface GObject.GInterface Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable

Implementations:

Gtk.Action, Gtk.ActionGroup, Gtk.CellArea, Gtk.EntryCompletion, Gtk.FileFilter, Gtk.IconFactory, Gtk.ListStore, Gtk.RecentFilter, Gtk.SizeGroup, Gtk.TextTagTable, Gtk.TreeStore, Gtk.TreeViewColumn, Gtk.UIManager, Gtk.Widget

Methods

add_child (builder, child, type)

construct_child (builder, name)

custom_finished (builder, child, tagname, data)

custom_tag_end (builder, child, tagname, data)

custom_tag_start (builder, child, tagname)

get_internal_child (builder, childname)

get_name ()

parser_finished (builder)

set_buildable_property (builder, name, value)

set_name (name)

Virtual Methods

do_add_child (builder, child, type)

do_construct_child (builder, name)

do_custom_finished (builder, child, tagname, data)

do_custom_tag_end (builder, child, tagname, data)

do_custom_tag_start (builder, child, tagname)

do_get_internal_child (builder, childname)

do_get_name ()

do_parser_finished (builder)

do_set_buildable_property (builder, name, value)

do_set_name (name)

Properties

None

Signals

None

Fields

None

Class Details

class Gtk.Buildable
Bases:

GObject.GInterface

Structure:

Gtk.BuildableIface

Gtk.Buildable allows objects to extend and customize their deserialization from GtkBuilder UI descriptions. The interface includes methods for setting names and properties of objects, parsing custom tags and constructing child objects.

The Gtk.Buildable interface is implemented by all widgets and many of the non-widget objects that are provided by GTK+. The main user of this interface is Gtk.Builder. There should be very little need for applications to call any of these functions directly.

An object only needs to implement this interface if it needs to extend the Gtk.Builder format or run any extra routines at deserialization time.

add_child(builder, child, type)[source]
Parameters:

Adds a child to self. type is an optional string describing how the child should be added.

New in version 2.12.

construct_child(builder, name)[source]
Parameters:
Returns:

the constructed child

Return type:

GObject.Object

Constructs a child of self with the name name.

Gtk.Builder calls this function if a “constructor” has been specified in the UI definition.

New in version 2.12.

custom_finished(builder, child, tagname, data)[source]
Parameters:

This is similar to Gtk.Buildable.parser_finished() but is called once for each custom tag handled by the self.

New in version 2.12.

custom_tag_end(builder, child, tagname, data)[source]
Parameters:

This is called at the end of each custom element handled by the buildable.

New in version 2.12.

custom_tag_start(builder, child, tagname)[source]
Parameters:
Returns:

True if a object has a custom implementation, False if it doesn’t.

parser:

a GLib.MarkupParser to fill in

data:

return location for user data that will be passed in to parser functions

Return type:

(bool, parser: GLib.MarkupParser, data: object)

This is called for each unknown element under <child>.

New in version 2.12.

get_internal_child(builder, childname)[source]
Parameters:
Returns:

the internal child of the buildable object

Return type:

GObject.Object

Get the internal child called childname of the self object.

New in version 2.12.

get_name()[source]
Returns:

the name set with Gtk.Buildable.set_name()

Return type:

str

Gets the name of the self object.

Gtk.Builder sets the name based on the GtkBuilder UI definition used to construct the self.

New in version 2.12.

parser_finished(builder)[source]
Parameters:

builder (Gtk.Builder) – a Gtk.Builder

Called when the builder finishes the parsing of a GtkBuilder UI definition. Note that this will be called once for each time Gtk.Builder.add_from_file() or Gtk.Builder.add_from_string() is called on a builder.

New in version 2.12.

set_buildable_property(builder, name, value)[source]
Parameters:

Sets the property name name to value on the self object.

New in version 2.12.

set_name(name)[source]
Parameters:

name (str) – name to set

Sets the name of the self object.

New in version 2.12.

do_add_child(builder, child, type) virtual
Parameters:

Adds a child to buildable. type is an optional string describing how the child should be added.

New in version 2.12.

do_construct_child(builder, name) virtual
Parameters:
Returns:

the constructed child

Return type:

GObject.Object

Constructs a child of buildable with the name name.

Gtk.Builder calls this function if a “constructor” has been specified in the UI definition.

New in version 2.12.

do_custom_finished(builder, child, tagname, data) virtual
Parameters:

This is similar to Gtk.Buildable.parser_finished() but is called once for each custom tag handled by the buildable.

New in version 2.12.

do_custom_tag_end(builder, child, tagname, data) virtual
Parameters:

This is called at the end of each custom element handled by the buildable.

New in version 2.12.

do_custom_tag_start(builder, child, tagname) virtual
Parameters:
Returns:

True if a object has a custom implementation, False if it doesn’t.

parser:

a GLib.MarkupParser to fill in

data:

return location for user data that will be passed in to parser functions

Return type:

(bool, parser: GLib.MarkupParser, data: object)

This is called for each unknown element under <child>.

New in version 2.12.

do_get_internal_child(builder, childname) virtual
Parameters:
Returns:

the internal child of the buildable object

Return type:

GObject.Object

Get the internal child called childname of the buildable object.

New in version 2.12.

do_get_name() virtual
Returns:

the name set with Gtk.Buildable.set_name()

Return type:

str

Gets the name of the buildable object.

Gtk.Builder sets the name based on the GtkBuilder UI definition used to construct the buildable.

New in version 2.12.

do_parser_finished(builder) virtual
Parameters:

builder (Gtk.Builder) – a Gtk.Builder

Called when the builder finishes the parsing of a GtkBuilder UI definition. Note that this will be called once for each time Gtk.Builder.add_from_file() or Gtk.Builder.add_from_string() is called on a builder.

New in version 2.12.

do_set_buildable_property(builder, name, value) virtual
Parameters:

Sets the property name name to value on the buildable object.

New in version 2.12.

do_set_name(name) virtual
Parameters:

name (str) – name to set

Sets the name of the buildable object.

New in version 2.12.