Gtk.StringSorter

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

Subclasses:

None

Methods

Inherited:

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

Structs:

GObject.ObjectClass (5)

class

new (expression)

get_collation ()

get_expression ()

get_ignore_case ()

set_collation (collation)

set_expression (expression)

set_ignore_case (ignore_case)

Virtual Methods

Inherited:

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

Properties

Name

Type

Flags

Short Description

collation

Gtk.Collation

r/w/en

expression

Gtk.Expression

r/w/en

ignore-case

bool

r/w/en

Signals

Inherited:

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

Fields

Inherited:

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

Class Details

class Gtk.StringSorter(**kwargs)
Bases:

Gtk.Sorter

Abstract:

No

Structure:

Gtk.StringSorterClass

GtkStringSorter is a GtkSorter that compares strings.

It does the comparison in a linguistically correct way using the current locale by normalizing Unicode strings and possibly case-folding them before performing the comparison.

To obtain the strings 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 GtkStringSorter

Return type:

Gtk.StringSorter

Creates a new string sorter that compares items using the given expression.

Unless an expression is set on it, this sorter will always compare items as invalid.

get_collation()[source]
Returns:

The collation method

Return type:

Gtk.Collation

Gets which collation method the sorter uses.

New in version 4.10.

get_expression()[source]
Returns:

a GtkExpression

Return type:

Gtk.Expression or None

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

get_ignore_case()[source]
Returns:

True if self is ignoring case differences

Return type:

bool

Gets whether the sorter ignores case differences.

set_collation(collation)[source]
Parameters:

collation (Gtk.Collation) – the collation method

Sets the collation method to use for sorting.

New in version 4.10.

set_expression(expression)[source]
Parameters:

expression (Gtk.Expression or None) – a GtkExpression

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

The expression must have the type GObject.TYPE_STRING.

set_ignore_case(ignore_case)[source]
Parameters:

ignore_case (bool) – True to ignore case differences

Sets whether the sorter will ignore case differences.

Property Details

Gtk.StringSorter.props.collation
Name:

collation

Type:

Gtk.Collation

Default Value:

Gtk.Collation.UNICODE

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The collation method to use for sorting.

The GTK_COLLATION_NONE value is useful when the expression already returns collation keys, or strings that need to be compared byte-by-byte.

The default value, GTK_COLLATION_UNICODE, compares strings according to the Unicode collation algorithm.

New in version 4.10.

Gtk.StringSorter.props.expression
Name:

expression

Type:

Gtk.Expression

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The expression to evaluate on item to get a string to compare with.

Gtk.StringSorter.props.ignore_case
Name:

ignore-case

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

If sorting is case sensitive.