Uranium
Application Framework
Loading...
Searching...
No Matches
UM.Settings.Models.InstanceContainersModel.InstanceContainersModel Class Reference

Model that holds instance containers. More...

Inheritance diagram for UM.Settings.Models.InstanceContainersModel.InstanceContainersModel:
UM.Qt.ListModel.ListModel

Public Member Functions

 __init__ (self, parent=None)
 
 setSectionProperty (self, property_name)
 
 sectionProperty (self)
 
None setFilter (self, Dict[str, str] filter_dict)
 Set the filter of this model based on a string.
 
Dict[str, str] filter (self)
 
 setFilterList (self, filter_list)
 Set a list of filters to use when fetching containers.
 
 filterList (self)
 
 rename (self, instance_id, new_name)
 
 getFileNameFilters (self, io_type)
 Gets a list of the possible file filters that the plugins have registered they can read or write.
 
 getDefaultPath (self)
 
 exportProfile (self, instance_id, file_url, file_type)
 
 importProfile (self, file_url)
 
- Public Member Functions inherited from UM.Qt.ListModel.ListModel
 __init__ (self, parent=None)
 
 rowCount (self, parent=None)
 Reimplemented from QAbstractListModel.
 
 addRoleName (self, role, name)
 
 roleNames (self)
 
 data (self, index, role)
 Reimplemented from QAbstractListModel.
 
 getItem (self, index)
 Get an item from the list.
 
 items (self)
 The list of items in this model.
 
 setItems (self, items)
 Replace all items at once.
 
 appendItem (self, item)
 Add an item to the list.
 
 insertItem (self, index, item)
 Insert an item into the list at an index.
 
 removeItem (self, index)
 Remove an item from the list.
 
 clear (self)
 Clear the list.
 
 setProperty (self, index, property, value)
 
 sort (self, fun)
 Sort the list.
 
 find (self, key, value)
 Find a entry by key value pair.
 

Public Attributes

 NameRole
 
 IdRole
 
 MetaDataRole
 
 ReadOnlyRole
 
 SectionRole
 

Static Public Attributes

int NameRole = Qt.UserRole + 1
 
int IdRole = Qt.UserRole + 2
 
int MetaDataRole = Qt.UserRole + 3
 
int ReadOnlyRole = Qt.UserRole + 4
 
int SectionRole = Qt.UserRole + 5
 
 sectionPropertyChanged = pyqtSignal()
 
 filterChanged = pyqtSignal()
 
- Static Public Attributes inherited from UM.Qt.ListModel.ListModel
 itemsChanged = pyqtSignal()
 

Protected Member Functions

 _onContainerChanged (self, container)
 Handler for container added / removed events from registry.
 
 _update (self)
 Private convenience function to reset & repopulate the model.
 
 _recomputeItems (self)
 Computes the items that need to be in this list model.
 
Tuple[Dict[str, InstanceContainer], Dict[str, Dict[str, Any]]] _fetchInstanceContainers (self)
 Fetch the list of containers to display.
 
 _getIOPlugins (self, io_type)
 Gets a list of profile reader or writer plugins.
 
 _sortKey (self, item)
 
 _updateMetaData (self, container)
 
 _onContainerLoadComplete (self, container_id)
 If a container has loaded fully (rather than just metadata) we need to move it from the dict of metadata to the dict of full containers.
 

Protected Attributes

 _instance_containers
 
 _instance_containers_metadata
 
 _section_property
 
 _onContainerChanged
 
 _onContainerLoadComplete
 
 _container_change_timer
 
 _update
 
 _filter_dicts
 
 _updateMetaData
 
- Protected Attributes inherited from UM.Qt.ListModel.ListModel
 _items
 
 _role_names
 

Detailed Description

Model that holds instance containers.

By setting the filter property the instances held by this model can be changed.

Constructor & Destructor Documentation

◆ __init__()

UM.Settings.Models.InstanceContainersModel.InstanceContainersModel.__init__ (   self,
  parent = None 
)

Reimplemented from UM.Qt.ListModel.ListModel.

Member Function Documentation

◆ _fetchInstanceContainers()

Tuple[Dict[str, InstanceContainer], Dict[str, Dict[str, Any]]] UM.Settings.Models.InstanceContainersModel.InstanceContainersModel._fetchInstanceContainers (   self)
protected

Fetch the list of containers to display.

This method is intended to be overridable by subclasses.

Returns
A tuple of an ID-to-instance mapping that includes all fully loaded containers, and an ID-to-metadata mapping that includes the containers of which only the metadata is known.

◆ _getIOPlugins()

UM.Settings.Models.InstanceContainersModel.InstanceContainersModel._getIOPlugins (   self,
  io_type 
)
protected

Gets a list of profile reader or writer plugins.

Returns
List of tuples of (plugin_id, meta_data).

◆ _recomputeItems()

UM.Settings.Models.InstanceContainersModel.InstanceContainersModel._recomputeItems (   self)
protected

Computes the items that need to be in this list model.

This does not set the items in the list itself. It is intended to be overwritten by subclasses that add their own roles to the model.

◆ getFileNameFilters()

UM.Settings.Models.InstanceContainersModel.InstanceContainersModel.getFileNameFilters (   self,
  io_type 
)

Gets a list of the possible file filters that the plugins have registered they can read or write.

The convenience meta-filters "All Supported Types" and "All Files" are added when listing readers, but not when listing writers.

Parameters
io_typestr name of the needed IO type
Returns
A list of strings indicating file name filters for a file dialog.

◆ setFilter()

None UM.Settings.Models.InstanceContainersModel.InstanceContainersModel.setFilter (   self,
Dict[str, str]  filter_dict 
)

Set the filter of this model based on a string.

Parameters
filter_dictDict Dictionary to do the filtering by.

◆ setFilterList()

UM.Settings.Models.InstanceContainersModel.InstanceContainersModel.setFilterList (   self,
  filter_list 
)

Set a list of filters to use when fetching containers.

Parameters
filter_listList[Dict] List of filter dicts to fetch multiple sets of containers. The final result is the union of these sets.

The documentation for this class was generated from the following file: