pyface.data_view.value_types.editable_value module

class pyface.data_view.value_types.editable_value.EditableValue[source]

Bases: AbstractValueType

A base class for editable values.

This class provides two things beyond the base AbstractValueType: a trait is_editable which allows toggling editing state on and off, and an is_valid method that is used for validation before setting a value.

is_editable = Bool(True, update_value_type=True)

Whether or not the value is editable, assuming the underlying data can be set.

is_valid(model, row, column, value)[source]

Whether or not the value is valid for the data item specified.

The default implementation returns True for all values.

Parameters
  • model (AbstractDataModel) – The data model holding the data.

  • row (sequence of int) – The row in the data model being queried.

  • column (sequence of int) – The column in the data model being queried.

  • value (Any) – The value to validate.

Returns

is_valid – Whether or not the value is valid.

Return type

bool

has_editor_value(model, row, column)[source]

Return whether or not the value can be edited.

A cell is editable if the underlying data can be set, and the is_editable flag is set to True

Parameters
  • model (AbstractDataModel) – The data model holding the data.

  • row (sequence of int) – The row in the data model being queried.

  • column (sequence of int) – The column in the data model being queried.

Returns

has_editor_value – Whether or not the value is editable.

Return type

bool

set_editor_value(model, row, column, value)[source]

Set the edited value.

Parameters
  • model (AbstractDataModel) – The data model holding the data.

  • row (sequence of int) – The row in the data model being set.

  • column (sequence of int) – The column in the data model being set.

  • value (Any) – The value being set.

Raises

DataViewSetError – If the value cannot be set.