mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 05:45:55 +08:00
Add an "extruders" property and an addExtruder method
Contributes to CURA-3497
This commit is contained in:
parent
462d5fac8d
commit
5ad0651fd1
@ -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…
x
Reference in New Issue
Block a user