Implementing missing functionalities on the addmachine -> add original wizard

contributes to #CURA-256
This commit is contained in:
Tamara Hogenhout 2015-10-14 11:53:53 +02:00
parent 463fbae9aa
commit 861b535f9d
5 changed files with 117 additions and 33 deletions

View file

@ -46,6 +46,7 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter):
self._end_stop_thread = threading.Thread(target = self._pollEndStop) self._end_stop_thread = threading.Thread(target = self._pollEndStop)
self._end_stop_thread.deamon = True self._end_stop_thread.deamon = True
self._poll_endstop = -1
# Printer is connected # Printer is connected
self._is_connected = False self._is_connected = False
@ -237,6 +238,7 @@ class PrinterConnection(OutputDevice, QObject, SignalEmitter):
@pyqtSlot() @pyqtSlot()
def startPollEndstop(self): def startPollEndstop(self):
if self._poll_endstop == -1:
self._poll_endstop = True self._poll_endstop = True
self._end_stop_thread.start() self._end_stop_thread.start()

View file

@ -15,6 +15,7 @@ Item
property bool three_point_leveling: true property bool three_point_leveling: true
property int platform_width: UM.MachineManager.getSettingValue("machine_width") property int platform_width: UM.MachineManager.getSettingValue("machine_width")
property int platform_height: UM.MachineManager.getSettingValue("machine_depth") property int platform_height: UM.MachineManager.getSettingValue("machine_depth")
property bool alreadyTested: base.addOriginalProgress.bedLeveling
anchors.fill: parent; anchors.fill: parent;
property variant printer_connection: UM.USBPrinterManager.connectedPrinterList.getItem(0).printer property variant printer_connection: UM.USBPrinterManager.connectedPrinterList.getItem(0).printer
Component.onCompleted: printer_connection.homeHead() Component.onCompleted: printer_connection.homeHead()
@ -40,7 +41,7 @@ Item
} }
Label Label
{ {
id: bedelevelingText id: bedlevelingText
anchors.top: pageDescription.bottom anchors.top: pageDescription.bottom
anchors.topMargin: UM.Theme.sizes.default_margin.height anchors.topMargin: UM.Theme.sizes.default_margin.height
width: parent.width width: parent.width
@ -49,47 +50,69 @@ Item
} }
Item{ Item{
anchors.top: bedelevelingText.bottom id: bedlevelingWrapper
anchors.top: bedlevelingText.bottom
anchors.topMargin: UM.Theme.sizes.default_margin.height anchors.topMargin: UM.Theme.sizes.default_margin.height
anchors.horizontalCenter: parent.horizontalCenter 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 Button
{ {
id: bedelevelingButton id: bedlevelingButton
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
enabled: !alreadyTested
text: catalog.i18nc("@action:button","Move to Next Position"); text: catalog.i18nc("@action:button","Move to Next Position");
onClicked: onClicked:
{ {
if(wizardPage.leveling_state == 0) 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) 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) if(wizardPage.leveling_state == 2)
{ {
printer_connection.moveHead(0, 0, 0) printer_connection.moveHead(0, 0, 0)
} }
wizardPage.leveling_state++ 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 Button
{ {
id: skipBedlevelingButton 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.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 anchors.leftMargin: parent.width < wizardPage.width ? UM.Theme.sizes.default_margin.width : 0
text: catalog.i18nc("@action:button","Skip Bedleveling"); text: catalog.i18nc("@action:button","Skip Bedleveling");
onClicked: base.visible = false; 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) function threePointLeveling(width, height)
{ {

View file

@ -70,12 +70,6 @@ Item
heatedBedCheckBox1.checked = false heatedBedCheckBox1.checked = false
} }
} }
CheckBox
{
text: catalog.i18nc("@option:check","Dual extrusion (experimental)")
y: checkBox.height * 3
enabled: false;
}
} }
Label Label

View file

@ -14,25 +14,52 @@ Item
property int leftRow: wizardPage.width*0.40 property int leftRow: wizardPage.width*0.40
property int rightRow: wizardPage.width*0.60 property int rightRow: wizardPage.width*0.60
anchors.fill: parent; anchors.fill: parent;
property bool alreadyTested: base.addOriginalProgress.checkUp[base.addOriginalProgress.checkUp.length-1]
property bool x_min_pressed: false property bool x_min_pressed: false
property bool y_min_pressed: false property bool y_min_pressed: false
property bool z_min_pressed: false property bool z_min_pressed: false
property bool heater_works: false property bool heater_works: false
property int extruder_target_temp: 0 property int extruder_target_temp: 0
property int bed_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"} 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: Component.onCompleted:
{ {
if (printer_connection != null) if (printer_connection != null){
printer_connection.startPollEndstop() printer_connection.startPollEndstop()
} }
}
Component.onDestruction: Component.onDestruction:
{ {
if (printer_connection != null) if (printer_connection != null){
printer_connection.stopPollEndstop() printer_connection.stopPollEndstop()
} }
}
Label Label
{ {
id: pageTitle id: pageTitle
@ -64,10 +91,12 @@ Item
id: startCheckButton id: startCheckButton
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
enabled: !alreadyTested
text: catalog.i18nc("@action:button","Start Printer Check"); text: catalog.i18nc("@action:button","Start Printer Check");
onClicked: { onClicked: {
checkupContent.visible = true checkupContent.visible = true
startCheckButton.enabled = false 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.topMargin: parent.width < wizardPage.width ? 0 : UM.Theme.sizes.default_margin.height/2
anchors.left: parent.width < wizardPage.width ? startCheckButton.right : parent.left anchors.left: parent.width < wizardPage.width ? startCheckButton.right : parent.left
anchors.leftMargin: parent.width < wizardPage.width ? UM.Theme.sizes.default_margin.width : 0 anchors.leftMargin: parent.width < wizardPage.width ? UM.Theme.sizes.default_margin.width : 0
enabled: !alreadyTested
text: catalog.i18nc("@action:button","Skip Printer Check"); text: catalog.i18nc("@action:button","Skip Printer Check");
onClicked: { onClicked: {
base.currentPage += 1 base.currentPage += 1
@ -89,7 +119,7 @@ Item
id: checkupContent id: checkupContent
anchors.top: startStopButtons.bottom anchors.top: startStopButtons.bottom
anchors.topMargin: UM.Theme.sizes.default_margin.height anchors.topMargin: UM.Theme.sizes.default_margin.height
visible: false visible: alreadyTested
////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////
Label Label
{ {
@ -107,7 +137,7 @@ Item
anchors.left: connectionLabel.right anchors.left: connectionLabel.right
anchors.top: parent.top anchors.top: parent.top
wrapMode: Text.WordWrap 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 Label
@ -126,7 +156,7 @@ Item
anchors.left: endstopXLabel.right anchors.left: endstopXLabel.right
anchors.top: connectionLabel.bottom anchors.top: connectionLabel.bottom
wrapMode: Text.WordWrap 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 Label
@ -145,7 +175,7 @@ Item
anchors.left: endstopYLabel.right anchors.left: endstopYLabel.right
anchors.top: endstopXLabel.bottom anchors.top: endstopXLabel.bottom
wrapMode: Text.WordWrap 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 Label
@ -164,7 +194,7 @@ Item
anchors.left: endstopZLabel.right anchors.left: endstopZLabel.right
anchors.top: endstopYLabel.bottom anchors.top: endstopYLabel.bottom
wrapMode: Text.WordWrap 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 Label
@ -203,6 +233,10 @@ Item
{ {
if(printer_connection != null) if(printer_connection != null)
{ {
if (alreadyTested){
nozzleTempStatus.text = catalog.i18nc("@info:status","Works")
}
else {
nozzleTempStatus.text = catalog.i18nc("@info:progress","Checking") nozzleTempStatus.text = catalog.i18nc("@info:progress","Checking")
printer_connection.heatupNozzle(190) printer_connection.heatupNozzle(190)
wizardPage.extruder_target_temp = 190 wizardPage.extruder_target_temp = 190
@ -210,6 +244,7 @@ Item
} }
} }
} }
}
Label Label
{ {
id: nozzleTemp id: nozzleTemp
@ -259,6 +294,10 @@ Item
{ {
if(printer_connection != null) if(printer_connection != null)
{ {
if (alreadyTested){
bedTempStatus.text = catalog.i18nc("@info:status","Works")
}
else {
bedTempStatus.text = catalog.i18nc("@info:progress","Checking") bedTempStatus.text = catalog.i18nc("@info:progress","Checking")
printer_connection.heatupBed(60) printer_connection.heatupBed(60)
wizardPage.bed_target_temp = 60 wizardPage.bed_target_temp = 60
@ -266,6 +305,7 @@ Item
} }
} }
} }
}
Label Label
{ {
id: bedTemp id: bedTemp
@ -277,6 +317,17 @@ Item
text: printer_connection != null ? printer_connection.bedTemperature + "°C": "0°C" text: printer_connection != null ? printer_connection.bedTemperature + "°C": "0°C"
font.bold: true 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") if(key == "x_min")
{ {
base.addOriginalProgress.checkUp[1] = true
x_min_pressed = true x_min_pressed = true
checkTotalCheckUp()
} }
if(key == "y_min") if(key == "y_min")
{ {
base.addOriginalProgress.checkUp[2] = true
y_min_pressed = true y_min_pressed = true
checkTotalCheckUp()
} }
if(key == "z_min") if(key == "z_min")
{ {
base.addOriginalProgress.checkUp[3] = true
z_min_pressed = true z_min_pressed = true
checkTotalCheckUp()
} }
} }
@ -306,6 +363,8 @@ Item
if(printer_connection != null) if(printer_connection != null)
{ {
nozzleTempStatus.text = catalog.i18nc("@info:status","Works") nozzleTempStatus.text = catalog.i18nc("@info:status","Works")
base.addOriginalProgress.checkUp[4] = true
checkTotalCheckUp()
printer_connection.heatupNozzle(0) 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) if(printer_connection.bedTemperature > wizardPage.bed_target_temp - 5 && printer_connection.bedTemperature < wizardPage.bed_target_temp + 5)
{ {
bedTempStatus.text = catalog.i18nc("@info:status","Works") bedTempStatus.text = catalog.i18nc("@info:status","Works")
base.addOriginalProgress.checkUp[5] = true
checkTotalCheckUp()
printer_connection.heatupBed(0) printer_connection.heatupBed(0)
} }
} }

View file

@ -14,6 +14,7 @@ Item
SystemPalette{id: palette} SystemPalette{id: palette}
UM.I18nCatalog { id: catalog; name:"cura"} UM.I18nCatalog { id: catalog; name:"cura"}
property variant printer_connection: UM.USBPrinterManager.connectedPrinterList.rowCount() != 0 ? UM.USBPrinterManager.connectedPrinterList.getItem(0).printer : null
Label Label
{ {
id: pageTitle id: pageTitle
@ -61,6 +62,9 @@ Item
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
text: catalog.i18nc("@action:button","Upgrade to Marlin Firmware"); text: catalog.i18nc("@action:button","Upgrade to Marlin Firmware");
onClicked: {
printer_connection.updateAllFirmware
}
} }
Button { Button {
id: skipUpgradeButton id: skipUpgradeButton