Wizardpages without hack

Contributes to #CURA-256
Contributes to #429
This commit is contained in:
Tamara Hogenhout 2015-11-05 18:17:47 +01:00
parent 831419d110
commit 968d72863e
3 changed files with 48 additions and 49 deletions

View File

@ -7,6 +7,8 @@ import QtQuick.Layouts 1.1
import QtQuick.Window 2.1
import UM 1.1 as UM
import Cura 1.0 as Cura
import ".."
Item
{
@ -15,11 +17,22 @@ 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()
UM.I18nCatalog { id: catalog; name:"cura"}
property variant wizard: null;
Connections
{
target: wizardPage.wizard
onNextClicked: //You can add functions here that get triggered when the final button is clicked in the wizard-element
{
if(wizardPage.wizard.lastPage == true){
wizardPage.wizard.visible = false
}
}
}
Label
{
@ -61,7 +74,6 @@ Item
id: bedlevelingButton
anchors.top: parent.top
anchors.left: parent.left
enabled: !alreadyTested
text: catalog.i18nc("@action:button","Move to Next Position");
onClicked:
{
@ -79,7 +91,6 @@ Item
}
wizardPage.leveling_state++
if (wizardPage.leveling_state >= 3){
base.addOriginalProgress.bedLeveling = true
resultText.visible = true
skipBedlevelingButton.enabled = false
bedlevelingButton.enabled = false
@ -91,7 +102,6 @@ Item
Button
{
id: skipBedlevelingButton
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 ? bedlevelingButton.right : parent.left
@ -104,7 +114,7 @@ Item
Label
{
id: resultText
visible: alreadyTested
visible: false
anchors.top: bedlevelingWrapper.bottom
anchors.topMargin: UM.Theme.sizes.default_margin.height
anchors.left: parent.left

View File

@ -17,11 +17,8 @@ Item
Component.onDestruction:
{
base.addOriginalProgress.upgrades[0] = extruderCheckBox.checked
base.addOriginalProgress.upgrades[1] = heatedBedCheckBox1.checked
base.addOriginalProgress.upgrades[2] = heatedBedCheckBox2.checked
if (extruderCheckBox.checked == true){
UM.MachineManager.setMachineSettingValue("machine_extruder_drive_upgrade", true);
UM.MachineManager.setMachineSettingValue("machine_extruder_drive_upgrade", true)
}
if (heatedBedCheckBox1.checked == true || heatedBedCheckBox2.checked == true){
UM.MachineManager.setMachineSettingValue("machine_heated_bed", true)
@ -58,14 +55,14 @@ Item
{
id: extruderCheckBox
text: catalog.i18nc("@option:check","Extruder driver ugrades")
checked: base.addOriginalProgress.upgrades[0]
checked: true
}
CheckBox
{
id: heatedBedCheckBox1
text: catalog.i18nc("@option:check","Heated printer bed (standard kit)")
text: catalog.i18nc("@option:check","Heated printer bed")
y: extruderCheckBox.height * 1
checked: base.addOriginalProgress.upgrades[1]
checked: false
onClicked: {
if (heatedBedCheckBox2.checked == true)
heatedBedCheckBox2.checked = false
@ -76,7 +73,7 @@ Item
id: heatedBedCheckBox2
text: catalog.i18nc("@option:check","Heated printer bed (self built)")
y: extruderCheckBox.height * 2
checked: base.addOriginalProgress.upgrades[2]
checked: false
onClicked: {
if (heatedBedCheckBox1.checked == true)
heatedBedCheckBox1.checked = false

View File

@ -14,35 +14,40 @@ 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
UM.I18nCatalog { id: catalog; name:"cura"}
property var checkupProgress: {
"connection": false,
"endstopX": wizardPage.x_min_pressed,
"endstopY": wizardPage.y_min_pressed,
"endstopZ": wizardPage.z_min_pressed,
"nozzleTemp": false,
"bedTemp": false
}
property variant printer_connection: {
if (UM.USBPrinterManager.connectedPrinterList.rowCount() != 0){
base.addOriginalProgress.checkUp[0] = true
checkTotalCheckUp()
wizardPage.checkupProgress.connection = true
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){
for(var property in checkupProgress){
if (checkupProgress[property] == false){
allDone = false
}
}
if (allDone == true){
base.addOriginalProgress.checkUp[base.addOriginalProgress.checkUp.length] = true
skipCheckButton.enabled = false
resultText.visible = true
}
@ -91,7 +96,7 @@ Item
id: startCheckButton
anchors.top: parent.top
anchors.left: parent.left
enabled: !alreadyTested
//enabled: !alreadyTested
text: catalog.i18nc("@action:button","Start Printer Check");
onClicked: {
checkupContent.visible = true
@ -107,7 +112,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
//enabled: !alreadyTested
text: catalog.i18nc("@action:button","Skip Printer Check");
onClicked: {
base.currentPage += 1
@ -119,7 +124,7 @@ Item
id: checkupContent
anchors.top: startStopButtons.bottom
anchors.topMargin: UM.Theme.sizes.default_margin.height
visible: alreadyTested
visible: false
//////////////////////////////////////////////////////////
Label
{
@ -156,7 +161,7 @@ Item
anchors.left: endstopXLabel.right
anchors.top: connectionLabel.bottom
wrapMode: Text.WordWrap
text: x_min_pressed || base.addOriginalProgress.checkUp[1] ? catalog.i18nc("@info:status","Works") : catalog.i18nc("@info:status","Not checked")
text: x_min_pressed ? catalog.i18nc("@info:status","Works") : catalog.i18nc("@info:status","Not checked")
}
//////////////////////////////////////////////////////////////
Label
@ -175,7 +180,7 @@ Item
anchors.left: endstopYLabel.right
anchors.top: endstopXLabel.bottom
wrapMode: Text.WordWrap
text: y_min_pressed || base.addOriginalProgress.checkUp[2] ? catalog.i18nc("@info:status","Works") : catalog.i18nc("@info:status","Not checked")
text: y_min_pressed ? catalog.i18nc("@info:status","Works") : catalog.i18nc("@info:status","Not checked")
}
/////////////////////////////////////////////////////////////////////
Label
@ -194,7 +199,7 @@ Item
anchors.left: endstopZLabel.right
anchors.top: endstopYLabel.bottom
wrapMode: Text.WordWrap
text: z_min_pressed || base.addOriginalProgress.checkUp[3] ? catalog.i18nc("@info:status","Works") : catalog.i18nc("@info:status","Not checked")
text: z_min_pressed ? catalog.i18nc("@info:status","Works") : catalog.i18nc("@info:status","Not checked")
}
////////////////////////////////////////////////////////////
Label
@ -233,14 +238,9 @@ Item
{
if(printer_connection != null)
{
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
}
nozzleTempStatus.text = catalog.i18nc("@info:progress","Checking")
printer_connection.heatupNozzle(190)
wizardPage.extruder_target_temp = 190
}
}
}
@ -294,14 +294,9 @@ Item
{
if(printer_connection != null)
{
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
}
bedTempStatus.text = catalog.i18nc("@info:progress","Checking")
printer_connection.heatupBed(60)
wizardPage.bed_target_temp = 60
}
}
}
@ -320,7 +315,7 @@ Item
Label
{
id: resultText
visible: base.addOriginalProgress.checkUp[base.addOriginalProgress.checkUp.length-1]
visible: false
anchors.top: bedTemp.bottom
anchors.topMargin: UM.Theme.sizes.default_margin.height
anchors.left: parent.left
@ -338,19 +333,16 @@ 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()
}
@ -363,7 +355,7 @@ Item
if(printer_connection != null)
{
nozzleTempStatus.text = catalog.i18nc("@info:status","Works")
base.addOriginalProgress.checkUp[4] = true
wizardPage.checkupProgress.nozzleTemp = true
checkTotalCheckUp()
printer_connection.heatupNozzle(0)
}
@ -374,7 +366,7 @@ 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
wizardPage.checkupProgress.bedTemp = true
checkTotalCheckUp()
printer_connection.heatupBed(0)
}