Skip to content

Gtk.MultiSorter

class — extends Sorter, Gio.ListModel, Buildable

Combines multiple sorters by trying them in turn.

If the first sorter compares two items as equal, the second is tried next, and so on.

Constructors

new

@classmethod
def new(cls) -> MultiSorter

Creates a new multi sorter.

This sorter compares items by trying each of the sorters in turn, until one returns non-zero. In particular, if no sorter has been added to it, it will always compare items as equal.

Methods

append

def append(self, sorter: Sorter) -> None

Add sorter to self to use for sorting at the end.

self will consult all existing sorters before it will sort with the given sorter.

Parameters:

  • sorter — a sorter to add

remove

def remove(self, position: int) -> None

Removes the sorter at the given position from the list of sorter used by self.

If position is larger than the number of sorters, nothing happens.

Parameters:

  • position — position of sorter to remove

Properties

item_type

item_type: type | GObject.Type  # read-only

The type of items. See Gio.ListModel.get_item_type.

n_items

n_items: int  # read-only

The number of items. See Gio.ListModel.get_n_items.