mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 20:19:13 +08:00
Override getProperty in ExtruderStack with some additional checks
This commit is contained in:
parent
93e42164a8
commit
b9dc94e1f6
@ -15,3 +15,8 @@ class InvalidContainerError(Exception):
|
|||||||
## Raised when trying to add an extruder to a Global stack that already has the maximum number of extruders.
|
## Raised when trying to add an extruder to a Global stack that already has the maximum number of extruders.
|
||||||
class TooManyExtrudersError(Exception):
|
class TooManyExtrudersError(Exception):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
## Raised when an extruder has no next stack set.
|
||||||
|
class NoGlobalStackError(Exception):
|
||||||
|
pass
|
||||||
|
@ -25,10 +25,21 @@ class ExtruderStack(CuraContainerStack):
|
|||||||
super().setNextStack(stack)
|
super().setNextStack(stack)
|
||||||
stack.addExtruder(self)
|
stack.addExtruder(self)
|
||||||
|
|
||||||
|
@override(ContainerStack)
|
||||||
|
def getProperty(self, key: str, property_name: str) -> Any:
|
||||||
|
if not self._next_stack:
|
||||||
|
raise Exceptions.NoGlobalStackError("Extruder {id} is missing the next stack!".format(id = self.id))
|
||||||
|
|
||||||
|
if not super().getProperty(key, "settable_per_extruder"):
|
||||||
|
return self.getNextStack().getProperty(key, property_name)
|
||||||
|
|
||||||
|
return super().getProperty(key, property_name)
|
||||||
|
|
||||||
|
|
||||||
extruder_stack_mime = MimeType(
|
extruder_stack_mime = MimeType(
|
||||||
name = "application/x-cura-extruderstack",
|
name = "application/x-cura-extruderstack",
|
||||||
comment = "Cura Extruder Stack",
|
comment = "Cura Extruder Stack",
|
||||||
suffixes = [ "extruder.cfg" ]
|
suffixes = ["extruder.cfg"]
|
||||||
)
|
)
|
||||||
|
|
||||||
MimeTypeDatabase.addMimeType(extruder_stack_mime)
|
MimeTypeDatabase.addMimeType(extruder_stack_mime)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user