Merge branch 'master' into feature_local_container_server

This commit is contained in:
Ghostkeeper 2017-12-08 16:03:05 +01:00
commit 1029d4509c
No known key found for this signature in database
GPG key ID: 5252B696FB5E7C7A
117 changed files with 15146 additions and 3512 deletions

View file

@ -63,7 +63,18 @@ class ContainerManager(QObject):
return ""
container = containers[0]
new_container = self.duplicateContainerInstance(container)
return new_container.getId()
## Create a duplicate of the given container instance
#
# This will create and add a duplicate of the container that was passed.
#
# \param container \type{ContainerInterface} The container to duplicate.
#
# \return The duplicated container, or None if duplication failed.
def duplicateContainerInstance(self, container):
new_container = None
new_name = self._container_registry.uniqueName(container.getName())
# Only InstanceContainer has a duplicate method at the moment.
# So fall back to serialize/deserialize when no duplicate method exists.
@ -74,10 +85,11 @@ class ContainerManager(QObject):
new_container.deserialize(container.serialize())
new_container.setName(new_name)
# TODO: we probably don't want to add it to the registry here!
if new_container:
self._container_registry.addContainer(new_container)
return new_container.getId()
return new_container
## Change the name of a specified container to a new name.
#