Disable add/insert/remove container

Since we want to have a fixed list of containers in the stack.

Contributes to CURA-3497
This commit is contained in:
Arjen Hiemstra 2017-03-23 17:52:53 +01:00
parent 5ad0651fd1
commit dc0c666a54

View file

@ -105,6 +105,22 @@ class GlobalStack(ContainerStack):
raise Exceptions.InvalidOperationError("Global stack cannot have a next stack!") raise Exceptions.InvalidOperationError("Global stack cannot have a next stack!")
## Overridden from ContainerStack ## Overridden from ContainerStack
#
# Since we have a fixed order of containers in the stack, we want to enforce this.
@override(ContainerStack)
def addContainer(self, container: ContainerInterface) -> None:
raise Exceptions.InvalidOperationError("Cannot add a container to Global stack")
## Overridden from ContainerStack
@override(ContainerStack)
def insertContainer(self, index: int, container: ContainerInterface) -> None:
raise Exceptions.InvalidOperationError("Cannot insert a container into Global stack")
## Overridden from ContainerStack
@override(ContainerStack)
def removeContainer(self, index: int) -> None:
raise Exceptions.InvalidOperationError("Cannot remove a container from Global stack")
@override(ContainerStack) @override(ContainerStack)
def deserialize(self, contents: str) -> None: def deserialize(self, contents: str) -> None:
super().deserialize(contents) super().deserialize(contents)