pyface.data_view.value_types.numeric_value module

pyface.data_view.value_types.numeric_value.format_locale(value)
class pyface.data_view.value_types.numeric_value.NumericValue

Bases: pyface.data_view.value_types.editable_value.EditableValue

Data channels for a numeric value.

minimum = Float(-inf)

The minimum value for the numeric value.

maximum = Float(inf)

The maximum value for the numeric value.

evaluate = Callable()

A function that converts to the numeric type.

format = Callable(format_locale, update_value_type=True)

A function that converts the required type to a string for display.

unformat = Callable(locale.delocalize)

A function that converts the required type from a display string.

is_valid(model, row, column, value)

Whether or not the value within the specified range.

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

get_editor_value(model, row, column)

Get the numerical value for the editor to use.

This uses the evaluate method to convert the underlying value to a number.

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

editor_value – Whether or not the value is editable.

Return type

number

get_text(model, row, column)

Get the display text from 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 text to display.

Return type

str

set_text(model, row, column, text)

Set the text of 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.

  • text (str) – The text to set.

Raises

DataViewSetError – If the value cannot be set.

class pyface.data_view.value_types.numeric_value.IntValue

Bases: pyface.data_view.value_types.numeric_value.NumericValue

Data channels for an integer value.

class pyface.data_view.value_types.numeric_value.FloatValue

Bases: pyface.data_view.value_types.numeric_value.NumericValue

Data channels for a floating point value.