Added way to dynamicly set loading order

This is to ensure that Global stacks are loaded before extruders, so once the extruders are deseralized, they can always find the next (global) stack

CURA-3497
This commit is contained in:
Jaime van Kessel 2017-05-03 09:54:00 +02:00
parent 58ab9dcd09
commit 8d80f20db7
2 changed files with 15 additions and 0 deletions

View file

@ -38,6 +38,10 @@ class ExtruderStack(CuraContainerStack):
# For backward compatibility: Register the extruder with the Extruder Manager
ExtruderManager.getInstance().registerExtruder(self, stack.id)
@classmethod
def getLoadingPriority(cls) -> int:
return 3
## Overridden from ContainerStack
#
# It will perform a few extra checks when trying to get properties.
@ -64,6 +68,13 @@ class ExtruderStack(CuraContainerStack):
return self.getNextStack()._getMachineDefinition()
@override(CuraContainerStack)
def deserialize(self, contents: str) -> None:
super().deserialize(contents)
stacks = ContainerRegistry.getInstance().findContainerStacks(id=self.getMetaDataEntry("machine", ""))
if stacks:
self.setNextStack(stacks[0])
extruder_stack_mime = MimeType(
name = "application/x-cura-extruderstack",
comment = "Cura Extruder Stack",