spinetoolbox.project_items.shared.models¶
Contains a generic File list model and an Item for that model. Used by the Importer project item but this may be handy for other project items as well.
| authors: |
|
|---|---|
| date: | 5.6.2020 |
Module Contents¶
Classes¶
FileListItem |
An item for FileListModel. |
FileListModel |
A model for files to be shown in a file list view. |
Functions¶
_file_label(resource) |
Picks a label for given file resource. |
-
spinetoolbox.project_items.shared.models._file_label(resource)[source]¶ Picks a label for given file resource.
-
class
spinetoolbox.project_items.shared.models.FileListItem(label, path, provider_name, is_pattern=False)[source]¶ An item for FileListModel.
Parameters: - label (str) – File label; a full path for ‘permanent’ files or just the basename for ‘transient’ files like Tool’s output.
- path (str) – Absolute path to the file, empty if not known
- provider_name (str) – Name of the project item providing the file
- is_pattern (bool) – True if the file is actually a file name pattern
Initialize self. See help(type(self)) for accurate signature.
-
classmethod
from_resource(cls, resource)[source]¶ Constructs a FileListItem from ProjectItemResource.
Parameters: resource (ProjectItemResource) – Resource Returns: An item based on given resource Return type: FileListItem Raises: RuntimeError– If given resource has an unknown type
-
update(self, resource)[source]¶ Updates item information.
Parameters: resource (ProjectItemResource) – A fresh file resource
-
class
spinetoolbox.project_items.shared.models.FileListModel[source]¶ Bases:
PySide2.QtCore.QAbstractListModelA model for files to be shown in a file list view. Used by Importer.
-
data(self, index, role=Qt.DisplayRole)[source]¶ Returns data associated with given role at given index.
-