Base class for all sorters.
Abstract base class for all sorters.
sort(widget, parent, nodes)¶
Sorts a list of nodes IN PLACE.
‘widget’ is the widget that we are sorting nodes for. ‘parent’ is the parent node. ‘nodes’ is the list of nodes to sort.
Returns the list that was sorted IN PLACE (for convenience).
key(widget, parent, node)¶
category(widget, parent, node)¶
Returns the category (an integer) for an node.
‘parent’ is the parent node. ‘nodes’ is the node to return the category for.
Categories are used to sort nodes into bins. The bins are arranged in ascending numeric order. The nodes within a bin are arranged as dictated by the sorter’s ‘compare’ method.
By default all nodes are given the same category (0).
Is the sorter affected by changes to a node’s trait?
‘node’ is the node. ‘trait_name’ is the name of the trait.
Returns True if the sorter would be affected by changes to the trait named ‘trait_name’ on the specified node.
By default we return False.