Prevent multiple machines having the same custom name

Caused by container vs containerstack confusion
Fixes CURA-1606 and CURA-1649
This commit is contained in:
fieldOfView 2016-06-05 14:05:56 +02:00
parent ead91db062
commit c21475abd7

View file

@ -179,8 +179,8 @@ class MachineManagerModel(QObject):
i = 1 i = 1
# Check both the id and the name, because they may not be the same and it is better if they are both unique # Check both the id and the name, because they may not be the same and it is better if they are both unique
while UM.Settings.ContainerRegistry.getInstance().findContainers(None, id = unique_name) or \ while UM.Settings.ContainerRegistry.getInstance().findContainerStacks(id = unique_name, type = "machine") or \
UM.Settings.ContainerRegistry.getInstance().findContainers(None, name = unique_name): UM.Settings.ContainerRegistry.getInstance().findContainerStacks(name = unique_name, type = "machine"):
i += 1 i += 1
unique_name = "%s #%d" % (name, i) unique_name = "%s #%d" % (name, i)