exopy.utils.widgets.tree_nodes module¶
Declarative node for tree node generation.
-
class
exopy.utils.widgets.tree_nodes.
TreeNode
(parent=None, **kwargs)[source]¶ Bases:
enaml.core.declarative.Declarative
Represents a tree node.
This declaration is used to help the system determine how to extract informations from the underlying object to populate the node.
Note that a Menu can be contributed as a child and will be used when right clicking a node. It will be passed a ‘context’ describing the node being right-clicked.
The context will be a dictionary with the following keys : - ‘copyable’: bool, can the node be copied - ‘cutable’: bool, can the node be cut - ‘pasteable’: bool, can node be pasted here - ‘renamable’: bool, can the node be renamed - ‘deletable’: bool, can the node be deleted - ‘not_root’: bool, is the node the root node of the tree - ‘data’: tuple, (tree, TreeNode instance, object, id of the node)
-
node_for
¶ List of object classes and/or interfaces that the node applies to
-
label
¶ Either the name of a member containing a label, or a constant label, if the string starts with ‘=’.
-
tooltip
¶ Either the name of a member containing a tooltip, or constant tooltip, if the string starts with ‘=’.
-
children_member
¶ Name of the member containing children (if ‘’, the node is a leaf).
-
children_changed
¶ Name of the signal use to notify changes to the children. The payload of the signal should be a ContainerChange instance.
-
add
¶ List of object classes than can be added or copied
-
move
¶ List of object classes that can be moved
-
name
¶ Name to use for a new instance
-
rename
¶ Can the object’s children be renamed?
-
rename_me
¶ Can the object be renamed?
-
copy
¶ Can the object’s children be copied?
-
delete
¶ Can the object’s children be deleted?
-
delete_me
¶ Can the object be deleted (if its parent allows it)?
-
insert
¶ Can children be inserted (vs. appended)?
-
auto_open
¶ Should tree nodes be automatically opened (expanded)?
-
auto_close
¶ Automatically close sibling tree nodes?
-
node_for_class
¶ Tuple of object classes that the node applies to
-
icon_item
¶ Name of leaf item icon
-
icon_group
¶ Name of group item icon
-
icon_open
¶ Name of opened group item icon
-
icon_path
¶ Resource path used to locate the node icon
-
background
¶ Selector or name for background color
-
foreground
¶ Selector or name for foreground color
-
confirm_delete
(obj)[source]¶ Checks whether a specified object can be deleted.
- Returns
- **True* if the object should be deleted with no further prompting.*
- **False* if the object should not be deleted.*
- Anything else (
Caller should take its default action (which might
) – include prompting the user to confirm deletion).
-
enter_rename
(obj)[source]¶ Start renaming an object.
This method can be customized in case the renaming operation should not occur directly on the label.
- Parameters
obj – Refrence to the object the tree node being renamed is representing.
- Returns
name – String on which to perform the renaming.
- Return type
unicode
-
get_name
(obj)[source]¶ Returns the name to use when adding a new object instance (displayed in the “New” submenu).
Returns the right-click context menu for an object.
-