TreeSortable#
Deprecated since version 4.10:
- There is no replacement for this interface. You should
use
SortListModelto wrap your list model instead
- class TreeSortable(*args, **kwargs)#
Implementations: ListStore, TreeModelSort, TreeStore
The interface for sortable models used by GtkTreeView
GtkTreeSortable is an interface to be implemented by tree models which
support sorting. The GtkTreeView uses the methods provided by this interface
to sort the model.
Methods#
- class TreeSortable
- get_sort_column_id() tuple[bool, int, SortType]#
Fills in
sort_column_idandorderwith the current sort column and the order. It returnsTrueunless thesort_column_idisTREE_SORTABLE_DEFAULT_SORT_COLUMN_IDorTREE_SORTABLE_UNSORTED_SORT_COLUMN_ID.Deprecated since version 4.10: Please do not use it in newly written code
- has_default_sort_func() bool#
Returns
Trueif the model has a default sort function. This is used primarily by GtkTreeViewColumns in order to determine if a model can go back to the default state, or not.Deprecated since version 4.10: Please do not use it in newly written code
- set_default_sort_func(sort_func, user_data=None)#
Sets the default comparison function used when sorting to be
sort_func. If the current sort column id ofsortableisTREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, then the model will sort using this function.If
sort_funcisNone, then there will be no default comparison function. This means that once the model has been sorted, it can’t go back to the default state. In this case, when the current sort column id ofsortableisTREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, the model will be unsorted.Deprecated since version 4.10: Please do not use it in newly written code
- Parameters:
sort_func – The comparison function
user_data – User data to pass to
sort_func
- set_sort_column_id(sort_column_id: int, order: SortType) None#
Sets the current sort column to be
sort_column_id. Thesortablewill resort itself to reflect this change, after emitting aGtkTreeSortable::sort-column-changedsignal.sort_column_idmay either be a regular column id, or one of the following special values:TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID: the default sort function will be used, if it is setTREE_SORTABLE_UNSORTED_SORT_COLUMN_ID: no sorting will occur
Deprecated since version 4.10: Please do not use it in newly written code
- Parameters:
sort_column_id – the sort column id to set
order – The sort order of the column
- set_sort_func(sort_column_id, sort_func, user_data=None)#
Sets the comparison function used when sorting to be
sort_func. If the current sort column id ofsortableis the same assort_column_id, then the model will sort using this function.Deprecated since version 4.10: Please do not use it in newly written code
- Parameters:
sort_column_id – the sort column id to set the function for
sort_func – The comparison function
user_data – User data to pass to
sort_func
Signals#
Virtual Methods#
- class TreeSortable
- do_get_sort_column_id() tuple[bool, int, SortType]#
Fills in
sort_column_idandorderwith the current sort column and the order. It returnsTrueunless thesort_column_idisTREE_SORTABLE_DEFAULT_SORT_COLUMN_IDorTREE_SORTABLE_UNSORTED_SORT_COLUMN_ID.Deprecated since version 4.10: Please do not use it in newly written code
- do_has_default_sort_func() bool#
Returns
Trueif the model has a default sort function. This is used primarily by GtkTreeViewColumns in order to determine if a model can go back to the default state, or not.Deprecated since version 4.10: Please do not use it in newly written code
- do_set_default_sort_func(sort_func: Callable[[TreeModel, TreeIter, TreeIter, Any], int], user_data: Any = None) None#
Sets the default comparison function used when sorting to be
sort_func. If the current sort column id ofsortableisTREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, then the model will sort using this function.If
sort_funcisNone, then there will be no default comparison function. This means that once the model has been sorted, it can’t go back to the default state. In this case, when the current sort column id ofsortableisTREE_SORTABLE_DEFAULT_SORT_COLUMN_ID, the model will be unsorted.Deprecated since version 4.10: Please do not use it in newly written code
- Parameters:
sort_func – The comparison function
user_data – User data to pass to
sort_func
- do_set_sort_column_id(sort_column_id: int, order: SortType) None#
Sets the current sort column to be
sort_column_id. Thesortablewill resort itself to reflect this change, after emitting aGtkTreeSortable::sort-column-changedsignal.sort_column_idmay either be a regular column id, or one of the following special values:TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID: the default sort function will be used, if it is setTREE_SORTABLE_UNSORTED_SORT_COLUMN_ID: no sorting will occur
Deprecated since version 4.10: Please do not use it in newly written code
- Parameters:
sort_column_id – the sort column id to set
order – The sort order of the column
- do_set_sort_func(sort_column_id: int, sort_func: Callable[[TreeModel, TreeIter, TreeIter, Any], int], user_data: Any = None) None#
Sets the comparison function used when sorting to be
sort_func. If the current sort column id ofsortableis the same assort_column_id, then the model will sort using this function.Deprecated since version 4.10: Please do not use it in newly written code
- Parameters:
sort_column_id – the sort column id to set the function for
sort_func – The comparison function
user_data – User data to pass to
sort_func