mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 15:44:04 -06: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
2 changed files with 8 additions and 2 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue