mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-11 00:37:50 -06:00
Fix type checking in GlobalStack
This commit is contained in:
parent
4cea1b6d33
commit
2f6936c961
1 changed files with 4 additions and 3 deletions
|
@ -178,9 +178,10 @@ class GlobalStack(ContainerStack):
|
||||||
@override(ContainerStack)
|
@override(ContainerStack)
|
||||||
def replaceContainer(self, index: int, container: ContainerInterface, postpone_emit: bool = False) -> None:
|
def replaceContainer(self, index: int, container: ContainerInterface, postpone_emit: bool = False) -> None:
|
||||||
expected_type = _ContainerIndexes.IndexTypeMap[index]
|
expected_type = _ContainerIndexes.IndexTypeMap[index]
|
||||||
if expected_type == "definition" and not isinstance(container, DefinitionContainer):
|
if expected_type == "definition":
|
||||||
raise Exceptions.InvalidContainerError("Cannot replace container at index {index} with a container that is not a DefinitionContainer".format(index = index))
|
if not isinstance(container, DefinitionContainer):
|
||||||
if container != self._empty_instance_container and container.getMetaDataEntry("type") != expected_type:
|
raise Exceptions.InvalidContainerError("Cannot replace container at index {index} with a container that is not a DefinitionContainer".format(index = index))
|
||||||
|
elif container != self._empty_instance_container and container.getMetaDataEntry("type") != expected_type:
|
||||||
raise Exceptions.InvalidContainerError("Cannot replace container at index {index} with a container that is not of {type} type".format(index = index, type = expected_type))
|
raise Exceptions.InvalidContainerError("Cannot replace container at index {index} with a container that is not of {type} type".format(index = index, type = expected_type))
|
||||||
|
|
||||||
super().replaceContainer(index, container, postpone_emit)
|
super().replaceContainer(index, container, postpone_emit)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue