StringFilter

class StringFilter(**properties: Any)

Superclasses: Filter, Object

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 set_expression, and they are compared against a search term set with set_search.

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

It is also possible to make case-insensitive comparisons, with set_ignore_case.

Constructors

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

Parameters:

expression – The expression to evaluate

Methods

class StringFilter
get_expression() Expression | None

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

get_ignore_case() bool

Returns whether the filter ignores case differences.

get_match_mode() StringFilterMatchMode

Returns the match mode that the filter is using.

Gets the search term.

set_expression(expression: Expression | None = None) None

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

The expression must have a value type of str.

Parameters:

expression – a GtkExpression

set_ignore_case(ignore_case: bool) None

Sets whether the filter ignores case differences.

Parameters:

ignore_caseTrue to ignore case

set_match_mode(mode: StringFilterMatchMode) None

Sets the match mode for the filter.

Parameters:

mode – the new match mode

Sets the string to search for.

Parameters:

search – The string to search for or None to clear the search

Properties

class StringFilter
props.expression: Expression

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

props.ignore_case: bool

If matching is case sensitive.

props.match_mode: StringFilterMatchMode

If exact matches are necessary or if substrings are allowed.

props.search: str

The search term.