pyface.data_view.value_types.constant_value module

class pyface.data_view.value_types.constant_value.ConstantValue[source]

Bases: pyface.data_view.abstract_value_type.AbstractValueType

A value type that does not depend on the underlying data model.

This value type is not editable, but the other data channels it provides can be modified by changing the appropriate trait on the value type.

text = Str(update_value_type=True)

The text value to display.

color = Union(None, PyfaceColor)

The color value to display or None if no color.

image = Image(update_value_type=True)

The image value to display.

tooltip = Str(update_value_type=True)

The tooltip value to display.

has_editor_value(model, row, column)[source]

Return whether or not the value can be edited.

The default implementation is that cells that can be set are editable.

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

get_text(model, row, column)[source]

The textual representation of the underlying value.

The default implementation calls str() on the underlying value.

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

text – The textual representation of the underlying value.

Return type

str

has_color(model, row, column)[source]

Whether or not the value has color data.

Returns true if the supplied color is not None.

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_color – Whether or not the value has data-associated color values.

Return type

bool

get_color(model, row, column)[source]

Get data-associated colour values for the given item.

The default implementation returns white.

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

color – The color associated with the cell.

Return type

Color instance

has_image(model, row, column)[source]

Whether or not the value has an image associated with it.

The default implementation returns True if get_image returns a non-None value.

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_image – Whether or not the value has an image associated with it.

Return type

bool

get_image(model, row, column)[source]

An image associated with the underlying value.

The default implementation returns None.

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

image – The image associated with the underlying value.

Return type

IImage

get_tooltip(model, row, column)[source]

The tooltip for the underlying value.

The default implementation returns an empty string.

tooltipstr

The textual representation of the underlying value.