mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-05 21:13:58 -06:00
Add an "extruders" property and an addExtruder method
Contributes to CURA-3497
This commit is contained in:
parent
462d5fac8d
commit
5ad0651fd1
1 changed files with 13 additions and 0 deletions
|
@ -19,6 +19,8 @@ class GlobalStack(ContainerStack):
|
|||
|
||||
self._empty_instance_container = ContainerRegistry.getInstance().getEmptyInstanceContainer()
|
||||
|
||||
self._extruders = []
|
||||
|
||||
@pyqtProperty(InstanceContainer)
|
||||
def userChanges(self) -> InstanceContainer:
|
||||
return self._containers[_ContainerIndexes.UserChanges]
|
||||
|
@ -59,6 +61,17 @@ class GlobalStack(ContainerStack):
|
|||
def definition(self) -> DefinitionContainer:
|
||||
return self._containers[_ContainerIndexes.Definition]
|
||||
|
||||
@pyqtProperty("QVariantList")
|
||||
def extruders(self) -> list:
|
||||
return self._extruders
|
||||
|
||||
def addExtruder(self, extruder):
|
||||
extruder_count = self.getProperty("machine_extruder_count", "value")
|
||||
if len(self._extruders) > extruder_count:
|
||||
raise Exceptions.TooManyExtrudersError("Tried to add extruder to {id} but its extruder count is {count}".format(id = self.id, count = extruder_count))
|
||||
|
||||
self._extruders.append(extruder)
|
||||
|
||||
## Check whether the specified setting has a 'user' value.
|
||||
#
|
||||
# A user value here is defined as the setting having a value in either
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue