Gtk.Buildable


Gtk.Buildable — Interface for objects that can be built by Gtk.Builder

Object Hierarchy:

    GInterface
    ╰── Gtk.Buildable

Functions:

  • set_name (self, name:str)
  • get_name (self) -> str
  • add_child (self, builder:Gtk.Builder, child:GObject.Object, type:str=None)
  • set_buildable_property (self, builder:Gtk.Builder, name:str, value:GObject.Value)
  • construct_child (self, builder:Gtk.Builder, name:str) -> GObject.Object
  • custom_tag_start (self, builder:Gtk.Builder, child:GObject.Object=None, tagname:str) -> bool, parser:GLib.MarkupParser, data
  • custom_tag_end (self, builder:Gtk.Builder, child:GObject.Object=None, tagname:str, data)
  • custom_finished (self, builder:Gtk.Builder, child:GObject.Object=None, tagname:str, data)
  • parser_finished (self, builder:Gtk.Builder)
  • get_internal_child (self, builder:Gtk.Builder, childname:str) -> GObject.Object

Description:

Gtk.Buildable allows objects to extend and customize their deserialization from [Gtk.Builder UI descriptions][BUILDER-UI].

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.


Function Details:

set_name()

set_name (self, name:str)

Sets the name of the buildable object.

  • Since: 2.12

get_name()

get_name (self) -> str

Gets the name of the buildable object. Gtk.Builder sets the name based on theGtk.Builder UI definition used to construct the buildable.

  • Returns: the name set with Gtk.Buildable:set_name()

  • Since: 2.12


add_child()

add_child (self, builder:Gtk.Builder, child:GObject.Object, type:str=None)

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

  • Since: 2.12

set_buildable_property()

set_buildable_property (self, builder:Gtk.Builder, name:str, value:GObject.Value)

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

  • Since: 2.12

construct_child()

construct_child (self, builder:Gtk.Builder, name:str) -> GObject.Object

Constructs a child of buildable with the name name. Gtk.Builder calls this function if a “constructor” has beenspecified in the UI definition.

  • Returns: the constructed child.

  • Since: 2.12


custom_tag_start()

custom_tag_start (self, builder:Gtk.Builder, child:GObject.Object=None, tagname:str) -> bool, parser:GLib.MarkupParser, data

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

  • Returns: True if a object has a custom implementation, FALSEif it doesn't.

  • Since: 2.12


custom_tag_end()

custom_tag_end (self, builder:Gtk.Builder, child:GObject.Object=None, tagname:str, data)

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

  • Since: 2.12

custom_finished()

custom_finished (self, builder:Gtk.Builder, child:GObject.Object=None, tagname:str, data)

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

  • Since: 2.12

parser_finished()

parser_finished (self, builder:Gtk.Builder)

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

  • Since: 2.12

get_internal_child()

get_internal_child (self, builder:Gtk.Builder, childname:str) -> GObject.Object

Get the internal child called childname of the buildable object.

  • Returns: the internal child of the buildable object.

  • Since: 2.12


results matching ""

    No results matching ""