pyface.tree.node_tree_model module

The model for a tree control with extensible node types.

class pyface.tree.node_tree_model.NodeTreeModel[source]

Bases: TreeModel

The model for a tree control with extensible node types.

has_children(node)[source]

Returns True if a node has children, otherwise False.

This method is provided in case the model has an efficient way to determine whether or not a node has any children without having to actually get the children themselves.

get_children(node)[source]

Returns the children of a node.

get_default_action(node)[source]

Returns the default action for a node.

get_drag_value(node)[source]

Get the value that is dragged for a node.

By default the drag value is the node itself.

can_drop(node, data)[source]

Returns True if a node allows an object to be dropped onto it.

drop(node, data)[source]

Drops an object onto a node.

get_image(node, selected, expanded)[source]

Returns the label image for a node.

Return None (the default) if no image is required.

get_key(node)[source]

Generate a unique key for a node.

get_selection_value(node)[source]

Get the value that is used when a node is selected.

By default the selection value is the node itself.

get_text(node)[source]

Returns the label text for a node.

Return None if no text is required. By default we return ‘str(node)’.

can_set_text(node, text)[source]

Returns True if the node’s label can be set.

set_text(node, text)[source]

Sets the label text for a node.

is_collapsible(node)[source]

Returns True if the node is collapsible, otherwise False.

is_draggable(node)[source]

Returns True if the node is draggable, otherwise False.

is_editable(node)[source]

Returns True if the node is editable, otherwise False.

If the node is editable, its text can be set via the UI.

is_expandable(node)[source]

Returns True if the node is expandanble, otherwise False.

add_listener(node)[source]

Adds a listener for changes to a node.

remove_listener(node)[source]

Removes a listener for changes to a node.

get_context_menu(node)[source]

Returns the context menu for a node.