Gtk.StringFilter

g GObject.Object GObject.Object Gtk.Filter Gtk.Filter GObject.Object->Gtk.Filter Gtk.StringFilter Gtk.StringFilter Gtk.Filter->Gtk.StringFilter

Subclasses:

None

Methods

Inherited:

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

Structs:

GObject.ObjectClass (5)

class

new (expression)

get_expression ()

get_ignore_case ()

get_match_mode ()

get_search ()

set_expression (expression)

set_ignore_case (ignore_case)

set_match_mode (mode)

set_search (search)

Virtual Methods

Inherited:

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

Properties

Name

Type

Flags

Short Description

expression

Gtk.Expression

r/w/en

ignore-case

bool

r/w/en

match-mode

Gtk.StringFilterMatchMode

r/w/en

search

str

r/w/en

Signals

Inherited:

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

Fields

Inherited:

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

Class Details

class Gtk.StringFilter(**kwargs)
Bases:

Gtk.Filter

Abstract:

No

Structure:

Gtk.StringFilterClass

GtkStringFilter determines whether to include items by comparing strings to a fixed search term.

The strings are obtained from the items by evaluating a GtkExpression set with [method`Gtk`.StringFilter.set_expression], and they are compared against a search term set with [method`Gtk`.StringFilter.set_search].

GtkStringFilter has several different modes of comparison - it can match the whole string, just a prefix, or any substring. Use [method`Gtk`.StringFilter.set_match_mode] choose a mode.

It is also possible to make case-insensitive comparisons, with [method`Gtk`.StringFilter.set_ignore_case].

classmethod new(expression)[source]
Parameters:

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

Returns:

a new GtkStringFilter

Return type:

Gtk.StringFilter

Creates a new string filter.

You will want to set up the filter by providing a string to search for and by providing a property to look up on the item.

get_expression()[source]
Returns:

a GtkExpression

Return type:

Gtk.Expression or None

Gets the expression that the string filter uses to obtain strings from items.

get_ignore_case()[source]
Returns:

True if the filter ignores case

Return type:

bool

Returns whether the filter ignores case differences.

get_match_mode()[source]
Returns:

the match mode of the filter

Return type:

Gtk.StringFilterMatchMode

Returns the match mode that the filter is using.

Returns:

The search term

Return type:

str or None

Gets the search term.

set_expression(expression)[source]
Parameters:

expression (Gtk.Expression or None) – a GtkExpression

Sets the expression that the string filter uses to obtain strings from items.

The expression must have a value type of GObject.TYPE_STRING.

set_ignore_case(ignore_case)[source]
Parameters:

ignore_case (bool) – True to ignore case

Sets whether the filter ignores case differences.

set_match_mode(mode)[source]
Parameters:

mode (Gtk.StringFilterMatchMode) – the new match mode

Sets the match mode for the filter.

Parameters:

search (str or None) – The string to search for or None to clear the search

Sets the string to search for.

Property Details

Gtk.StringFilter.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.StringFilter.props.ignore_case
Name:

ignore-case

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

If matching is case sensitive.

Gtk.StringFilter.props.match_mode
Name:

match-mode

Type:

Gtk.StringFilterMatchMode

Default Value:

Gtk.StringFilterMatchMode.SUBSTRING

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

If exact matches are necessary or if substrings are allowed.

Gtk.StringFilter.props.search
Name:

search

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The search term.