Dazzle.TreeNode

g Dazzle.TreeNode Dazzle.TreeNode GObject.InitiallyUnowned GObject.InitiallyUnowned GObject.InitiallyUnowned->Dazzle.TreeNode GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

add_emblem (emblem_name)

append (child)

clear_emblems ()

collapse ()

expand (expand_ancestors)

get_area (area)

get_children_possible ()

get_expanded ()

get_foreground_rgba ()

get_gicon ()

get_icon_name ()

get_item ()

get_iter (iter)

get_parent ()

get_path ()

get_reset_on_collapse ()

get_text ()

get_tree ()

get_use_dim_label ()

get_use_markup ()

has_emblem (emblem_name)

insert (child, position)

insert_sorted (child, compare_func, *user_data)

invalidate ()

is_root ()

n_children ()

nth_child (nth)

prepend (child)

rebuild ()

remove (child)

remove_emblem (emblem_name)

select ()

set_children_possible (children_possible)

set_emblems (emblems)

set_foreground_rgba (foreground_rgba)

set_gicon (icon)

set_icon_name (icon_name)

set_item (item)

set_reset_on_collapse (reset_on_collapse)

set_text (text)

set_use_dim_label (use_dim_label)

set_use_markup (use_markup)

show_popover (popover)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

children-possible

bool

r/w

Allows for lazy creation of children nodes.

expanded-icon-name

str

r/w

The icon-name to use when the row is expanded

gicon

Gio.Icon

r/w/en

The Gio.Icon object

icon-name

str

r/w/en

The icon name to display.

item

GObject.Object

r/w/en

Optional object to associate with node.

parent

Dazzle.TreeNode

r

The parent node.

reset-on-collapse

bool

r/w/en

Reset by clearing children on collapse, requiring a rebuild on next expand

text

str

r/w/en

The text of the node.

tree

Dazzle.Tree

r/w

The Dazzle.Tree the node belongs to.

use-dim-label

bool

r/w/en

If text should be rendered with a dim label.

use-markup

bool

r/w/en

If text should be translated as markup.

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class Dazzle.TreeNode(**kwargs)
Bases:

GObject.InitiallyUnowned

Abstract:

No

Structure:

Dazzle.TreeNodeClass

classmethod new()
Returns:

A Dazzle.TreeNode

Return type:

Dazzle.TreeNode

Creates a new Dazzle.TreeNode instance. This is handy for situations where you do not want to subclass Dazzle.TreeNode.

add_emblem(emblem_name)
Parameters:

emblem_name (str) – the icon-name of the emblem

Adds an emplem to be rendered on top of the node.

Use Dazzle.TreeNode.remove_emblem() to remove an emblem.

append(child)
Parameters:

child (Dazzle.TreeNode) – A Dazzle.TreeNode.

Appends child to the list of children owned by self.

clear_emblems()

Removes all emblems from self.

collapse()
expand(expand_ancestors)
Parameters:

expand_ancestors (bool) –

Return type:

bool

get_area(area)
Parameters:

area (Gdk.Rectangle) –

get_children_possible()
Return type:

bool

get_expanded()
Return type:

bool

get_foreground_rgba()
Returns:

A Gdk.RGBA or None

Return type:

Gdk.RGBA or None

Gets the foreground-rgba to use for row text.

If None, the default foreground color should be used.

New in version 3.28.

get_gicon()
Returns:

An Gio.Icon or None.

Return type:

Gio.Icon

Fetch the Gio.Icon, re-render if necessary

get_icon_name()
Return type:

str

Fetches the icon-name of the icon to display, or None for no icon.

get_item()
Returns:

A GObject.Object or None.

Return type:

GObject.Object

Gets a GObject.Object for the node, if one was set.

get_iter(iter)
Parameters:

iter (Gtk.TreeIter) –

Return type:

bool

get_parent()
Returns:

A Dazzle.TreeNode.

Return type:

Dazzle.TreeNode

Retrieves the parent Dazzle.TreeNode for self.

get_path()
Returns:

A Gtk.TreePath if successful; otherwise None.

Return type:

Gtk.TreePath or None

Gets a Gtk.TreePath for self.

get_reset_on_collapse()
Return type:

bool

get_text()
Return type:

str

get_tree()
Returns:

A Dazzle.Tree.

Return type:

Dazzle.Tree

Fetches the Dazzle.Tree instance that owns the node.

get_use_dim_label()
Return type:

bool

get_use_markup()
Return type:

bool

has_emblem(emblem_name)
Parameters:

emblem_name (str) – a string containing the emblem name

Returns:

True if emblem_name is used by self

Return type:

bool

Checks to see if emblem_name has been added to the Dazzle.TreeNode.

insert(child, position)
Parameters:

Inserts child as a child of self at position.

New in version 3.28.

insert_sorted(child, compare_func, *user_data)
Parameters:

Inserts a child as a child of self, sorting it among the other children.

invalidate()
is_root()
Return type:

bool

n_children()
Return type:

int

nth_child(nth)
Parameters:

nth (int) – the index of the child

Returns:

a Dazzle.TreeNode or None

Return type:

Dazzle.TreeNode or None

Gets the nth child of self or None if it does not exist.

prepend(child)
Parameters:

child (Dazzle.TreeNode) – A Dazzle.TreeNode.

Prepends child to the list of children owned by self.

rebuild()

Rebuilds a node, without invalidating children nodes. If you want to ensure that children are also rebuilt, use Dazzle.TreeNode.invalidate().

New in version 3.28.

remove(child)
Parameters:

child (Dazzle.TreeNode) – A Dazzle.TreeNode.

Removes child from the list of children owned by self.

remove_emblem(emblem_name)
Parameters:

emblem_name (str) –

select()
set_children_possible(children_possible)
Parameters:

children_possible (bool) – If the node has children.

If the node has not yet been built, setting this to True will add a dummy child node. This dummy node will be removed when when the node is built by the registered Dazzle.TreeBuilder instances.

set_emblems(emblems)
Parameters:

emblems (str) –

set_foreground_rgba(foreground_rgba)
Parameters:

foreground_rgba (Gdk.RGBA or None) – A Gdk.RGBA or None

Sets the foreground-rgba to be used by the row text.

If foreground_rgba is None, the value is reset to the default.

New in version 3.28.

set_gicon(icon)
Parameters:

icon (Gio.Icon) –

set_icon_name(icon_name)
Parameters:

icon_name (str or None) – The icon name.

Sets the icon name of the node. This is displayed in the pixbuf cell of the Dazzle.Tree.

set_item(item)
Parameters:

item (GObject.Object) – A GObject.Object.

An optional object to associate with the node. This is handy to save needing to subclass the Dazzle.TreeNode class.

set_reset_on_collapse(reset_on_collapse)
Parameters:

reset_on_collapse (bool) –

set_text(text)
Parameters:

text (str or None) – The node text.

Sets the text of the node. This is displayed in the text cell of the Dazzle.Tree.

set_use_dim_label(use_dim_label)
Parameters:

use_dim_label (bool) –

set_use_markup(use_markup)
Parameters:

use_markup (bool) –

show_popover(popover)
Parameters:

popover (Gtk.Popover) –

Property Details

Dazzle.TreeNode.props.children_possible
Name:

children-possible

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE

This property allows for more lazy loading of nodes.

When a node becomes visible, we normally build its children nodes so that we know if we need an expansion arrow. However, that can be expensive when rendering directories with lots of subdirectories.

Using this, you can always show an arrow without building the children and simply hide the arrow if there were in fact no children (upon expansion).

Dazzle.TreeNode.props.expanded_icon_name
Name:

expanded-icon-name

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE

The icon-name to use when the row is expanded

Dazzle.TreeNode.props.gicon
Name:

gicon

Type:

Gio.Icon

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The cached Gio.Icon to display.

Dazzle.TreeNode.props.icon_name
Name:

icon-name

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

An icon-name to display on the row.

Dazzle.TreeNode.props.item
Name:

item

Type:

GObject.Object

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

An optional GObject.Object to associate with the node.

Dazzle.TreeNode.props.parent
Name:

parent

Type:

Dazzle.TreeNode

Default Value:

None

Flags:

READABLE

The parent of the node.

Dazzle.TreeNode.props.reset_on_collapse
Name:

reset-on-collapse

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The “reset-on-collapse” property denotes that all children should be removed from the node when it’s row is collapsed. It will also set Dazzle.TreeNode :needs-build to True so the next expansion rebuilds the children. This is useful for situations where you want to ensure the nodes are up to date (refreshed) on every expansion.

New in version 3.28.

Dazzle.TreeNode.props.text
Name:

text

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Text to display on the tree node.

Dazzle.TreeNode.props.tree
Name:

tree

Type:

Dazzle.Tree

Default Value:

None

Flags:

READABLE, WRITABLE

The tree the node belongs to.

Dazzle.TreeNode.props.use_dim_label
Name:

use-dim-label

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

If text should be rendered with a dim label.

Dazzle.TreeNode.props.use_markup
Name:

use-markup

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

If the “text” property includes #GMarkup.