StringSorter#

class StringSorter(**properties: Any)#

Superclasses: Sorter, Object

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 Expression.

Constructors#

class StringSorter
classmethod new(expression: Expression | None = None) 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.

Parameters:

expression – The expression to evaluate

Methods#

class StringSorter
get_collation() Collation#

Gets which collation method the sorter uses.

Added in version 4.10.

get_expression() Expression | None#

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

get_ignore_case() bool#

Gets whether the sorter ignores case differences.

set_collation(collation: Collation) None#

Sets the collation method to use for sorting.

Added in version 4.10.

Parameters:

collation – the collation method

set_expression(expression: Expression | None = None) None#

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

The expression must have the type str.

Parameters:

expression – a GtkExpression

set_ignore_case(ignore_case: bool) None#

Sets whether the sorter will ignore case differences.

Parameters:

ignore_caseTrue to ignore case differences

Properties#

class StringSorter
props.collation: Collation#

The type of the None singleton.

Added in version 4.10.

props.expression: Expression#

The type of the None singleton.

props.ignore_case: bool#

The type of the None singleton.