Table Models¶
ColumnInfo¶
-
class
datavis.models.
ColumnInfo
(name, dataType=3)¶ Basic information about a column: name and type.
-
__init__
(name, dataType=3)¶ Create a new instance of a ColumnInfo
- Parameters
name – The name of the column.
dataType – The type of the column
-
getName
()¶ Return the original name of the represented column.
-
ColumnConfig¶
-
class
datavis.models.
ColumnConfig
(name, dataType, **kwargs)¶ Extend
ColumnInfo
class to store properties about the visualization of a given column.-
__init__
(name, dataType, **kwargs)¶ Create a new instance.
- Parameters
name – The column name.
label – The column label
type – column type : ‘Bool’, ‘Int’, ‘Float’, ‘Str’, ‘Image’
- Keyword Arguments
label – Label that will be display as this column header.
description – More textual information about this column.
visible – If the columns will be shown or not.
visibleReadOnly – If ‘visible’ property can be changed.
renderable – If this columns has data that can be rendered.
renderableReadOnly – If renderization can be turn on/off.
editable – If the values in this columns can be edited.
editableReadOnly – Turn on/off edition of this column.
-
check
(**props)¶ Return True if this columns have these properties values.
-
clone
()¶ Return a new instance with the same values of this one.
-
config
(**props)¶ Configure the attributes from the provided properties key=value.
-
getDescription
()¶ Return the description of this column.
-
getLabel
()¶ Return the string that will be used to display this column.
-
getLabels
()¶ Returns the column labels
-
setLabels
(labels)¶ Sets the column labels
-
TableModel¶
-
class
datavis.models.
TableModel
¶ Abstract base class to define the table model required by some views.
It provides a very general interface about tabular data and how it will be displayed. The TableModel class will be able to handle data sources with more than one table. The method getTableNames will return the available tables. Then usually the TableModel will have only one table active (or loaded), from where the information will be retrieved. The method loadTable will allow to select which is currently loaded table.
-
createDefaultConfig
()¶ Create the default TableConfig based on the columns on this table.
-
getColumnsCount
()¶ Return the number of columns.
-
getData
(row, col)¶ Return the data (array like) for the item in this row, column. Used by rendering of images in a given cell of the table.
-
getRowsCount
()¶ Return the number of rows.
-
getTableName
()¶ Returns the name of the table currently loaded.
-
getTableNames
()¶ Returns all available table names from the data source.
-
getValue
(row, col)¶ Return the value of the item in this row, column.
-
iterColumns
()¶ Iterated over the current ColumnInfo’s of the model.
-
loadTable
(tableName)¶ Load the table with the given name.
This method should not be overridden in sub-classes, instead _loadTable should be re-implemented.
- Raises
An exception if there is not table with the provided name. –
-
TableConfig¶
-
class
datavis.models.
TableConfig
(*cols)¶ Contains visualization properties of the table’s columns.
-
__init__
(*cols)¶ Initialize self. See help(type(self)) for accurate signature.
-
addColumnConfig
(columnConfig)¶ Add a new ColumnConfig to the list.
-
getColumnConfig
(col)¶ Returns the corresponding ColumnConfig for the given column :param col: (int) The column index
-
getColumnsCount
(**props)¶ Return the number of columns that have given properties.
-
hasColumnConfig
(**props)¶ Returns True if has any there is any column with these properties.
Example to check if there is a column renderable:
tableConfig.hasColumnConfig(renderable=True)
-