pyface.data_view.value_types.numeric_value module

pyface.data_view.value_types.numeric_value.format_locale(value)[source]
class pyface.data_view.value_types.numeric_value.NumericValue[source]

Bases: 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)[source]

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)[source]

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)[source]

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)[source]

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[source]

Bases: NumericValue

Data channels for an integer value.

class pyface.data_view.value_types.numeric_value.FloatValue[source]

Bases: NumericValue

Data channels for a floating point value.