Switch the order of name & id in addMachine call

This makes it possible for the name to not be set, in which case it will
default to the name provided by the definition

CURA-6179
This commit is contained in:
Jaime van Kessel 2019-02-26 10:45:18 +01:00
parent 889bc8a529
commit 5c354eb6a3
2 changed files with 8 additions and 2 deletions

View file

@ -386,8 +386,14 @@ class MachineManager(QObject):
return machine
return None
@pyqtSlot(str)
@pyqtSlot(str, str)
def addMachine(self, name: str, definition_id: str) -> None:
def addMachine(self, definition_id: str, name: Optional[str] = None) -> None:
if name is None:
definitions = CuraContainerRegistry.getInstance().findDefinitionContainers(id = definition_id)
if definitions:
name = definitions[0].getName()
new_stack = CuraStackBuilder.createMachine(name, definition_id)
if new_stack:
# Instead of setting the global container stack here, we set the active machine and so the signals are emitted