mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 15:07:28 -06:00
Express getConfigurationTypeFromSerialized as function of its parent
This prevents code duplication a bit and allows us to make it a classmethod. Contributes to issue CURA-4243.
This commit is contained in:
parent
07947d5d2c
commit
e48b151d40
1 changed files with 5 additions and 9 deletions
|
@ -43,15 +43,11 @@ class GlobalStack(CuraContainerStack):
|
||||||
def getLoadingPriority(cls) -> int:
|
def getLoadingPriority(cls) -> int:
|
||||||
return 2
|
return 2
|
||||||
|
|
||||||
def getConfigurationTypeFromSerialized(self, serialized: str) -> Optional[str]:
|
@classmethod
|
||||||
configuration_type = None
|
def getConfigurationTypeFromSerialized(cls, serialized: str) -> Optional[str]:
|
||||||
try:
|
configuration_type = super().getConfigurationTypeFromSerialized(serialized)
|
||||||
parser = self._readAndValidateSerialized(serialized)
|
if configuration_type == "machine":
|
||||||
configuration_type = parser["metadata"].get("type")
|
return "machine_stack"
|
||||||
if configuration_type == "machine":
|
|
||||||
configuration_type = "machine_stack"
|
|
||||||
except Exception as e:
|
|
||||||
Logger.log("e", "Could not get configuration type: %s", e)
|
|
||||||
return configuration_type
|
return configuration_type
|
||||||
|
|
||||||
## Add an extruder to the list of extruders of this stack.
|
## Add an extruder to the list of extruders of this stack.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue