Move the "Changes on Printer" dialog to JediWifiPrinting

...to have full control over the terminology
CURA-2116
This commit is contained in:
fieldOfView 2016-08-16 16:48:35 +02:00
parent b2143e7d43
commit 063faf1520
2 changed files with 14 additions and 14 deletions

View file

@ -1,10 +1,15 @@
from UM.i18n import i18nCatalog
from UM.OutputDevice.OutputDevice import OutputDevice from UM.OutputDevice.OutputDevice import OutputDevice
from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject
from PyQt5.QtWidgets import QMessageBox
from enum import IntEnum # For the connection state tracking. from enum import IntEnum # For the connection state tracking.
from UM.Logger import Logger from UM.Logger import Logger
from UM.Application import Application
from UM.Signal import signalemitter from UM.Signal import signalemitter
i18n_catalog = i18nCatalog("cura")
## Printer output device adds extra interface options on top of output device. ## Printer output device adds extra interface options on top of output device.
# #
# The assumption is made the printer is a FDM printer. # The assumption is made the printer is a FDM printer.
@ -276,6 +281,11 @@ class PrinterOutputDevice(QObject, OutputDevice):
self._hotend_ids[index] = hotend_id self._hotend_ids[index] = hotend_id
self.hotendIdChanged.emit(index, hotend_id) self.hotendIdChanged.emit(index, hotend_id)
## Let the user decide if the hotends and/or material should be synced with the printer
# NB: the UX needs to be implemented by the plugin
def materialHotendChangedMessage(self, callback):
Logger.log("w", "materialHotendChangedMessage needs to be implemented, returning 'Yes'")
callback(QMessageBox.Yes)
## Attempt to establish connection ## Attempt to establish connection
def connect(self): def connect(self):
@ -329,7 +339,7 @@ class PrinterOutputDevice(QObject, OutputDevice):
return self._head_z return self._head_z
## Update the saved position of the head ## Update the saved position of the head
# This function should be called when a new position for the head is recieved. # This function should be called when a new position for the head is received.
def _updateHeadPosition(self, x, y ,z): def _updateHeadPosition(self, x, y ,z):
position_changed = False position_changed = False
if self._head_x != x: if self._head_x != x:

View file

@ -115,7 +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()
self._materialHotendChangedMessage(self._materialHotendChangedCallback) self._printer_output_devices[0].materialHotendChangedMessage(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))
@ -155,20 +155,10 @@ 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()
self._materialHotendChangedMessage(self._materialHotendChangedCallback) self._printer_output_devices[0].materialHotendChangedMessage(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 = {}