mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 15:55:53 +08:00
Add method to machine manager to get a machine stack by definition id
This commit is contained in:
parent
cd01b096b5
commit
5a8f2040d3
@ -306,6 +306,14 @@ class MachineManager(QObject):
|
||||
|
||||
self.__emitChangedSignals()
|
||||
|
||||
@staticmethod
|
||||
def getMachine(definition_id: str) -> Optional["GlobalStack"]:
|
||||
machines = ContainerRegistry.getInstance().findContainerStacks(type = "machine")
|
||||
for machine in machines:
|
||||
if machine.definition.getId() == definition_id:
|
||||
return machine
|
||||
return None
|
||||
|
||||
@pyqtSlot(str, str)
|
||||
def addMachine(self, name: str, definition_id: str) -> None:
|
||||
new_stack = CuraStackBuilder.createMachine(name, definition_id)
|
||||
|
Loading…
x
Reference in New Issue
Block a user