traitsui.table_filter module

Defines the filter object used to filter items displayed in a table editor.

class traitsui.table_filter.EvalTableFilter[source]

Bases: TableFilter

A table filter based on evaluating an expression.

description()[source]

Returns a user readable description of what kind of object satisfies the filter.

expression = Expression

Python expression which will be applied to each table item

filter(object)[source]

Returns whether a specified object meets the filter or search criteria.

name = "Default evaluation filter"

Override the standard name trait

class traitsui.table_filter.GenericTableFilterRule(**traits)[source]

Bases: HasPrivateTraits

A general rule used by a table filter.

and_or = Enum("and", "or")

Is this rule an ‘and’ rule or an ‘or’ rule?

clone_traits(traits=None, memo=None, copy=None, **metadata)[source]

Clones a new object from this one, optionally copying only a specified set of traits.

contains(value1, value2)[source]
description()[source]

Returns a description of the filter.

enabled = Bool(False)

Is this rule enabled?

ends_with(value1, value2)[source]
eq(value1, value2)[source]
filter = Instance("RuleTableFilter")

Filter this rule is part of

ge(value1, value2)[source]
gt(value1, value2)[source]
ignored_traits = ['filter', 'name_editor', 'value_editor']

Traits that are ignored by the _anytrait_changed() handler

is_true(object)[source]

Returns whether the rule is true for a specified object.

le(value1, value2)[source]
lt(value1, value2)[source]
name = Str()

Name of the object trait that this rule applies to

name_editor = Instance(EditorFactory)

EnumEditor used to edit the name trait:

ne(value1, value2)[source]
operation = GenericTableFilterRuleOperation

Operation to be applied in the rule

starts_with(value1, value2)[source]
value = Any()

Value to use in the operation when applying the rule to an object

value_editor = Instance(EditorFactory)

Editor used to edit the value trait

class traitsui.table_filter.GenericTableFilterRuleAndOrColumn[source]

Bases: ObjectColumn

Table column that displays whether a filter rule is conjoining (‘and’) or disjoining (‘or’).

get_value(object)[source]

Returns the traits editor of the column for a specified object.

class traitsui.table_filter.GenericTableFilterRuleEnabledColumn[source]

Bases: ObjectColumn

Table column that indicates whether a filter rule is enabled.

get_value(object)[source]

Returns the traits editor of the column for a specified object.

class traitsui.table_filter.GenericTableFilterRuleNameColumn[source]

Bases: ObjectColumn

Table column for the name of an object trait.

get_editor(object)[source]

Returns the traits editor of the column for a specified object.

class traitsui.table_filter.GenericTableFilterRuleValueColumn[source]

Bases: ObjectColumn

Table column for the value of an object trait.

get_editor(object)[source]

Returns the traits editor of the column for a specified object.

class traitsui.table_filter.MenuTableFilter[source]

Bases: RuleTableFilter

A table filter based on a menu of rules.

description()[source]

Returns a user8readable description of what kind of object satisfies the filter.

filter(object)[source]

Returns whether a specified object meets the filter or search criteria.

name = "Default menu-based filter"

Overrides the default name trait

view_id = Str("traitsui.table_filter.MenuTableFilter")

Overrides the persistence ID of the view

class traitsui.table_filter.RuleTableFilter[source]

Bases: TableFilter

A table filter based on rules.

description()[source]

Returns a user-readable description of the kind of object that satisfies the filter.

edit_view(object)[source]

Return a view to use for editing the filter.

The ‘’object’’ parameter is a sample object for the table that the filter will be applied to. It is supplied in case the filter needs to extract data or metadata from the object. If the table is empty, the ‘’object’’ argument is None.

filter(object)[source]

Returns whether a specified object meets the filter or search criteria.

modified = Event()

Event fired when the contents of the filter have changed

name = "Default rule-based filter"

Overrides the default name trait

rules = List(GenericTableFilterRule)

List of the filter rules to be applied

view_id = Str("traitsui.table_filter.RuleTableFilter")

Persistence ID of the view

class traitsui.table_filter.TableFilter[source]

Bases: HasPrivateTraits

Filter for items displayed in a table.

allowed = Callable(lambda object: True, transient=True)

A callable function that returns whether the passed object is allowed by the filter

desc = Str("All items")

A user-readable description of what kind of object satisfies the filter

description()[source]

Returns a user-readable description of what kind of object satisfies the filter.

edit(object)[source]

Edits the contents of the filter.

edit_view(object)[source]

Return a view to use for editing the filter.

The ‘’object’’ parameter is a sample object for the table that the filter will be applied to. It is supplied in case the filter needs to extract data or metadata from the object. If the table is empty, the ‘’object’’ argument is None.

filter(object)[source]

Returns whether a specified object meets the filter or search criteria.

ignored_traits = ['_name', 'template', 'desc']

Traits that are ignored by the _anytrait_changed() handler

name = Str("Default filter")

UI name of this filter (so the user can identify it in the UI)

template = Bool(False)

Is the filter a template (i.e., non-deletable, non-editable)?