mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-11 19:09:00 +08:00
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:
parent
889bc8a529
commit
5c354eb6a3
@ -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
|
||||
|
@ -303,7 +303,7 @@ UM.Dialog
|
||||
{
|
||||
base.visible = false
|
||||
var item = machineList.model.getItem(machineList.currentIndex);
|
||||
Cura.MachineManager.addMachine(machineName.text, item.id)
|
||||
Cura.MachineManager.addMachine(item.id, machineName.text)
|
||||
base.machineAdded(item.id) // Emit signal that the user added a machine.
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user