mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-03 20:13:56 -06:00
Be a bit more gracefull when adding a machine failed
This seems to happen for people that manually add machines to cura but mess something up when copying the files. CURA-3X
This commit is contained in:
parent
27c6cb4c1e
commit
670a106957
3 changed files with 13 additions and 7 deletions
|
@ -58,7 +58,10 @@ class CuraStackBuilder:
|
||||||
# Create ExtruderStacks
|
# Create ExtruderStacks
|
||||||
extruder_dict = machine_definition.getMetaDataEntry("machine_extruder_trains")
|
extruder_dict = machine_definition.getMetaDataEntry("machine_extruder_trains")
|
||||||
for position in extruder_dict:
|
for position in extruder_dict:
|
||||||
cls.createExtruderStackWithDefaultSetup(new_global_stack, position)
|
try:
|
||||||
|
cls.createExtruderStackWithDefaultSetup(new_global_stack, position)
|
||||||
|
except IndexError:
|
||||||
|
return None
|
||||||
|
|
||||||
for new_extruder in new_global_stack.extruders.values(): # Only register the extruders if we're sure that all of them are correct.
|
for new_extruder in new_global_stack.extruders.values(): # Only register the extruders if we're sure that all of them are correct.
|
||||||
registry.addContainer(new_extruder)
|
registry.addContainer(new_extruder)
|
||||||
|
|
|
@ -347,9 +347,9 @@ class MachineManager(QObject):
|
||||||
return cast(GlobalStack, machine)
|
return cast(GlobalStack, machine)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@pyqtSlot(str)
|
@pyqtSlot(str, result=bool)
|
||||||
@pyqtSlot(str, str)
|
@pyqtSlot(str, str, result = bool)
|
||||||
def addMachine(self, definition_id: str, name: Optional[str] = None) -> None:
|
def addMachine(self, definition_id: str, name: Optional[str] = None) -> bool:
|
||||||
Logger.log("i", "Trying to add a machine with the definition id [%s]", definition_id)
|
Logger.log("i", "Trying to add a machine with the definition id [%s]", definition_id)
|
||||||
if name is None:
|
if name is None:
|
||||||
definitions = CuraContainerRegistry.getInstance().findDefinitionContainers(id = definition_id)
|
definitions = CuraContainerRegistry.getInstance().findDefinitionContainers(id = definition_id)
|
||||||
|
@ -364,6 +364,8 @@ class MachineManager(QObject):
|
||||||
self.setActiveMachine(new_stack.getId())
|
self.setActiveMachine(new_stack.getId())
|
||||||
else:
|
else:
|
||||||
Logger.log("w", "Failed creating a new machine!")
|
Logger.log("w", "Failed creating a new machine!")
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
def _checkStacksHaveErrors(self) -> bool:
|
def _checkStacksHaveErrors(self) -> bool:
|
||||||
time_start = time.time()
|
time_start = time.time()
|
||||||
|
|
|
@ -151,9 +151,10 @@ Item
|
||||||
// Create a local printer
|
// Create a local printer
|
||||||
const localPrinterItem = addLocalPrinterDropDown.contentItem.currentItem
|
const localPrinterItem = addLocalPrinterDropDown.contentItem.currentItem
|
||||||
const printerName = addLocalPrinterDropDown.contentItem.printerName
|
const printerName = addLocalPrinterDropDown.contentItem.printerName
|
||||||
Cura.MachineManager.addMachine(localPrinterItem.id, printerName)
|
if(Cura.MachineManager.addMachine(localPrinterItem.id, printerName))
|
||||||
|
{
|
||||||
base.showNextPage()
|
base.showNextPage()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue