mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-16 11:17:49 -06:00
Remove code duplication
CURA-2116
This commit is contained in:
parent
105541ed07
commit
b2143e7d43
1 changed files with 12 additions and 14 deletions
|
@ -115,16 +115,7 @@ class MachineManager(QObject):
|
||||||
if matching_extruder and matching_extruder.findContainer({"type": "variant"}).getName() != hotend_id:
|
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.
|
# 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()
|
self._auto_hotends_changed[str(index)] = containers[0].getId()
|
||||||
Application.getInstance().messageBox(catalog.i18nc("@window:title", "Changes on the Printer"),
|
self._materialHotendChangedMessage(self._materialHotendChangedCallback)
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
Logger.log("w", "No variant found for printer definition %s with id %s" % (self._global_container_stack.getBottom().getId(), hotend_id))
|
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:
|
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.
|
# 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()
|
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?"),
|
self._materialHotendChangedMessage(self._materialHotendChangedCallback)
|
||||||
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)
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
Logger.log("w", "No material definition found for printer definition %s and GUID %s" % (definition_id, material_id))
|
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):
|
def _materialHotendChangedCallback(self, button):
|
||||||
if button == QMessageBox.No:
|
if button == QMessageBox.No:
|
||||||
self._auto_materials_changed = {}
|
self._auto_materials_changed = {}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue