pyface.tree.node_type module

The base class for all node types.

class pyface.tree.node_type.NodeType[source]

Bases: HasPrivateTraits

The base class for all node types.

DOCUMENT = <pyface.ui.qt.image_resource.ImageResource object>
CLOSED_FOLDER = <pyface.ui.qt.image_resource.ImageResource object>
OPEN_FOLDER = <pyface.ui.qt.image_resource.ImageResource object>
is_type_for(node)[source]

Returns True if a node is deemed to be of this type.

allows_children(node)[source]

Does the node allow children (ie. a folder vs a file).

get_actions(node)[source]

Returns the node-specific actions for a node.

get_context_menu(node)[source]

Returns the context menu for a node.

get_copy_value(node)[source]

Get the value that is copied for a node.

By default, returns the node itself.

get_default_action(node)[source]

Returns the default action for a node.

get_new_actions(node)[source]

Returns the new actions for a node.

get_paste_value(node)[source]

Get the value that is pasted for a node.

By default, returns the node itself.

get_monitor(node)[source]

Returns a monitor that detects changes to a node.

Returns None by default, which indicates that the node is not monitored.

has_children(node)[source]

Returns True if a node has children, otherwise False.

You only need to implement this method if children are allowed for the node (ie. ‘allows_children’ returns True).

get_children(node)[source]

Returns the children of a node.

You only need to implement this method if children are allowed for the node.

get_drag_value(node)[source]

Get the value that is dragged for a node.

By default, returns the node itself.

can_drop(node, data)[source]

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

drop(obj, data)[source]

Drops an object onto a node.

get_image(node, selected, expanded)[source]

Returns the label image 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.

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 draggablee, otherwise False.

can_rename(node)[source]

Returns True if the node can be renamed, 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.

DEPRECATED: Use ‘can_rename’.

is_expandable(node)[source]

Returns True if the node is expandanble, otherwise False.