Gtk.TreeSortable
Gtk.TreeSortable — The interface for sortable models used by Gtk.TreeView
Object Hierarchy:
GInterface
╰── Gtk.TreeSortable
See also:
Functions:
- sort_column_changed
(self)
- set_sort_column_id
(self, sort_column_id:int, order:Gtk.SortType)
- set_sort_func
(self, sort_column_id:int, sort_func:Gtk.TreeIterCompareFunc, user_data=None)
- set_default_sort_func
(self, sort_func:Gtk.TreeIterCompareFunc, user_data=None)
- has_default_sort_func
(self) -> bool
Description:
Gtk.TreeSortable
is an interface to be implemented by tree models which support sorting. The Gtk.TreeView uses the methods provided by this interface to sort the model.
Function Details:
sort_column_changed()
sort_column_changed (self)
Emits a “sort-column-changed” signal on sortable
.
set_sort_column_id()
set_sort_column_id (self, sort_column_id:int, order:Gtk.SortType)
Sets the current sort column to be sort_column_id
. The sortable
willresort itself to reflect this change, after emitting a“sort-column-changed” signal. sort_column_id
may either bea regular column id, or one of the following special values:
GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID
: the default sort functionwill be used, if it is set
GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID
: no sorting will occur
set_sort_func()
set_sort_func (self, sort_column_id:int, sort_func:Gtk.TreeIterCompareFunc, user_data=None)
Sets the comparison function used when sorting to be sort_func
. If thecurrent sort column id of sortable
is the same as sort_column_id
, then the model will sort using this function.
set_default_sort_func()
set_default_sort_func (self, sort_func:Gtk.TreeIterCompareFunc, user_data=None)
Sets the default comparison function used when sorting to be sort_func
. If the current sort column id of sortable
isGTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID
, then the model will sort using this function.
If sort_func
is None
, then there will be no default comparison function.This means that once the model has been sorted, it can’t go back to thedefault state. In this case, when the current sort column id of sortable
is GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID
, the model will be unsorted.
has_default_sort_func()
has_default_sort_func (self) -> bool
Returns True
if the model has a default sort function. This is usedprimarily by Gtk.TreeViewColumns
in order to determine if a model can go back to the default state, or not.
- Returns:
True
, if the model has a default sort function