diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 417e948773..3eb2dd1421 100644 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -115,16 +115,7 @@ class MachineManager(QObject): if matching_extruder and matching_extruder.findContainer({"type": "variant"}).getName() != hotend_id: # Save the material that needs to be changed. Multiple changes will be handled by the callback. self._auto_hotends_changed[str(index)] = containers[0].getId() - Application.getInstance().messageBox(catalog.i18nc("@window:title", "Changes on the Printer"), - catalog.i18nc("@label", - "Do you want to change the materials and hotends to match the material in your printer?"), - catalog.i18nc("@label", - "The materials and / or hotends on your printer were changed. For best results always slice for the materials . hotends that are inserted in your printer."), - buttons=QMessageBox.Yes + QMessageBox.No, - icon=QMessageBox.Question, - callback=self._materialHotendChangedCallback) - - + self._materialHotendChangedMessage(self._materialHotendChangedCallback) else: Logger.log("w", "No variant found for printer definition %s with id %s" % (self._global_container_stack.getBottom().getId(), hotend_id)) @@ -164,13 +155,20 @@ class MachineManager(QObject): if matching_extruder and matching_extruder.findContainer({"type":"material"}).getMetaDataEntry("GUID") != material_id: # Save the material that needs to be changed. Multiple changes will be handled by the callback. self._auto_materials_changed[str(index)] = containers[0].getId() - Application.getInstance().messageBox(catalog.i18nc("@window:title", "Changes on the Printer"), catalog.i18nc("@label", "Do you want to change the materials and hotends to match the material in your printer?"), - catalog.i18nc("@label", "The materials and / or hotends on your printer were changed. For best results always slice for the materials and hotends that are inserted in your printer."), - buttons = QMessageBox.Yes + QMessageBox.No, icon = QMessageBox.Question, callback = self._materialHotendChangedCallback) - + self._materialHotendChangedMessage(self._materialHotendChangedCallback) else: Logger.log("w", "No material definition found for printer definition %s and GUID %s" % (definition_id, material_id)) + def _materialHotendChangedMessage(self, callback): + Application.getInstance().messageBox(catalog.i18nc("@window:title", "Changes on the Printer"), + catalog.i18nc("@label", + "Do you want to change the materials and hotends to match your printer?"), + catalog.i18nc("@label", + "The materials and / or hotends on your printer were changed. For best results always slice for the materials and hotends that are inserted in your printer."), + buttons=QMessageBox.Yes + QMessageBox.No, + icon=QMessageBox.Question, + callback=callback) + def _materialHotendChangedCallback(self, button): if button == QMessageBox.No: self._auto_materials_changed = {}