diff options
author | Lipu Fei <lipu.fei815@gmail.com> | 2019-03-19 17:47:46 +0300 |
---|---|---|
committer | Lipu Fei <lipu.fei815@gmail.com> | 2019-03-19 17:47:49 +0300 |
commit | 09e317372e83eb8d3cda68f1d466d8a15d95c2a4 (patch) | |
tree | 1bbf2841d03e6fdbfd439fde605143ad3796c0f1 /plugins/UltimakerMachineActions | |
parent | 3911c3d73d3d6eb6c46e574340fe32b7c4bafa1a (diff) |
WIP: Remove UMOCheckup MachineAction
Not used any more.
Diffstat (limited to 'plugins/UltimakerMachineActions')
-rw-r--r-- | plugins/UltimakerMachineActions/UMOCheckupMachineAction.py | 193 | ||||
-rw-r--r-- | plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml | 288 |
2 files changed, 0 insertions, 481 deletions
diff --git a/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py b/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py deleted file mode 100644 index f9ad4789e5..0000000000 --- a/plugins/UltimakerMachineActions/UMOCheckupMachineAction.py +++ /dev/null @@ -1,193 +0,0 @@ -from cura.MachineAction import MachineAction -from cura.PrinterOutputDevice import PrinterOutputDevice -from UM.Application import Application -from PyQt5.QtCore import pyqtSlot, pyqtSignal, pyqtProperty - -from UM.Logger import Logger -from UM.i18n import i18nCatalog -catalog = i18nCatalog("cura") - - -## Action to check up if the self-built UMO was done correctly. -class UMOCheckupMachineAction(MachineAction): - def __init__(self): - super().__init__("UMOCheckup", catalog.i18nc("@action", "Checkup")) - self._qml_url = "UMOCheckupMachineAction.qml" - self._hotend_target_temp = 180 - self._bed_target_temp = 60 - self._output_device = None - self._bed_test_completed = False - self._hotend_test_completed = False - - # Endstop tests - self._x_min_endstop_test_completed = False - self._y_min_endstop_test_completed = False - self._z_min_endstop_test_completed = False - - self._check_started = False - - Application.getInstance().getOutputDeviceManager().outputDevicesChanged.connect(self._onOutputDevicesChanged) - - onBedTestCompleted = pyqtSignal() - onHotendTestCompleted = pyqtSignal() - - onXMinEndstopTestCompleted = pyqtSignal() - onYMinEndstopTestCompleted = pyqtSignal() - onZMinEndstopTestCompleted = pyqtSignal() - - bedTemperatureChanged = pyqtSignal() - hotendTemperatureChanged = pyqtSignal() - - def _onOutputDevicesChanged(self): - # Check if this action was started, but no output device was found the first time. - # If so, re-try now that an output device has been added/removed. - if self._output_device is None and self._check_started: - self.startCheck() - - def _getPrinterOutputDevices(self): - return [printer_output_device for printer_output_device in - Application.getInstance().getOutputDeviceManager().getOutputDevices() if - isinstance(printer_output_device, PrinterOutputDevice)] - - def _reset(self): - if self._output_device: - self._output_device.bedTemperatureChanged.disconnect(self.bedTemperatureChanged) - self._output_device.hotendTemperaturesChanged.disconnect(self.hotendTemperatureChanged) - self._output_device.bedTemperatureChanged.disconnect(self._onBedTemperatureChanged) - self._output_device.hotendTemperaturesChanged.disconnect(self._onHotendTemperatureChanged) - self._output_device.endstopStateChanged.disconnect(self._onEndstopStateChanged) - try: - self._output_device.stopPollEndstop() - except AttributeError as e: # Connection is probably not a USB connection. Something went pretty wrong if this happens. - Logger.log("e", "An exception occurred while stopping end stop polling: %s" % str(e)) - - self._output_device = None - - self._check_started = False - self.checkStartedChanged.emit() - - # Ensure everything is reset (and right signals are emitted again) - self._bed_test_completed = False - self.onBedTestCompleted.emit() - self._hotend_test_completed = False - self.onHotendTestCompleted.emit() - - self._x_min_endstop_test_completed = False - self.onXMinEndstopTestCompleted.emit() - self._y_min_endstop_test_completed = False - self.onYMinEndstopTestCompleted.emit() - self._z_min_endstop_test_completed = False - self.onZMinEndstopTestCompleted.emit() - - self.heatedBedChanged.emit() - - @pyqtProperty(bool, notify = onBedTestCompleted) - def bedTestCompleted(self): - return self._bed_test_completed - - @pyqtProperty(bool, notify = onHotendTestCompleted) - def hotendTestCompleted(self): - return self._hotend_test_completed - - @pyqtProperty(bool, notify = onXMinEndstopTestCompleted) - def xMinEndstopTestCompleted(self): - return self._x_min_endstop_test_completed - - @pyqtProperty(bool, notify=onYMinEndstopTestCompleted) - def yMinEndstopTestCompleted(self): - return self._y_min_endstop_test_completed - - @pyqtProperty(bool, notify=onZMinEndstopTestCompleted) - def zMinEndstopTestCompleted(self): - return self._z_min_endstop_test_completed - - @pyqtProperty(float, notify = bedTemperatureChanged) - def bedTemperature(self): - if not self._output_device: - return 0 - return self._output_device.bedTemperature - - @pyqtProperty(float, notify=hotendTemperatureChanged) - def hotendTemperature(self): - if not self._output_device: - return 0 - return self._output_device.hotendTemperatures[0] - - def _onHotendTemperatureChanged(self): - if not self._output_device: - return - if not self._hotend_test_completed: - if self._output_device.hotendTemperatures[0] + 10 > self._hotend_target_temp and self._output_device.hotendTemperatures[0] - 10 < self._hotend_target_temp: - self._hotend_test_completed = True - self.onHotendTestCompleted.emit() - - def _onBedTemperatureChanged(self): - if not self._output_device: - return - if not self._bed_test_completed: - if self._output_device.bedTemperature + 5 > self._bed_target_temp and self._output_device.bedTemperature - 5 < self._bed_target_temp: - self._bed_test_completed = True - self.onBedTestCompleted.emit() - - def _onEndstopStateChanged(self, switch_type, state): - if state: - if switch_type == "x_min": - self._x_min_endstop_test_completed = True - self.onXMinEndstopTestCompleted.emit() - elif switch_type == "y_min": - self._y_min_endstop_test_completed = True - self.onYMinEndstopTestCompleted.emit() - elif switch_type == "z_min": - self._z_min_endstop_test_completed = True - self.onZMinEndstopTestCompleted.emit() - - checkStartedChanged = pyqtSignal() - - @pyqtProperty(bool, notify = checkStartedChanged) - def checkStarted(self): - return self._check_started - - @pyqtSlot() - def startCheck(self): - self._check_started = True - self.checkStartedChanged.emit() - output_devices = self._getPrinterOutputDevices() - if output_devices: - self._output_device = output_devices[0] - try: - self._output_device.sendCommand("M18") # Turn off all motors so the user can move the axes - self._output_device.startPollEndstop() - self._output_device.bedTemperatureChanged.connect(self.bedTemperatureChanged) - self._output_device.hotendTemperaturesChanged.connect(self.hotendTemperatureChanged) - self._output_device.bedTemperatureChanged.connect(self._onBedTemperatureChanged) - self._output_device.hotendTemperaturesChanged.connect(self._onHotendTemperatureChanged) - self._output_device.endstopStateChanged.connect(self._onEndstopStateChanged) - except AttributeError as e: # Connection is probably not a USB connection. Something went pretty wrong if this happens. - Logger.log("e", "An exception occurred while starting end stop polling: %s" % str(e)) - - @pyqtSlot() - def cooldownHotend(self): - if self._output_device is not None: - self._output_device.setTargetHotendTemperature(0, 0) - - @pyqtSlot() - def cooldownBed(self): - if self._output_device is not None: - self._output_device.setTargetBedTemperature(0) - - @pyqtSlot() - def heatupHotend(self): - if self._output_device is not None: - self._output_device.setTargetHotendTemperature(0, self._hotend_target_temp) - - @pyqtSlot() - def heatupBed(self): - if self._output_device is not None: - self._output_device.setTargetBedTemperature(self._bed_target_temp) - - heatedBedChanged = pyqtSignal() - - @pyqtProperty(bool, notify = heatedBedChanged) - def hasHeatedBed(self): - global_container_stack = Application.getInstance().getGlobalContainerStack() - return global_container_stack.getProperty("machine_heated_bed", "value")
\ No newline at end of file diff --git a/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml b/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml deleted file mode 100644 index 2a01cfaa40..0000000000 --- a/plugins/UltimakerMachineActions/UMOCheckupMachineAction.qml +++ /dev/null @@ -1,288 +0,0 @@ -import UM 1.2 as UM -import Cura 1.0 as Cura - -import QtQuick 2.2 -import QtQuick.Controls 1.1 -import QtQuick.Layouts 1.1 -import QtQuick.Window 2.1 - -Cura.MachineAction -{ - anchors.fill: parent; - Item - { - id: checkupMachineAction - anchors.fill: parent; - property int leftRow: (checkupMachineAction.width * 0.40) | 0 - property int rightRow: (checkupMachineAction.width * 0.60) | 0 - property bool heatupHotendStarted: false - property bool heatupBedStarted: false - property bool printerConnected: Cura.MachineManager.printerConnected - - UM.I18nCatalog { id: catalog; name: "cura"} - Label - { - id: pageTitle - width: parent.width - text: catalog.i18nc("@title", "Check Printer") - wrapMode: Text.WordWrap - font.pointSize: 18; - } - - Label - { - id: pageDescription - anchors.top: pageTitle.bottom - anchors.topMargin: UM.Theme.getSize("default_margin").height - width: parent.width - wrapMode: Text.WordWrap - text: catalog.i18nc("@label", "It's a good idea to do a few sanity checks on your Ultimaker. You can skip this step if you know your machine is functional"); - } - - Row - { - id: startStopButtons - anchors.top: pageDescription.bottom - anchors.topMargin: UM.Theme.getSize("default_margin").height - anchors.horizontalCenter: parent.horizontalCenter - width: childrenRect.width - spacing: UM.Theme.getSize("default_margin").width - Button - { - id: startCheckButton - text: catalog.i18nc("@action:button","Start Printer Check"); - onClicked: - { - checkupMachineAction.heatupHotendStarted = false; - checkupMachineAction.heatupBedStarted = false; - manager.startCheck(); - startCheckButton.visible = false; - } - } - } - - Item - { - id: checkupContent - anchors.top: startStopButtons.bottom - anchors.topMargin: UM.Theme.getSize("default_margin").height - visible: manager.checkStarted - width: parent.width - height: 250 - ////////////////////////////////////////////////////////// - Label - { - id: connectionLabel - width: checkupMachineAction.leftRow - anchors.left: parent.left - anchors.top: parent.top - wrapMode: Text.WordWrap - text: catalog.i18nc("@label","Connection: ") - } - Label - { - id: connectionStatus - width: checkupMachineAction.rightRow - anchors.left: connectionLabel.right - anchors.top: parent.top - wrapMode: Text.WordWrap - text: checkupMachineAction.printerConnected ? catalog.i18nc("@info:status","Connected"): catalog.i18nc("@info:status","Not connected") - } - ////////////////////////////////////////////////////////// - Label - { - id: endstopXLabel - width: checkupMachineAction.leftRow - anchors.left: parent.left - anchors.top: connectionLabel.bottom - wrapMode: Text.WordWrap - text: catalog.i18nc("@label","Min endstop X: ") - visible: checkupMachineAction.printerConnected - } - Label - { - id: endstopXStatus - width: checkupMachineAction.rightRow - anchors.left: endstopXLabel.right - anchors.top: connectionLabel.bottom - wrapMode: Text.WordWrap - text: manager.xMinEndstopTestCompleted ? catalog.i18nc("@info:status","Works") : catalog.i18nc("@info:status","Not checked") - visible: checkupMachineAction.printerConnected - } - ////////////////////////////////////////////////////////////// - Label - { - id: endstopYLabel - width: checkupMachineAction.leftRow - anchors.left: parent.left - anchors.top: endstopXLabel.bottom - wrapMode: Text.WordWrap - text: catalog.i18nc("@label","Min endstop Y: ") - visible: checkupMachineAction.printerConnected - } - Label - { - id: endstopYStatus - width: checkupMachineAction.rightRow - anchors.left: endstopYLabel.right - anchors.top: endstopXLabel.bottom - wrapMode: Text.WordWrap - text: manager.yMinEndstopTestCompleted ? catalog.i18nc("@info:status","Works") : catalog.i18nc("@info:status","Not checked") - visible: checkupMachineAction.printerConnected - } - ///////////////////////////////////////////////////////////////////// - Label - { - id: endstopZLabel - width: checkupMachineAction.leftRow - anchors.left: parent.left - anchors.top: endstopYLabel.bottom - wrapMode: Text.WordWrap - text: catalog.i18nc("@label","Min endstop Z: ") - visible: checkupMachineAction.printerConnected - } - Label - { - id: endstopZStatus - width: checkupMachineAction.rightRow - anchors.left: endstopZLabel.right - anchors.top: endstopYLabel.bottom - wrapMode: Text.WordWrap - text: manager.zMinEndstopTestCompleted ? catalog.i18nc("@info:status","Works") : catalog.i18nc("@info:status","Not checked") - visible: checkupMachineAction.printerConnected - } - //////////////////////////////////////////////////////////// - Label - { - id: nozzleTempLabel - width: checkupMachineAction.leftRow - height: nozzleTempButton.height - anchors.left: parent.left - anchors.top: endstopZLabel.bottom - wrapMode: Text.WordWrap - text: catalog.i18nc("@label","Nozzle temperature check: ") - visible: checkupMachineAction.printerConnected - } - Label - { - id: nozzleTempStatus - width: (checkupMachineAction.rightRow * 0.4) | 0 - anchors.top: nozzleTempLabel.top - anchors.left: nozzleTempLabel.right - wrapMode: Text.WordWrap - text: catalog.i18nc("@info:status","Not checked") - visible: checkupMachineAction.printerConnected - } - Item - { - id: nozzleTempButton - width: (checkupMachineAction.rightRow * 0.3) | 0 - height: childrenRect.height - anchors.top: nozzleTempLabel.top - anchors.left: bedTempStatus.right - anchors.leftMargin: Math.round(UM.Theme.getSize("default_margin").width/2) - visible: checkupMachineAction.printerConnected - Button - { - text: checkupMachineAction.heatupHotendStarted ? catalog.i18nc("@action:button","Stop Heating") : catalog.i18nc("@action:button","Start Heating") - onClicked: - { - if (checkupMachineAction.heatupHotendStarted) - { - manager.cooldownHotend() - checkupMachineAction.heatupHotendStarted = false - } else - { - manager.heatupHotend() - checkupMachineAction.heatupHotendStarted = true - } - } - } - } - Label - { - id: nozzleTemp - anchors.top: nozzleTempLabel.top - anchors.left: nozzleTempButton.right - anchors.leftMargin: UM.Theme.getSize("default_margin").width - width: (checkupMachineAction.rightRow * 0.2) | 0 - wrapMode: Text.WordWrap - text: manager.hotendTemperature + "°C" - font.bold: true - visible: checkupMachineAction.printerConnected - } - ///////////////////////////////////////////////////////////////////////////// - Label - { - id: bedTempLabel - width: checkupMachineAction.leftRow - height: bedTempButton.height - anchors.left: parent.left - anchors.top: nozzleTempLabel.bottom - wrapMode: Text.WordWrap - text: catalog.i18nc("@label","Build plate temperature check:") - visible: checkupMachineAction.printerConnected && manager.hasHeatedBed - } - - Label - { - id: bedTempStatus - width: (checkupMachineAction.rightRow * 0.4) | 0 - anchors.top: bedTempLabel.top - anchors.left: bedTempLabel.right - wrapMode: Text.WordWrap - text: manager.bedTestCompleted ? catalog.i18nc("@info:status","Not checked"): catalog.i18nc("@info:status","Checked") - visible: checkupMachineAction.printerConnected && manager.hasHeatedBed - } - Item - { - id: bedTempButton - width: (checkupMachineAction.rightRow * 0.3) | 0 - height: childrenRect.height - anchors.top: bedTempLabel.top - anchors.left: bedTempStatus.right - anchors.leftMargin: Math.round(UM.Theme.getSize("default_margin").width/2) - visible: checkupMachineAction.printerConnected && manager.hasHeatedBed - Button - { - text: checkupMachineAction.heatupBedStarted ?catalog.i18nc("@action:button","Stop Heating") : catalog.i18nc("@action:button","Start Heating") - onClicked: - { - if (checkupMachineAction.heatupBedStarted) - { - manager.cooldownBed() - checkupMachineAction.heatupBedStarted = false - } else - { - manager.heatupBed() - checkupMachineAction.heatupBedStarted = true - } - } - } - } - Label - { - id: bedTemp - width: (checkupMachineAction.rightRow * 0.2) | 0 - anchors.top: bedTempLabel.top - anchors.left: bedTempButton.right - anchors.leftMargin: UM.Theme.getSize("default_margin").width - wrapMode: Text.WordWrap - text: manager.bedTemperature + "°C" - font.bold: true - visible: checkupMachineAction.printerConnected && manager.hasHeatedBed - } - Label - { - id: resultText - visible: false - anchors.top: bedTemp.bottom - anchors.topMargin: UM.Theme.getSize("default_margin").height - anchors.left: parent.left - width: parent.width - wrapMode: Text.WordWrap - text: catalog.i18nc("@label", "Everything is in order! You're done with your CheckUp.") - } - } - } -}
\ No newline at end of file |