Gda.TreeNode

g GObject.Object GObject.Object Gda.TreeNode Gda.TreeNode GObject.Object->Gda.TreeNode

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

error_quark ()

class

new (name)

fetch_attribute (attribute)

get_child_index (index)

get_child_name (name)

get_children ()

get_node_attribute (attribute)

get_parent ()

set_node_attribute (attribute, value, destroy)

Virtual Methods

Inherited:

GObject.Object (7)

do_dump_children (prefix, in_string)

do_dump_header ()

do_node_changed (node)

do_node_deleted (relative_path)

do_node_has_child_toggled (node)

do_node_inserted (node)

Properties

Name

Type

Flags

Short Description

name

str

r/w

Node’s name attribute

Signals

Inherited:

GObject.Object (1)

Name

Short Description

node-changed

Gets emitted when a node has changed

node-deleted

Gets emitted when a node has been removed

node-has-child-toggled

Gets emitted when a node has has a child when it did not have any or when it does not have a ny children anymore when it had some

node-inserted

Gets emitted when a node has been inserted

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

object

GObject.Object

r

Class Details

class Gda.TreeNode(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Gda.TreeNodeClass

classmethod error_quark()
Return type:

int

classmethod new(name)
Parameters:

name (str or None) – a name, or None

Returns:

a new Gda.TreeNode

Return type:

Gda.TreeNode

Creates a new Gda.TreeNode object

New in version 4.2.

fetch_attribute(attribute)
Parameters:

attribute (str) – attribute name as a string

Returns:

a read-only GObject.Value, or None if not attribute named attribute has been set for self

Return type:

GObject.Value

Get the value associated to the attribute named attribute for self. If the attribute is not set, then self's parents is queries (recursively up to the top level node).

Attributes can have any name, but Libgda proposes some default names, see ‘this section [libgda-40-Attributes-manager.synopsis]’.

New in version 4.2.

get_child_index(index)
Parameters:

index (int) – a index

Returns:

the Gda.TreeNode, or None if not found

Return type:

Gda.TreeNode

Get the Gda.TreeNode child of self at position index (starting at 0).

New in version 4.2.

get_child_name(name)
Parameters:

name (str) – requested node’s name

Returns:

the Gda.TreeNode, or None if not found

Return type:

Gda.TreeNode

Get the Gda.TreeNode child of self which has the Gda.ATTRIBUTE_NAME set to name

New in version 4.2.

get_children()
Returns:

a new GLib.SList of Gda.TreeNode objects, or None if self does not have any child

Return type:

[Gda.TreeNode]

Get a list of all self's children, free it with g_slist_free() after usage

New in version 4.2.

get_node_attribute(attribute)
Parameters:

attribute (str) – attribute name as a string

Returns:

a read-only GObject.Value, or None if not attribute named attribute has been set for self

Return type:

GObject.Value

Get the value associated to the attribute named attribute for self. The difference with Gda.TreeNode.fetch_attribute() is that Gda.TreeNode.fetch_attribute() will also query self's parents (recursively up to the top level node) if the attribute is not set for self.

Attributes can have any name, but Libgda proposes some default names, see ‘this section [libgda-40-Attributes-manager.synopsis]’.

New in version 4.2.

get_parent()
Returns:

the parent Gda.TreeNode

Return type:

Gda.TreeNode

Get the Gda.TreeNode parent of self in the Gda.Tree node belongs to. If self is at the top level, then this method return None.

New in version 4.2.

set_node_attribute(attribute, value, destroy)
Parameters:

Set the value associated to a named attribute. The attribute string is used AS IT IS by this method (eg. no copy of it is made), and the memory it uses will be freed using the destroy function when no longer needed (if destroy is None, then the string will not be freed at all).

Attributes can have any name, but Libgda proposes some default names, see ‘this section [libgda-40-Attributes-manager.synopsis]’.

For example one would use it as:

Gda.TreeNode.set_node_attribute (node, GLib.strdup (my_attribute), my_value, GLib.free); Gda.TreeNode.set_node_attribute (node, Gda.ATTRIBUTE_NAME, my_value, None);

If there is already an attribute named attribute set, then its value is replaced with the new value (value is copied), except if value is None, in which case the attribute is removed.

New in version 4.2.

do_dump_children(prefix, in_string) virtual
Parameters:
do_dump_header() virtual
Return type:

str

do_node_changed(node) virtual
Parameters:

node (Gda.TreeNode) –

do_node_deleted(relative_path) virtual
Parameters:

relative_path (str) –

do_node_has_child_toggled(node) virtual
Parameters:

node (Gda.TreeNode) –

do_node_inserted(node) virtual
Parameters:

node (Gda.TreeNode) –

Signal Details

Gda.TreeNode.signals.node_changed(tree_node, node)
Signal Name:

node-changed

Flags:

RUN_LAST

Parameters:

Gets emitted when a node has changed

New in version 4.2.

Gda.TreeNode.signals.node_deleted(tree_node, relative_path)
Signal Name:

node-deleted

Flags:

RUN_LAST

Parameters:
  • tree_node (Gda.TreeNode) – The object which received the signal

  • relative_path (str) – the path the node held, relative to reporting

Gets emitted when a node has been removed

New in version 4.2.

Gda.TreeNode.signals.node_has_child_toggled(tree_node, node)
Signal Name:

node-has-child-toggled

Flags:

RUN_LAST

Parameters:
  • tree_node (Gda.TreeNode) – The object which received the signal

  • node (Gda.TreeNode) – the Gda.TreeNode which changed from having children to being a leaf or the other way around

Gets emitted when a node has has a child when it did not have any or when it does not have a ny children anymore when it had some

New in version 4.2.

Gda.TreeNode.signals.node_inserted(tree_node, node)
Signal Name:

node-inserted

Flags:

RUN_LAST

Parameters:

Gets emitted when a node has been inserted

New in version 4.2.

Property Details

Gda.TreeNode.props.name
Name:

name

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

Node’s name attribute