mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 22:54:01 -06:00
Allow setting Definition and setting Definition by ID
To match the other properties
This commit is contained in:
parent
123c8bae45
commit
75931192f6
1 changed files with 11 additions and 1 deletions
|
@ -106,7 +106,17 @@ class GlobalStack(ContainerStack):
|
|||
def definitionChanges(self) -> InstanceContainer:
|
||||
return self._containers[_ContainerIndexes.DefinitionChanges]
|
||||
|
||||
@pyqtProperty(DefinitionContainer)
|
||||
def setDefinition(self, new_definition: DefinitionContainer) -> None:
|
||||
self.replaceContainer(_ContainerIndexes.Definition, new_definition)
|
||||
|
||||
def setDefinitionById(self, new_definition_id: str) -> None:
|
||||
new_definition = ContainerRegistry.getInstance().findDefinitionContainers(id = new_definition_id)
|
||||
if new_definition:
|
||||
self.setDefinition(new_definition[0])
|
||||
else:
|
||||
raise Exceptions.InvalidContainerError("Could not find container with id {id}".format(id = new_definition_id))
|
||||
|
||||
@pyqtProperty(DefinitionContainer, fset = setDefinition, notify = pyqtContainersChanged)
|
||||
def definition(self) -> DefinitionContainer:
|
||||
return self._containers[_ContainerIndexes.Definition]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue