spinetoolbox.mvcmodels.tool_specification_model¶
Contains a class for storing Tool specifications.
| authors: |
|
|---|---|
| date: | 23.1.2018 |
Module Contents¶
-
class
spinetoolbox.mvcmodels.tool_specification_model.ToolSpecificationModel[source]¶ Bases:
PySide2.QtCore.QAbstractListModelClass to store tools that are available in a project e.g. GAMS or Julia models.
-
rowCount(self, parent=None)[source]¶ Must be reimplemented when subclassing. Returns the number of Tools in the model.
Parameters: parent (QModelIndex) – Not used (because this is a list) Returns: Number of rows (available tools) in the model
-
data(self, index, role=None)[source]¶ Must be reimplemented when subclassing.
Parameters: - index (QModelIndex) – Requested index
- role (int) – Data role
Returns: Data according to requested role
-
flags(self, index)[source]¶ Returns enabled flags for the given index.
Parameters: index (QModelIndex) – Index of Tool
-
insertRow(self, tool, row=None, parent=QModelIndex())[source]¶ Insert row (tool specification) into model.
Parameters: - tool (Tool) – Tool added to the model
- row (str) – Row to insert tool to
- parent (QModelIndex) – Parent of child (not used)
Returns: Void
-
removeRow(self, row, parent=QModelIndex())[source]¶ Remove row (tool specification) from model.
Parameters: - row (int) – Row to remove the tool from
- parent (QModelIndex) – Parent of tool on row (not used)
Returns: Boolean variable
-
update_tool_specification(self, row, tool)[source]¶ Update tool specification.
Parameters: - row (int) – Position of the tool to be updated
- tool (ToolSpecification) – new tool, to replace the old one
Returns: Boolean value depending on the result of the operation
-
tool_specification(self, row)[source]¶ Returns tool specification on given row.
Parameters: row (int) – Row of tool specification Returns: ToolSpecification from tool specification list or None if given row is zero
-
find_tool_specification(self, name)[source]¶ Returns tool specification with the given name.
Parameters: name (str) – Name of tool specification to find
-