Skip to content

Gtk.CustomSorter

class — extends Sorter

Sorts items via a callback function.

Constructors

new

@classmethod
def new(cls, sort_func: GLib.CompareDataFunc | None = ...) -> CustomSorter

Creates a new GtkSorter that works by calling sort_func to compare items.

If sort_func is None, all items are considered equal.

Parameters:

  • sort_func — the GCompareDataFunc to use for sorting

Methods

set_sort_func

def set_sort_func(self, sort_func: GLib.CompareDataFunc | None = ...) -> None

Sets (or unsets) the function used for sorting items.

If sort_func is None, all items are considered equal.

If the sort func changes its sorting behavior, Sorter.changed needs to be called.

If a previous function was set, its user_destroy will be called now.

Parameters:

  • sort_func — function to sort items