pyface.data_view.value_types.enum_value module¶
- class pyface.data_view.value_types.enum_value.EnumValue[source]¶
- Bases: - EditableValue- Editable value that takes one of a collection of pre-set values. - Each value can be associated with text, colors and images by supplying functions - format,- colorsand- images, respectively.- values = List()¶
- The list of values which are allowed for the value. 
 - format = Callable(str, update_value_type=True)¶
- A function that converts a value to a string for display. 
 - colors = Callable(None, update_value_type=True)¶
- A map from valid values to colors. 
 - images = Callable(None, update_value_type=True)¶
- A map from valid values to images. 
 - is_valid(model, row, column, value)[source]¶
- Whether or not the value is valid for the data item specified. - 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
 
 - has_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
 
 - 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
 
 - has_color(model, row, column)[source]¶
- Whether or not the value has color data. - 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
 
 - 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
 
 - has_image(model, row, column)[source]¶
- Whether or not the value has an image associated with it. - 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
 
 - 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
 
 
