diff --git a/plugins/USBPrinting/PrinterConnection.py b/plugins/USBPrinting/PrinterConnection.py index dcc7d4c2c0..1ac1cb1b89 100644 --- a/plugins/USBPrinting/PrinterConnection.py +++ b/plugins/USBPrinting/PrinterConnection.py @@ -354,6 +354,15 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter): def heatupBed(self, temperature): self._sendCommand("M140 S%s" % temperature) + @pyqtSlot("long", "long","long") + def moveHead(self, x, y, z): + print("Moving head" , x , " ", y , " " , z) + self._sendCommand("G0 X%s Y%s Z%s"%(x,y,z)) + + @pyqtSlot() + def homeHead(self): + self._sendCommand("G28") + ## Directly send the command, withouth checking connection state (eg; printing). # \param cmd string with g-code def _sendCommand(self, cmd): diff --git a/resources/qml/WizardPages/Bedleveling.qml b/resources/qml/WizardPages/Bedleveling.qml index 218624263a..08b116a7e9 100644 --- a/resources/qml/WizardPages/Bedleveling.qml +++ b/resources/qml/WizardPages/Bedleveling.qml @@ -8,62 +8,47 @@ import QtQuick.Window 2.1 import UM 1.0 as UM -ColumnLayout { +Column +{ id: wizardPage - property string title - property int pageWidth - property int pageHeight - - SystemPalette{id: palette} - //signal openFile(string fileName) - //signal closeWizard() - - width: wizardPage.pageWidth - height: wizardPage.pageHeight - - Connections { - target: elementRoot - onResize: { - wizardPage.width = pageWidth - wizardPage.height = pageHeight - } + property int leveling_state: 0 + property bool three_point_leveling: true + property int platform_width: UM.Models.settingsModel.getMachineSetting("machine_width") + property int platform_height: UM.Models.settingsModel.getMachineSetting("machine_depth") + anchors.fill: parent; + property variant printer_connection: UM.USBPrinterManager.connectedPrinterList.getItem(0).printer + Component.onCompleted: printer_connection.homeHead() + Label + { + text: UM.Models.settingsModel.getItem(UM.Models.settingsModel.find("key", "machine_width")).toString() + //Component.onCompleted:console.log(UM.Models.settingsModel.getMachineSetting("machine_width")) } - - Label { - text: parent.title - font.pointSize: 18; - } - - Label { - //: Add Printer wizard page description - text: qsTr("Please select the type of printer:"); - } - - ScrollView { - Layout.fillWidth: true; - - ListView { - id: machineList; - model: UM.Models.availableMachinesModel - delegate: RadioButton { - exclusiveGroup: printerGroup; - text: model.name; - onClicked: { - ListView.view.currentIndex = index; - - } + Button + { + text: "Move to next position" + onClicked: + { + if(wizardPage.leveling_state == 0) + { + printer_connection.moveHead(platform_width /2 , platform_height,0) } + if(wizardPage.leveling_state == 1) + { + printer_connection.moveHead(platform_width , 0,0) + } + if(wizardPage.leveling_state == 2) + { + printer_connection.moveHead(0, 0 ,0) + } + + wizardPage.leveling_state++ + } } - Label { - //: Add Printer wizard field label - text: qsTr("Printer Name:"); + function threePointLeveling(width, height) + { } - TextField { id: machineName; Layout.fillWidth: true; text: machineList.model.getItem(machineList.currentIndex).name } - Item { Layout.fillWidth: true; Layout.fillHeight: true; } - - ExclusiveGroup { id: printerGroup; } } \ No newline at end of file