Gtk.NumericSorter

g GObject.Object GObject.Object Gtk.Sorter Gtk.Sorter GObject.Object->Gtk.Sorter Gtk.NumericSorter Gtk.NumericSorter Gtk.Sorter->Gtk.NumericSorter

Subclasses:

None

Methods

Inherited:

Gtk.Sorter (3), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (expression)

get_expression ()

get_sort_order ()

set_expression (expression)

set_sort_order (sort_order)

Virtual Methods

Inherited:

Gtk.Sorter (2), GObject.Object (7)

Properties

Name

Type

Flags

Short Description

expression

Gtk.Expression

r/w/en

sort-order

Gtk.SortType

r/w/en

Signals

Inherited:

Gtk.Sorter (1), GObject.Object (1)

Fields

Inherited:

Gtk.Sorter (1), GObject.Object (1)

Class Details

class Gtk.NumericSorter(**kwargs)
Bases:

Gtk.Sorter

Abstract:

No

Structure:

Gtk.NumericSorterClass

GtkNumericSorter is a GtkSorter that compares numbers.

To obtain the numbers to compare, this sorter evaluates a [class`Gtk`.Expression].

classmethod new(expression)[source]
Parameters:

expression (Gtk.Expression or None) – The expression to evaluate

Returns:

a new GtkNumericSorter

Return type:

Gtk.NumericSorter

Creates a new numeric sorter using the given expression.

Smaller numbers will be sorted first. You can call [method`Gtk`.NumericSorter.set_sort_order] to change this.

get_expression()[source]
Returns:

a GtkExpression

Return type:

Gtk.Expression or None

Gets the expression that is evaluated to obtain numbers from items.

get_sort_order()[source]
Returns:

the order of the numbers

Return type:

Gtk.SortType

Gets whether this sorter will sort smaller numbers first.

set_expression(expression)[source]
Parameters:

expression (Gtk.Expression or None) – a GtkExpression

Sets the expression that is evaluated to obtain numbers from items.

Unless an expression is set on self, the sorter will always compare items as invalid.

The expression must have a return type that can be compared numerically, such as GObject.TYPE_INT or GObject.TYPE_DOUBLE.

set_sort_order(sort_order)[source]
Parameters:

sort_order (Gtk.SortType) – whether to sort smaller numbers first

Sets whether to sort smaller numbers before larger ones.

Property Details

Gtk.NumericSorter.props.expression
Name:

expression

Type:

Gtk.Expression

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The expression to evaluate on items to get a number to compare with.

Gtk.NumericSorter.props.sort_order
Name:

sort-order

Type:

Gtk.SortType

Default Value:

Gtk.SortType.ASCENDING

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the sorter will sort smaller numbers first.