From 861b535f9d1c6f04f39628b8b735a047e0d8c5d7 Mon Sep 17 00:00:00 2001 From: Tamara Hogenhout Date: Wed, 14 Oct 2015 11:53:53 +0200 Subject: [PATCH] Implementing missing functionalities on the addmachine -> add original wizard contributes to #CURA-256 --- plugins/USBPrinting/PrinterConnection.py | 8 +- resources/qml/WizardPages/Bedleveling.qml | 43 ++++++--- .../qml/WizardPages/SelectUpgradedParts.qml | 6 -- .../qml/WizardPages/UltimakerCheckup.qml | 89 ++++++++++++++++--- resources/qml/WizardPages/UpgradeFirmware.qml | 4 + 5 files changed, 117 insertions(+), 33 deletions(-) diff --git a/plugins/USBPrinting/PrinterConnection.py b/plugins/USBPrinting/PrinterConnection.py index 323452b67c..b1ac8603cc 100644 --- a/plugins/USBPrinting/PrinterConnection.py +++ b/plugins/USBPrinting/PrinterConnection.py @@ -46,6 +46,7 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter): self._end_stop_thread = threading.Thread(target = self._pollEndStop) self._end_stop_thread.deamon = True + self._poll_endstop = -1 # Printer is connected self._is_connected = False @@ -237,8 +238,9 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter): @pyqtSlot() def startPollEndstop(self): - self._poll_endstop = True - self._end_stop_thread.start() + if self._poll_endstop == -1: + self._poll_endstop = True + self._end_stop_thread.start() @pyqtSlot() def stopPollEndstop(self): @@ -346,7 +348,7 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter): self._serial = None def isConnected(self): - return self._is_connected + return self._is_connected @pyqtSlot(int) def heatupNozzle(self, temperature): diff --git a/resources/qml/WizardPages/Bedleveling.qml b/resources/qml/WizardPages/Bedleveling.qml index e8c3500eae..9bb9f4f652 100644 --- a/resources/qml/WizardPages/Bedleveling.qml +++ b/resources/qml/WizardPages/Bedleveling.qml @@ -15,6 +15,7 @@ Item property bool three_point_leveling: true property int platform_width: UM.MachineManager.getSettingValue("machine_width") property int platform_height: UM.MachineManager.getSettingValue("machine_depth") + property bool alreadyTested: base.addOriginalProgress.bedLeveling anchors.fill: parent; property variant printer_connection: UM.USBPrinterManager.connectedPrinterList.getItem(0).printer Component.onCompleted: printer_connection.homeHead() @@ -40,7 +41,7 @@ Item } Label { - id: bedelevelingText + id: bedlevelingText anchors.top: pageDescription.bottom anchors.topMargin: UM.Theme.sizes.default_margin.height width: parent.width @@ -49,47 +50,69 @@ Item } Item{ - anchors.top: bedelevelingText.bottom + id: bedlevelingWrapper + anchors.top: bedlevelingText.bottom anchors.topMargin: UM.Theme.sizes.default_margin.height anchors.horizontalCenter: parent.horizontalCenter - width: bedelevelingButton.width + skipBedlevelingButton.width + UM.Theme.sizes.default_margin.height < wizardPage.width ? bedelevelingButton.width + skipBedlevelingButton.width + UM.Theme.sizes.default_margin.height : wizardPage.width + height: skipBedlevelingButton.height + width: bedlevelingButton.width + skipBedlevelingButton.width + UM.Theme.sizes.default_margin.height < wizardPage.width ? bedlevelingButton.width + skipBedlevelingButton.width + UM.Theme.sizes.default_margin.height : wizardPage.width Button { - id: bedelevelingButton + id: bedlevelingButton anchors.top: parent.top anchors.left: parent.left + enabled: !alreadyTested text: catalog.i18nc("@action:button","Move to Next Position"); onClicked: { if(wizardPage.leveling_state == 0) { - printer_connection.moveHead(platform_width /2 , platform_height,0) + printer_connection.moveHead(platform_width, 0 ,0) } if(wizardPage.leveling_state == 1) { - printer_connection.moveHead(platform_width , 0,0) + printer_connection.moveHead(platform_width/2, platform_height, 0) } if(wizardPage.leveling_state == 2) { - printer_connection.moveHead(0, 0 ,0) + printer_connection.moveHead(0, 0, 0) } wizardPage.leveling_state++ - + if (wizardPage.leveling_state >= 3){ + base.addOriginalProgress.bedLeveling = true + resultText.visible = true + skipBedlevelingButton.enabled = false + bedlevelingButton.enabled = false + wizardPage.leveling_state = 0 + } } } Button { id: skipBedlevelingButton - anchors.top: parent.width < wizardPage.width ? parent.top : bedelevelingButton.bottom + enabled: !alreadyTested + anchors.top: parent.width < wizardPage.width ? parent.top : bedlevelingButton.bottom anchors.topMargin: parent.width < wizardPage.width ? 0 : UM.Theme.sizes.default_margin.height/2 - anchors.left: parent.width < wizardPage.width ? bedelevelingButton.right : parent.left + anchors.left: parent.width < wizardPage.width ? bedlevelingButton.right : parent.left anchors.leftMargin: parent.width < wizardPage.width ? UM.Theme.sizes.default_margin.width : 0 text: catalog.i18nc("@action:button","Skip Bedleveling"); onClicked: base.visible = false; } } + Label + { + id: resultText + visible: alreadyTested + anchors.top: bedlevelingWrapper.bottom + anchors.topMargin: UM.Theme.sizes.default_margin.height + anchors.left: parent.left + width: parent.width + wrapMode: Text.WordWrap + text: catalog.i18nc("@label", "Everythink is in order! You're done with bedeleveling.") + } + function threePointLeveling(width, height) { diff --git a/resources/qml/WizardPages/SelectUpgradedParts.qml b/resources/qml/WizardPages/SelectUpgradedParts.qml index 409b1ad5c9..8680a478e9 100644 --- a/resources/qml/WizardPages/SelectUpgradedParts.qml +++ b/resources/qml/WizardPages/SelectUpgradedParts.qml @@ -70,12 +70,6 @@ Item heatedBedCheckBox1.checked = false } } - CheckBox - { - text: catalog.i18nc("@option:check","Dual extrusion (experimental)") - y: checkBox.height * 3 - enabled: false; - } } Label diff --git a/resources/qml/WizardPages/UltimakerCheckup.qml b/resources/qml/WizardPages/UltimakerCheckup.qml index 97d89186de..a917098b42 100644 --- a/resources/qml/WizardPages/UltimakerCheckup.qml +++ b/resources/qml/WizardPages/UltimakerCheckup.qml @@ -14,24 +14,51 @@ Item property int leftRow: wizardPage.width*0.40 property int rightRow: wizardPage.width*0.60 anchors.fill: parent; + property bool alreadyTested: base.addOriginalProgress.checkUp[base.addOriginalProgress.checkUp.length-1] property bool x_min_pressed: false property bool y_min_pressed: false property bool z_min_pressed: false property bool heater_works: false property int extruder_target_temp: 0 property int bed_target_temp: 0 - property variant printer_connection: UM.USBPrinterManager.connectedPrinterList.rowCount() != 0 ? UM.USBPrinterManager.connectedPrinterList.getItem(0).printer : null + property variant printer_connection: { + if (UM.USBPrinterManager.connectedPrinterList.rowCount() != 0){ + base.addOriginalProgress.checkUp[0] = true + checkTotalCheckUp() + return UM.USBPrinterManager.connectedPrinterList.getItem(0).printer + } + else { + return null + } + } + //property variant printer_connection: UM.USBPrinterManager.connectedPrinterList.getItem(0).printer UM.I18nCatalog { id: catalog; name:"cura"} + function checkTotalCheckUp(){ + var allDone = true + for (var i = 0; i < (base.addOriginalProgress.checkUp.length - 1); i++){ + if (base.addOriginalProgress.checkUp[i] == false){ + allDone = false + } + } + if (allDone == true){ + base.addOriginalProgress.checkUp[base.addOriginalProgress.checkUp.length] = true + skipCheckButton.enabled = false + resultText.visible = true + } + } + Component.onCompleted: { - if (printer_connection != null) + if (printer_connection != null){ printer_connection.startPollEndstop() + } } Component.onDestruction: { - if (printer_connection != null) + if (printer_connection != null){ printer_connection.stopPollEndstop() + } } Label { @@ -64,10 +91,12 @@ Item id: startCheckButton anchors.top: parent.top anchors.left: parent.left + enabled: !alreadyTested text: catalog.i18nc("@action:button","Start Printer Check"); onClicked: { checkupContent.visible = true startCheckButton.enabled = false + printer_connection.homeHead() } } @@ -78,6 +107,7 @@ Item anchors.topMargin: parent.width < wizardPage.width ? 0 : UM.Theme.sizes.default_margin.height/2 anchors.left: parent.width < wizardPage.width ? startCheckButton.right : parent.left anchors.leftMargin: parent.width < wizardPage.width ? UM.Theme.sizes.default_margin.width : 0 + enabled: !alreadyTested text: catalog.i18nc("@action:button","Skip Printer Check"); onClicked: { base.currentPage += 1 @@ -89,7 +119,7 @@ Item id: checkupContent anchors.top: startStopButtons.bottom anchors.topMargin: UM.Theme.sizes.default_margin.height - visible: false + visible: alreadyTested ////////////////////////////////////////////////////////// Label { @@ -107,7 +137,7 @@ Item anchors.left: connectionLabel.right anchors.top: parent.top wrapMode: Text.WordWrap - text: UM.USBPrinterManager.connectedPrinterList.rowCount() > 0 ? catalog.i18nc("@info:status","Done"):catalog.i18nc("@info:status","Incomplete") + text: UM.USBPrinterManager.connectedPrinterList.rowCount() > 0 || alreadyTested ? catalog.i18nc("@info:status","Done"):catalog.i18nc("@info:status","Incomplete") } ////////////////////////////////////////////////////////// Label @@ -126,7 +156,7 @@ Item anchors.left: endstopXLabel.right anchors.top: connectionLabel.bottom wrapMode: Text.WordWrap - text: x_min_pressed ? catalog.i18nc("@info:status","Works") : catalog.i18nc("@info:status","Not checked") + text: x_min_pressed || alreadyTested ? catalog.i18nc("@info:status","Works") : catalog.i18nc("@info:status","Not checked") } ////////////////////////////////////////////////////////////// Label @@ -145,7 +175,7 @@ Item anchors.left: endstopYLabel.right anchors.top: endstopXLabel.bottom wrapMode: Text.WordWrap - text: y_min_pressed ? catalog.i18nc("@info:status","Works") : catalog.i18nc("@info:status","Not checked") + text: y_min_pressed || alreadyTested ? catalog.i18nc("@info:status","Works") : catalog.i18nc("@info:status","Not checked") } ///////////////////////////////////////////////////////////////////// Label @@ -164,7 +194,7 @@ Item anchors.left: endstopZLabel.right anchors.top: endstopYLabel.bottom wrapMode: Text.WordWrap - text: z_min_pressed ? catalog.i18nc("@info:status","Works") : catalog.i18nc("@info:status","Not checked") + text: z_min_pressed || alreadyTested ? catalog.i18nc("@info:status","Works") : catalog.i18nc("@info:status","Not checked") } //////////////////////////////////////////////////////////// Label @@ -203,9 +233,14 @@ Item { if(printer_connection != null) { - nozzleTempStatus.text = catalog.i18nc("@info:progress","Checking") - printer_connection.heatupNozzle(190) - wizardPage.extruder_target_temp = 190 + if (alreadyTested){ + nozzleTempStatus.text = catalog.i18nc("@info:status","Works") + } + else { + nozzleTempStatus.text = catalog.i18nc("@info:progress","Checking") + printer_connection.heatupNozzle(190) + wizardPage.extruder_target_temp = 190 + } } } } @@ -259,9 +294,14 @@ Item { if(printer_connection != null) { - bedTempStatus.text = catalog.i18nc("@info:progress","Checking") - printer_connection.heatupBed(60) - wizardPage.bed_target_temp = 60 + if (alreadyTested){ + bedTempStatus.text = catalog.i18nc("@info:status","Works") + } + else { + bedTempStatus.text = catalog.i18nc("@info:progress","Checking") + printer_connection.heatupBed(60) + wizardPage.bed_target_temp = 60 + } } } } @@ -277,6 +317,17 @@ Item text: printer_connection != null ? printer_connection.bedTemperature + "°C": "0°C" font.bold: true } + Label + { + id: resultText + visible: base.addOriginalProgress.checkUp[base.addOriginalProgress.checkUp.length-1] + anchors.top: bedTemp.bottom + anchors.topMargin: UM.Theme.sizes.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.") + } } @@ -287,15 +338,21 @@ Item { if(key == "x_min") { + base.addOriginalProgress.checkUp[1] = true x_min_pressed = true + checkTotalCheckUp() } if(key == "y_min") { + base.addOriginalProgress.checkUp[2] = true y_min_pressed = true + checkTotalCheckUp() } if(key == "z_min") { + base.addOriginalProgress.checkUp[3] = true z_min_pressed = true + checkTotalCheckUp() } } @@ -306,6 +363,8 @@ Item if(printer_connection != null) { nozzleTempStatus.text = catalog.i18nc("@info:status","Works") + base.addOriginalProgress.checkUp[4] = true + checkTotalCheckUp() printer_connection.heatupNozzle(0) } } @@ -315,6 +374,8 @@ Item if(printer_connection.bedTemperature > wizardPage.bed_target_temp - 5 && printer_connection.bedTemperature < wizardPage.bed_target_temp + 5) { bedTempStatus.text = catalog.i18nc("@info:status","Works") + base.addOriginalProgress.checkUp[5] = true + checkTotalCheckUp() printer_connection.heatupBed(0) } } diff --git a/resources/qml/WizardPages/UpgradeFirmware.qml b/resources/qml/WizardPages/UpgradeFirmware.qml index edf075ee60..1e91ea2468 100644 --- a/resources/qml/WizardPages/UpgradeFirmware.qml +++ b/resources/qml/WizardPages/UpgradeFirmware.qml @@ -14,6 +14,7 @@ Item SystemPalette{id: palette} UM.I18nCatalog { id: catalog; name:"cura"} + property variant printer_connection: UM.USBPrinterManager.connectedPrinterList.rowCount() != 0 ? UM.USBPrinterManager.connectedPrinterList.getItem(0).printer : null Label { id: pageTitle @@ -61,6 +62,9 @@ Item anchors.top: parent.top anchors.left: parent.left text: catalog.i18nc("@action:button","Upgrade to Marlin Firmware"); + onClicked: { + printer_connection.updateAllFirmware + } } Button { id: skipUpgradeButton