spinetoolbox.mvcmodels.single_parameter_models
¶
Single models for parameter definitions and values (as ‘for a single entity’).
authors: |
|
---|---|
date: | 28.6.2019 |
Module Contents¶
-
class
spinetoolbox.mvcmodels.single_parameter_models.
SingleParameterModel
(parent, header, db_mngr, db_map, entity_class_id, lazy=True)[source]¶ Bases:
spinetoolbox.mvcmodels.minimal_table_model.MinimalTableModel
A parameter model for a single entity class to go in a CompoundParameterModel. Provides methods to associate the model to an entity class as well as to filter entities within the class.
Init class.
Parameters: - parent (CompoundParameterModel) – the parent object
- header (list) – list of field names for the header
-
item_type
[source]¶ The item type, either ‘parameter value’ or ‘parameter definition’, required by the data method.
-
insertRows
(self, row, count, parent=QModelIndex())[source]¶ This model doesn’t support row insertion.
-
_fetch_data
(self)[source]¶ Returns data to reset the model with and call it fetched. Reimplement in subclasses if you want to populate your model automatically.
-
get_field_item_data
(self, field)[source]¶ Returns item data for given field.
Parameters: field (str) – A field from the header Returns: str, str
-
get_field_item
(self, field, db_item)[source]¶ Returns a db item corresponding to the given field from the table header, or an empty dict if the field doesn’t contain db items.
-
data
(self, index, role=Qt.DisplayRole)[source]¶ Gets the id and database for the row, and reads data from the db manager using the item_type property. Paint the object class icon next to the name. Also paint background of fixed indexes gray and apply custom format to JSON fields.
-
batch_set_data
(self, indexes, data)[source]¶ Sets data for indexes in batch. Sets data directly in database using db mngr. If successful, updated data will be automatically seen by the data method.
-
_main_filter_accepts_row
(self, row)[source]¶ Applies the main filter, defined by the selections in the grand parent.
-
class
spinetoolbox.mvcmodels.single_parameter_models.
SingleObjectParameterMixin
[source]¶ Associates a parameter model with a single object class.
-
class
spinetoolbox.mvcmodels.single_parameter_models.
SingleRelationshipParameterMixin
[source]¶ Associates a parameter model with a single relationship class.
-
class
spinetoolbox.mvcmodels.single_parameter_models.
SingleParameterDefinitionMixin
[source]¶ Bases:
spinetoolbox.mvcmodels.parameter_mixins.FillInParameterNameMixin
,spinetoolbox.mvcmodels.parameter_mixins.FillInValueListIdMixin
,spinetoolbox.mvcmodels.parameter_mixins.MakeParameterTagMixin
A parameter definition model for a single entity class.
-
class
spinetoolbox.mvcmodels.single_parameter_models.
SingleParameterValueMixin
(*args, **kwargs)[source]¶ Bases:
spinetoolbox.mvcmodels.parameter_mixins.ConvertToDBMixin
A parameter value model for a single entity class.
-
class
spinetoolbox.mvcmodels.single_parameter_models.
SingleObjectParameterDefinitionModel
[source]¶ Bases:
spinetoolbox.mvcmodels.single_parameter_models.SingleObjectParameterMixin
,spinetoolbox.mvcmodels.single_parameter_models.SingleParameterDefinitionMixin
,spinetoolbox.mvcmodels.single_parameter_models.SingleParameterModel
An object parameter definition model for a single object class.
-
class
spinetoolbox.mvcmodels.single_parameter_models.
SingleRelationshipParameterDefinitionModel
[source]¶ Bases:
spinetoolbox.mvcmodels.single_parameter_models.SingleRelationshipParameterMixin
,spinetoolbox.mvcmodels.single_parameter_models.SingleParameterDefinitionMixin
,spinetoolbox.mvcmodels.single_parameter_models.SingleParameterModel
A relationship parameter definition model for a single relationship class.
-
class
spinetoolbox.mvcmodels.single_parameter_models.
SingleObjectParameterValueModel
[source]¶ Bases:
spinetoolbox.mvcmodels.single_parameter_models.SingleObjectParameterMixin
,spinetoolbox.mvcmodels.single_parameter_models.SingleParameterValueMixin
,spinetoolbox.mvcmodels.single_parameter_models.SingleParameterModel
An object parameter value model for a single object class.
-
class
spinetoolbox.mvcmodels.single_parameter_models.
SingleRelationshipParameterValueModel
[source]¶ Bases:
spinetoolbox.mvcmodels.single_parameter_models.SingleRelationshipParameterMixin
,spinetoolbox.mvcmodels.single_parameter_models.SingleParameterValueMixin
,spinetoolbox.mvcmodels.single_parameter_models.SingleParameterModel
A relationship parameter value model for a single relationship class.