traitsui.table_filter module

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

class traitsui.table_filter.EvalTableFilter

Bases: traitsui.table_filter.TableFilter

A table filter based on evaluating an expression.

description()

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)

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)

Bases: traits.has_traits.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)

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

contains(value1, value2)
description()

Returns a description of the filter.

enabled = Bool(False)

Is this rule enabled?

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

Filter this rule is part of

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

Traits that are ignored by the _anytrait_changed() handler

is_true(object)

Returns whether the rule is true for a specified object.

le(value1, value2)
lt(value1, value2)
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)
operation = GenericTableFilterRuleOperation

Operation to be applied in the rule

starts_with(value1, value2)
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

Bases: traitsui.table_column.ObjectColumn

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

get_value(object)

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

class traitsui.table_filter.GenericTableFilterRuleEnabledColumn

Bases: traitsui.table_column.ObjectColumn

Table column that indicates whether a filter rule is enabled.

get_value(object)

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

class traitsui.table_filter.GenericTableFilterRuleNameColumn

Bases: traitsui.table_column.ObjectColumn

Table column for the name of an object trait.

get_editor(object)

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

class traitsui.table_filter.GenericTableFilterRuleValueColumn

Bases: traitsui.table_column.ObjectColumn

Table column for the value of an object trait.

get_editor(object)

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

class traitsui.table_filter.MenuTableFilter

Bases: traitsui.table_filter.RuleTableFilter

A table filter based on a menu of rules.

description()

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

filter(object)

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

Bases: traitsui.table_filter.TableFilter

A table filter based on rules.

description()

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

edit_view(object)

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)

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

Bases: traits.has_traits.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()

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

edit(object)

Edits the contents of the filter.

edit_view(object)

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)

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)?