From 067449192a882bfff91f3b8c0f397d7c98af8bdd Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 14 Aug 2017 09:04:26 +0200 Subject: [PATCH 01/11] Move time/material estimates code to sidebar It sort of works but is aligned all wrong right now. Contributes to issue CURA-4149. --- resources/qml/JobSpecs.qml | 138 +----------------------------------- resources/qml/Sidebar.qml | 141 ++++++++++++++++++++++++++++++++++++- 2 files changed, 141 insertions(+), 138 deletions(-) diff --git a/resources/qml/JobSpecs.qml b/resources/qml/JobSpecs.qml index fa0ca087b7..545615aff0 100644 --- a/resources/qml/JobSpecs.qml +++ b/resources/qml/JobSpecs.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Ultimaker B.V. +// Copyright (c) 2017 Ultimaker B.V. // Cura is released under the terms of the AGPLv3 or higher. import QtQuick 2.2 @@ -23,8 +23,6 @@ Item { UM.I18nCatalog { id: catalog; name:"cura"} - property variant printDuration: PrintInformation.currentPrintTime - property variant printDurationPerFeature: PrintInformation.printTimesPerFeature property variant printMaterialLengths: PrintInformation.materialLengths property variant printMaterialWeights: PrintInformation.materialWeights property variant printMaterialCosts: PrintInformation.materialCosts @@ -144,138 +142,4 @@ Item { color: UM.Theme.getColor("text_subtext") text: CuraApplication.getSceneBoundingBoxString } - - Rectangle - { - id: specsRow - anchors.top: boundingSpec.bottom - anchors.right: parent.right - height: UM.Theme.getSize("jobspecs_line").height - - Item - { - width: parent.width - height: parent.height - - UM.TooltipArea - { - id: timeSpecPerFeatureTooltipArea - text: { - var order = ["inset_0", "inset_x", "skin", "infill", "support_infill", "support_interface", "support", "travel", "retract", "none"]; - var visible_names = { - "inset_0": catalog.i18nc("@tooltip", "Outer Wall"), - "inset_x": catalog.i18nc("@tooltip", "Inner Walls"), - "skin": catalog.i18nc("@tooltip", "Skin"), - "infill": catalog.i18nc("@tooltip", "Infill"), - "support_infill": catalog.i18nc("@tooltip", "Support Infill"), - "support_interface": catalog.i18nc("@tooltip", "Support Interface"), - "support": catalog.i18nc("@tooltip", "Support"), - "travel": catalog.i18nc("@tooltip", "Travel"), - "retract": catalog.i18nc("@tooltip", "Retractions"), - "none": catalog.i18nc("@tooltip", "Other") - }; - var result = ""; - for(var feature in order) - { - feature = order[feature]; - if(base.printDurationPerFeature[feature] && base.printDurationPerFeature[feature].totalSeconds > 0) - { - result += "
" + visible_names[feature] + ": " + base.printDurationPerFeature[feature].getDisplayString(UM.DurationFormat.Short); - } - } - result = result.replace(/^\/, ""); // remove newline before first item - return result; - } - width: childrenRect.width - height: childrenRect.height - anchors.right: lengthIcon.left - anchors.rightMargin: UM.Theme.getSize("default_margin").width - anchors.verticalCenter: parent.verticalCenter - - UM.RecolorImage - { - id: timeIcon - anchors.left: parent.left - anchors.top: parent.top - anchors.verticalCenter: parent.verticalCenter - width: UM.Theme.getSize("save_button_specs_icons").width - height: UM.Theme.getSize("save_button_specs_icons").height - sourceSize.width: width - sourceSize.height: width - color: UM.Theme.getColor("text_subtext") - source: UM.Theme.getIcon("print_time") - } - - Text - { - id: timeSpec - anchors.left: timeIcon.right - anchors.leftMargin: UM.Theme.getSize("default_margin").width / 2 - anchors.top: parent.top - font: UM.Theme.getFont("small") - color: UM.Theme.getColor("text_subtext") - text: (!base.printDuration || !base.printDuration.valid) ? catalog.i18nc("@label", "00h 00min") : base.printDuration.getDisplayString(UM.DurationFormat.Short) - } - } - UM.RecolorImage - { - id: lengthIcon - anchors.right: lengthSpec.left - anchors.rightMargin: UM.Theme.getSize("default_margin").width/2 - anchors.verticalCenter: parent.verticalCenter - width: UM.Theme.getSize("save_button_specs_icons").width - height: UM.Theme.getSize("save_button_specs_icons").height - sourceSize.width: width - sourceSize.height: width - color: UM.Theme.getColor("text_subtext") - source: UM.Theme.getIcon("category_material") - } - Text - { - id: lengthSpec - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - font: UM.Theme.getFont("small") - color: UM.Theme.getColor("text_subtext") - text: - { - var lengths = []; - var weights = []; - var costs = []; - var someCostsKnown = false; - if(base.printMaterialLengths) { - for(var index = 0; index < base.printMaterialLengths.length; index++) - { - if(base.printMaterialLengths[index] > 0) - { - lengths.push(base.printMaterialLengths[index].toFixed(2)); - weights.push(String(Math.floor(base.printMaterialWeights[index]))); - var cost = base.printMaterialCosts[index] == undefined ? 0 : base.printMaterialCosts[index].toFixed(2); - costs.push(cost); - if(cost > 0) - { - someCostsKnown = true; - } - } - } - } - if(lengths.length == 0) - { - lengths = ["0.00"]; - weights = ["0"]; - costs = ["0.00"]; - } - if(someCostsKnown) - { - return catalog.i18nc("@label", "%1 m / ~ %2 g / ~ %4 %3").arg(lengths.join(" + ")) - .arg(weights.join(" + ")).arg(costs.join(" + ")).arg(UM.Preferences.getValue("cura/currency")); - } - else - { - return catalog.i18nc("@label", "%1 m / ~ %2 g").arg(lengths.join(" + ")).arg(weights.join(" + ")); - } - } - } - } - } } diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index db5f60862d..1f18a3d031 100755 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -21,10 +21,13 @@ Rectangle property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0 property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands property var connectedPrinter: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null - property int backendState: UM.Backend.state; + property int backendState: UM.Backend.state property bool monitoringPrint: false + property variant printDuration: PrintInformation.currentPrintTime + property variant printDurationPerFeature: PrintInformation.printTimesPerFeature + color: UM.Theme.getColor("sidebar") UM.I18nCatalog { id: catalog; name:"cura"} @@ -398,6 +401,142 @@ Rectangle anchors.bottomMargin: UM.Theme.getSize("default_margin").height } + Rectangle + { + id: specsRow + anchors.left: parent.left + anchors.bottom: parent.bottom + anchors.leftMargin: UM.Theme.getSize("default_margin").width + anchors.bottomMargin: UM.Theme.getSize("default_margin").height + height: UM.Theme.getSize("jobspecs_line").height + + Item + { + width: parent.width + height: parent.height + + UM.TooltipArea + { + id: timeSpecPerFeatureTooltipArea + text: { + var order = ["inset_0", "inset_x", "skin", "infill", "support_infill", "support_interface", "support", "travel", "retract", "none"]; + var visible_names = { + "inset_0": catalog.i18nc("@tooltip", "Outer Wall"), + "inset_x": catalog.i18nc("@tooltip", "Inner Walls"), + "skin": catalog.i18nc("@tooltip", "Skin"), + "infill": catalog.i18nc("@tooltip", "Infill"), + "support_infill": catalog.i18nc("@tooltip", "Support Infill"), + "support_interface": catalog.i18nc("@tooltip", "Support Interface"), + "support": catalog.i18nc("@tooltip", "Support"), + "travel": catalog.i18nc("@tooltip", "Travel"), + "retract": catalog.i18nc("@tooltip", "Retractions"), + "none": catalog.i18nc("@tooltip", "Other") + }; + var result = ""; + for(var feature in order) + { + feature = order[feature]; + if(base.printDurationPerFeature[feature] && base.printDurationPerFeature[feature].totalSeconds > 0) + { + result += "
" + visible_names[feature] + ": " + base.printDurationPerFeature[feature].getDisplayString(UM.DurationFormat.Short); + } + } + result = result.replace(/^\/, ""); // remove newline before first item + return result; + } + width: childrenRect.width + height: childrenRect.height + anchors.right: lengthIcon.left + anchors.rightMargin: UM.Theme.getSize("default_margin").width + anchors.verticalCenter: parent.verticalCenter + + UM.RecolorImage + { + id: timeIcon + anchors.left: parent.left + anchors.top: parent.top + anchors.verticalCenter: parent.verticalCenter + width: UM.Theme.getSize("save_button_specs_icons").width + height: UM.Theme.getSize("save_button_specs_icons").height + sourceSize.width: width + sourceSize.height: width + color: UM.Theme.getColor("text_subtext") + source: UM.Theme.getIcon("print_time") + } + + Text + { + id: timeSpec + anchors.left: timeIcon.right + anchors.leftMargin: UM.Theme.getSize("default_margin").width / 2 + anchors.top: parent.top + font: UM.Theme.getFont("small") + color: UM.Theme.getColor("text_subtext") + text: (!base.printDuration || !base.printDuration.valid) ? catalog.i18nc("@label", "00h 00min") : base.printDuration.getDisplayString(UM.DurationFormat.Short) + } + } + UM.RecolorImage + { + id: lengthIcon + anchors.right: lengthSpec.left + anchors.rightMargin: UM.Theme.getSize("default_margin").width/2 + anchors.verticalCenter: parent.verticalCenter + width: UM.Theme.getSize("save_button_specs_icons").width + height: UM.Theme.getSize("save_button_specs_icons").height + sourceSize.width: width + sourceSize.height: width + color: UM.Theme.getColor("text_subtext") + source: UM.Theme.getIcon("category_material") + } + Text + { + id: lengthSpec + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + font: UM.Theme.getFont("small") + color: UM.Theme.getColor("text_subtext") + text: + { + var lengths = []; + var weights = []; + var costs = []; + var someCostsKnown = false; + if(base.printMaterialLengths) { + for(var index = 0; index < base.printMaterialLengths.length; index++) + { + if(base.printMaterialLengths[index] > 0) + { + lengths.push(base.printMaterialLengths[index].toFixed(2)); + weights.push(String(Math.floor(base.printMaterialWeights[index]))); + var cost = base.printMaterialCosts[index] == undefined ? 0 : base.printMaterialCosts[index].toFixed(2); + costs.push(cost); + if(cost > 0) + { + someCostsKnown = true; + } + } + } + } + if(lengths.length == 0) + { + lengths = ["0.00"]; + weights = ["0"]; + costs = ["0.00"]; + } + if(someCostsKnown) + { + return catalog.i18nc("@label", "%1 m / ~ %2 g / ~ %4 %3").arg(lengths.join(" + ")) + .arg(weights.join(" + ")).arg(costs.join(" + ")).arg(UM.Preferences.getValue("cura/currency")); + } + else + { + return catalog.i18nc("@label", "%1 m / ~ %2 g").arg(lengths.join(" + ")).arg(weights.join(" + ")); + } + } + } + } + } + // SaveButton and MonitorButton are actually the bottom footer panels. // "!monitoringPrint" currently means "show-settings-mode" SaveButton From 0430a274d98349d4fae00e8ae7db6066090194a6 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 14 Aug 2017 09:10:35 +0200 Subject: [PATCH 02/11] Make slicing status text smaller Makes more room for the time/material estimates. Contributes to issue CURA-4149. --- resources/qml/SaveButton.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/SaveButton.qml b/resources/qml/SaveButton.qml index 2ea7dafc91..6f6efad7f1 100644 --- a/resources/qml/SaveButton.qml +++ b/resources/qml/SaveButton.qml @@ -52,7 +52,7 @@ Item { anchors.leftMargin: UM.Theme.getSize("default_margin").width color: UM.Theme.getColor("text") - font: UM.Theme.getFont("large") + font: UM.Theme.getFont("default_bold") text: statusText; } From fb3a0b701c3faee4bafedde4bf90554fb2200633 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 14 Aug 2017 09:12:21 +0200 Subject: [PATCH 03/11] Remove superfluous item This item was just transparently being the same size as its parent, no ID or nothing. We can just remove it. Contributes to issue CURA-4149. --- resources/qml/Sidebar.qml | 192 ++++++++++++++++++-------------------- 1 file changed, 93 insertions(+), 99 deletions(-) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 1f18a3d031..f140e7e836 100755 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -410,128 +410,122 @@ Rectangle anchors.bottomMargin: UM.Theme.getSize("default_margin").height height: UM.Theme.getSize("jobspecs_line").height - Item + UM.TooltipArea { - width: parent.width - height: parent.height - - UM.TooltipArea - { - id: timeSpecPerFeatureTooltipArea - text: { - var order = ["inset_0", "inset_x", "skin", "infill", "support_infill", "support_interface", "support", "travel", "retract", "none"]; - var visible_names = { - "inset_0": catalog.i18nc("@tooltip", "Outer Wall"), - "inset_x": catalog.i18nc("@tooltip", "Inner Walls"), - "skin": catalog.i18nc("@tooltip", "Skin"), - "infill": catalog.i18nc("@tooltip", "Infill"), - "support_infill": catalog.i18nc("@tooltip", "Support Infill"), - "support_interface": catalog.i18nc("@tooltip", "Support Interface"), - "support": catalog.i18nc("@tooltip", "Support"), - "travel": catalog.i18nc("@tooltip", "Travel"), - "retract": catalog.i18nc("@tooltip", "Retractions"), - "none": catalog.i18nc("@tooltip", "Other") - }; - var result = ""; - for(var feature in order) + id: timeSpecPerFeatureTooltipArea + text: { + var order = ["inset_0", "inset_x", "skin", "infill", "support_infill", "support_interface", "support", "travel", "retract", "none"]; + var visible_names = { + "inset_0": catalog.i18nc("@tooltip", "Outer Wall"), + "inset_x": catalog.i18nc("@tooltip", "Inner Walls"), + "skin": catalog.i18nc("@tooltip", "Skin"), + "infill": catalog.i18nc("@tooltip", "Infill"), + "support_infill": catalog.i18nc("@tooltip", "Support Infill"), + "support_interface": catalog.i18nc("@tooltip", "Support Interface"), + "support": catalog.i18nc("@tooltip", "Support"), + "travel": catalog.i18nc("@tooltip", "Travel"), + "retract": catalog.i18nc("@tooltip", "Retractions"), + "none": catalog.i18nc("@tooltip", "Other") + }; + var result = ""; + for(var feature in order) + { + feature = order[feature]; + if(base.printDurationPerFeature[feature] && base.printDurationPerFeature[feature].totalSeconds > 0) { - feature = order[feature]; - if(base.printDurationPerFeature[feature] && base.printDurationPerFeature[feature].totalSeconds > 0) - { - result += "
" + visible_names[feature] + ": " + base.printDurationPerFeature[feature].getDisplayString(UM.DurationFormat.Short); - } + result += "
" + visible_names[feature] + ": " + base.printDurationPerFeature[feature].getDisplayString(UM.DurationFormat.Short); } - result = result.replace(/^\/, ""); // remove newline before first item - return result; - } - width: childrenRect.width - height: childrenRect.height - anchors.right: lengthIcon.left - anchors.rightMargin: UM.Theme.getSize("default_margin").width - anchors.verticalCenter: parent.verticalCenter - - UM.RecolorImage - { - id: timeIcon - anchors.left: parent.left - anchors.top: parent.top - anchors.verticalCenter: parent.verticalCenter - width: UM.Theme.getSize("save_button_specs_icons").width - height: UM.Theme.getSize("save_button_specs_icons").height - sourceSize.width: width - sourceSize.height: width - color: UM.Theme.getColor("text_subtext") - source: UM.Theme.getIcon("print_time") - } - - Text - { - id: timeSpec - anchors.left: timeIcon.right - anchors.leftMargin: UM.Theme.getSize("default_margin").width / 2 - anchors.top: parent.top - font: UM.Theme.getFont("small") - color: UM.Theme.getColor("text_subtext") - text: (!base.printDuration || !base.printDuration.valid) ? catalog.i18nc("@label", "00h 00min") : base.printDuration.getDisplayString(UM.DurationFormat.Short) } + result = result.replace(/^\/, ""); // remove newline before first item + return result; } + width: childrenRect.width + height: childrenRect.height + anchors.right: lengthIcon.left + anchors.rightMargin: UM.Theme.getSize("default_margin").width + anchors.verticalCenter: parent.verticalCenter + UM.RecolorImage { - id: lengthIcon - anchors.right: lengthSpec.left - anchors.rightMargin: UM.Theme.getSize("default_margin").width/2 + id: timeIcon + anchors.left: parent.left + anchors.top: parent.top anchors.verticalCenter: parent.verticalCenter width: UM.Theme.getSize("save_button_specs_icons").width height: UM.Theme.getSize("save_button_specs_icons").height sourceSize.width: width sourceSize.height: width color: UM.Theme.getColor("text_subtext") - source: UM.Theme.getIcon("category_material") + source: UM.Theme.getIcon("print_time") } + Text { - id: lengthSpec - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter + id: timeSpec + anchors.left: timeIcon.right + anchors.leftMargin: UM.Theme.getSize("default_margin").width / 2 + anchors.top: parent.top font: UM.Theme.getFont("small") color: UM.Theme.getColor("text_subtext") - text: - { - var lengths = []; - var weights = []; - var costs = []; - var someCostsKnown = false; - if(base.printMaterialLengths) { - for(var index = 0; index < base.printMaterialLengths.length; index++) + text: (!base.printDuration || !base.printDuration.valid) ? catalog.i18nc("@label", "00h 00min") : base.printDuration.getDisplayString(UM.DurationFormat.Short) + } + } + UM.RecolorImage + { + id: lengthIcon + anchors.right: lengthSpec.left + anchors.rightMargin: UM.Theme.getSize("default_margin").width/2 + anchors.verticalCenter: parent.verticalCenter + width: UM.Theme.getSize("save_button_specs_icons").width + height: UM.Theme.getSize("save_button_specs_icons").height + sourceSize.width: width + sourceSize.height: width + color: UM.Theme.getColor("text_subtext") + source: UM.Theme.getIcon("category_material") + } + Text + { + id: lengthSpec + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + font: UM.Theme.getFont("small") + color: UM.Theme.getColor("text_subtext") + text: + { + var lengths = []; + var weights = []; + var costs = []; + var someCostsKnown = false; + if(base.printMaterialLengths) { + for(var index = 0; index < base.printMaterialLengths.length; index++) + { + if(base.printMaterialLengths[index] > 0) { - if(base.printMaterialLengths[index] > 0) + lengths.push(base.printMaterialLengths[index].toFixed(2)); + weights.push(String(Math.floor(base.printMaterialWeights[index]))); + var cost = base.printMaterialCosts[index] == undefined ? 0 : base.printMaterialCosts[index].toFixed(2); + costs.push(cost); + if(cost > 0) { - lengths.push(base.printMaterialLengths[index].toFixed(2)); - weights.push(String(Math.floor(base.printMaterialWeights[index]))); - var cost = base.printMaterialCosts[index] == undefined ? 0 : base.printMaterialCosts[index].toFixed(2); - costs.push(cost); - if(cost > 0) - { - someCostsKnown = true; - } + someCostsKnown = true; } } } - if(lengths.length == 0) - { - lengths = ["0.00"]; - weights = ["0"]; - costs = ["0.00"]; - } - if(someCostsKnown) - { - return catalog.i18nc("@label", "%1 m / ~ %2 g / ~ %4 %3").arg(lengths.join(" + ")) - .arg(weights.join(" + ")).arg(costs.join(" + ")).arg(UM.Preferences.getValue("cura/currency")); - } - else - { - return catalog.i18nc("@label", "%1 m / ~ %2 g").arg(lengths.join(" + ")).arg(weights.join(" + ")); - } + } + if(lengths.length == 0) + { + lengths = ["0.00"]; + weights = ["0"]; + costs = ["0.00"]; + } + if(someCostsKnown) + { + return catalog.i18nc("@label", "%1 m / ~ %2 g / ~ %4 %3").arg(lengths.join(" + ")) + .arg(weights.join(" + ")).arg(costs.join(" + ")).arg(UM.Preferences.getValue("cura/currency")); + } + else + { + return catalog.i18nc("@label", "%1 m / ~ %2 g").arg(lengths.join(" + ")).arg(weights.join(" + ")); } } } From c4305c7b1ecf1e5202138cccba29f5b74dd6df4b Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 14 Aug 2017 09:23:56 +0200 Subject: [PATCH 04/11] Rearrange and align time/material estimates They look correct now but the log says there is a binding loop in here. We'll fix that next. Contributes to issue CURA-4149. --- resources/qml/Sidebar.qml | 189 ++++++++++++++++++-------------------- 1 file changed, 89 insertions(+), 100 deletions(-) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index f140e7e836..c8001a5efa 100755 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -403,129 +403,118 @@ Rectangle Rectangle { - id: specsRow + id: printSpecs anchors.left: parent.left anchors.bottom: parent.bottom anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.bottomMargin: UM.Theme.getSize("default_margin").height - height: UM.Theme.getSize("jobspecs_line").height - UM.TooltipArea + Rectangle { - id: timeSpecPerFeatureTooltipArea - text: { - var order = ["inset_0", "inset_x", "skin", "infill", "support_infill", "support_interface", "support", "travel", "retract", "none"]; - var visible_names = { - "inset_0": catalog.i18nc("@tooltip", "Outer Wall"), - "inset_x": catalog.i18nc("@tooltip", "Inner Walls"), - "skin": catalog.i18nc("@tooltip", "Skin"), - "infill": catalog.i18nc("@tooltip", "Infill"), - "support_infill": catalog.i18nc("@tooltip", "Support Infill"), - "support_interface": catalog.i18nc("@tooltip", "Support Interface"), - "support": catalog.i18nc("@tooltip", "Support"), - "travel": catalog.i18nc("@tooltip", "Travel"), - "retract": catalog.i18nc("@tooltip", "Retractions"), - "none": catalog.i18nc("@tooltip", "Other") - }; - var result = ""; - for(var feature in order) - { - feature = order[feature]; - if(base.printDurationPerFeature[feature] && base.printDurationPerFeature[feature].totalSeconds > 0) - { - result += "
" + visible_names[feature] + ": " + base.printDurationPerFeature[feature].getDisplayString(UM.DurationFormat.Short); - } - } - result = result.replace(/^\/, ""); // remove newline before first item - return result; - } + id: timeSpecsRow + anchors.left: parent.left + anchors.bottom: filamentSpecsRow.top width: childrenRect.width height: childrenRect.height - anchors.right: lengthIcon.left - anchors.rightMargin: UM.Theme.getSize("default_margin").width - anchors.verticalCenter: parent.verticalCenter - UM.RecolorImage + UM.TooltipArea { - id: timeIcon + id: timeSpecPerFeatureTooltipArea + width: childrenRect.width + height: childrenRect.height anchors.left: parent.left - anchors.top: parent.top anchors.verticalCenter: parent.verticalCenter - width: UM.Theme.getSize("save_button_specs_icons").width - height: UM.Theme.getSize("save_button_specs_icons").height - sourceSize.width: width - sourceSize.height: width - color: UM.Theme.getColor("text_subtext") - source: UM.Theme.getIcon("print_time") + + text: { + var order = ["inset_0", "inset_x", "skin", "infill", "support_infill", "support_interface", "support", "travel", "retract", "none"]; + var visible_names = { + "inset_0": catalog.i18nc("@tooltip", "Outer Wall"), + "inset_x": catalog.i18nc("@tooltip", "Inner Walls"), + "skin": catalog.i18nc("@tooltip", "Skin"), + "infill": catalog.i18nc("@tooltip", "Infill"), + "support_infill": catalog.i18nc("@tooltip", "Support Infill"), + "support_interface": catalog.i18nc("@tooltip", "Support Interface"), + "support": catalog.i18nc("@tooltip", "Support"), + "travel": catalog.i18nc("@tooltip", "Travel"), + "retract": catalog.i18nc("@tooltip", "Retractions"), + "none": catalog.i18nc("@tooltip", "Other") + }; + var result = ""; + for(var feature in order) + { + feature = order[feature]; + if(base.printDurationPerFeature[feature] && base.printDurationPerFeature[feature].totalSeconds > 0) + { + result += "
" + visible_names[feature] + ": " + base.printDurationPerFeature[feature].getDisplayString(UM.DurationFormat.Short); + } + } + result = result.replace(/^\/, ""); // remove newline before first item + return result; + } + + Text + { + id: timeSpec + anchors.left: parent.left + anchors.bottom: parent.bottom + font: UM.Theme.getFont("small") + color: UM.Theme.getColor("text_subtext") + text: (!base.printDuration || !base.printDuration.valid) ? catalog.i18nc("@label", "00h 00min") : base.printDuration.getDisplayString(UM.DurationFormat.Short) + } } + } + Rectangle + { + id: filamentSpecsRow + anchors.left: parent.left + anchors.bottom: parent.bottom + width: childrenRect.width + height: childrenRect.height Text { - id: timeSpec - anchors.left: timeIcon.right - anchors.leftMargin: UM.Theme.getSize("default_margin").width / 2 - anchors.top: parent.top + id: lengthSpec + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter font: UM.Theme.getFont("small") color: UM.Theme.getColor("text_subtext") - text: (!base.printDuration || !base.printDuration.valid) ? catalog.i18nc("@label", "00h 00min") : base.printDuration.getDisplayString(UM.DurationFormat.Short) - } - } - UM.RecolorImage - { - id: lengthIcon - anchors.right: lengthSpec.left - anchors.rightMargin: UM.Theme.getSize("default_margin").width/2 - anchors.verticalCenter: parent.verticalCenter - width: UM.Theme.getSize("save_button_specs_icons").width - height: UM.Theme.getSize("save_button_specs_icons").height - sourceSize.width: width - sourceSize.height: width - color: UM.Theme.getColor("text_subtext") - source: UM.Theme.getIcon("category_material") - } - Text - { - id: lengthSpec - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - font: UM.Theme.getFont("small") - color: UM.Theme.getColor("text_subtext") - text: - { - var lengths = []; - var weights = []; - var costs = []; - var someCostsKnown = false; - if(base.printMaterialLengths) { - for(var index = 0; index < base.printMaterialLengths.length; index++) - { - if(base.printMaterialLengths[index] > 0) + text: + { + var lengths = []; + var weights = []; + var costs = []; + var someCostsKnown = false; + if(base.printMaterialLengths) { + for(var index = 0; index < base.printMaterialLengths.length; index++) { - lengths.push(base.printMaterialLengths[index].toFixed(2)); - weights.push(String(Math.floor(base.printMaterialWeights[index]))); - var cost = base.printMaterialCosts[index] == undefined ? 0 : base.printMaterialCosts[index].toFixed(2); - costs.push(cost); - if(cost > 0) + if(base.printMaterialLengths[index] > 0) { - someCostsKnown = true; + lengths.push(base.printMaterialLengths[index].toFixed(2)); + weights.push(String(Math.floor(base.printMaterialWeights[index]))); + var cost = base.printMaterialCosts[index] == undefined ? 0 : base.printMaterialCosts[index].toFixed(2); + costs.push(cost); + if(cost > 0) + { + someCostsKnown = true; + } } } } - } - if(lengths.length == 0) - { - lengths = ["0.00"]; - weights = ["0"]; - costs = ["0.00"]; - } - if(someCostsKnown) - { - return catalog.i18nc("@label", "%1 m / ~ %2 g / ~ %4 %3").arg(lengths.join(" + ")) - .arg(weights.join(" + ")).arg(costs.join(" + ")).arg(UM.Preferences.getValue("cura/currency")); - } - else - { - return catalog.i18nc("@label", "%1 m / ~ %2 g").arg(lengths.join(" + ")).arg(weights.join(" + ")); + if(lengths.length == 0) + { + lengths = ["0.00"]; + weights = ["0"]; + costs = ["0.00"]; + } + if(someCostsKnown) + { + return catalog.i18nc("@label", "%1 m / ~ %2 g / ~ %4 %3").arg(lengths.join(" + ")) + .arg(weights.join(" + ")).arg(costs.join(" + ")).arg(UM.Preferences.getValue("cura/currency")); + } + else + { + return catalog.i18nc("@label", "%1 m / ~ %2 g").arg(lengths.join(" + ")).arg(weights.join(" + ")); + } } } } From e514a9f4746940e549a21696bca010fdf6b879e3 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 14 Aug 2017 09:34:52 +0200 Subject: [PATCH 05/11] Fix some binding loops Contributes to issue CURA-4149. --- resources/qml/Sidebar.qml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index c8001a5efa..67e77864a2 100755 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -414,16 +414,14 @@ Rectangle id: timeSpecsRow anchors.left: parent.left anchors.bottom: filamentSpecsRow.top - width: childrenRect.width - height: childrenRect.height UM.TooltipArea { id: timeSpecPerFeatureTooltipArea - width: childrenRect.width - height: childrenRect.height + width: timeSpec.width + height: timeSpec.height anchors.left: parent.left - anchors.verticalCenter: parent.verticalCenter + anchors.bottom: parent.bottom text: { var order = ["inset_0", "inset_x", "skin", "infill", "support_infill", "support_interface", "support", "travel", "retract", "none"]; @@ -475,7 +473,7 @@ Rectangle { id: lengthSpec anchors.left: parent.left - anchors.verticalCenter: parent.verticalCenter + anchors.bottom: parent.bottom font: UM.Theme.getFont("small") color: UM.Theme.getColor("text_subtext") text: From 454293f926d944b8d1d60757e4763e383436d87b Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 14 Aug 2017 09:38:40 +0200 Subject: [PATCH 06/11] Remove superfluous rectangles There's only one item in there. It makes no sense to group them by rows and that only makes the bindings more complicated. Contributes to issue CURA-4149. --- resources/qml/Sidebar.qml | 156 +++++++++++++++++--------------------- 1 file changed, 70 insertions(+), 86 deletions(-) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 67e77864a2..af20e05c55 100755 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -409,110 +409,94 @@ Rectangle anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.bottomMargin: UM.Theme.getSize("default_margin").height - Rectangle + UM.TooltipArea { - id: timeSpecsRow + id: timeSpecPerFeatureTooltipArea + width: timeSpec.width + height: timeSpec.height anchors.left: parent.left - anchors.bottom: filamentSpecsRow.top + anchors.bottom: lengthSpec.top - UM.TooltipArea - { - id: timeSpecPerFeatureTooltipArea - width: timeSpec.width - height: timeSpec.height - anchors.left: parent.left - anchors.bottom: parent.bottom - - text: { - var order = ["inset_0", "inset_x", "skin", "infill", "support_infill", "support_interface", "support", "travel", "retract", "none"]; - var visible_names = { - "inset_0": catalog.i18nc("@tooltip", "Outer Wall"), - "inset_x": catalog.i18nc("@tooltip", "Inner Walls"), - "skin": catalog.i18nc("@tooltip", "Skin"), - "infill": catalog.i18nc("@tooltip", "Infill"), - "support_infill": catalog.i18nc("@tooltip", "Support Infill"), - "support_interface": catalog.i18nc("@tooltip", "Support Interface"), - "support": catalog.i18nc("@tooltip", "Support"), - "travel": catalog.i18nc("@tooltip", "Travel"), - "retract": catalog.i18nc("@tooltip", "Retractions"), - "none": catalog.i18nc("@tooltip", "Other") - }; - var result = ""; - for(var feature in order) - { - feature = order[feature]; - if(base.printDurationPerFeature[feature] && base.printDurationPerFeature[feature].totalSeconds > 0) - { - result += "
" + visible_names[feature] + ": " + base.printDurationPerFeature[feature].getDisplayString(UM.DurationFormat.Short); - } - } - result = result.replace(/^\/, ""); // remove newline before first item - return result; - } - - Text + text: { + var order = ["inset_0", "inset_x", "skin", "infill", "support_infill", "support_interface", "support", "travel", "retract", "none"]; + var visible_names = { + "inset_0": catalog.i18nc("@tooltip", "Outer Wall"), + "inset_x": catalog.i18nc("@tooltip", "Inner Walls"), + "skin": catalog.i18nc("@tooltip", "Skin"), + "infill": catalog.i18nc("@tooltip", "Infill"), + "support_infill": catalog.i18nc("@tooltip", "Support Infill"), + "support_interface": catalog.i18nc("@tooltip", "Support Interface"), + "support": catalog.i18nc("@tooltip", "Support"), + "travel": catalog.i18nc("@tooltip", "Travel"), + "retract": catalog.i18nc("@tooltip", "Retractions"), + "none": catalog.i18nc("@tooltip", "Other") + }; + var result = ""; + for(var feature in order) { - id: timeSpec - anchors.left: parent.left - anchors.bottom: parent.bottom - font: UM.Theme.getFont("small") - color: UM.Theme.getColor("text_subtext") - text: (!base.printDuration || !base.printDuration.valid) ? catalog.i18nc("@label", "00h 00min") : base.printDuration.getDisplayString(UM.DurationFormat.Short) + feature = order[feature]; + if(base.printDurationPerFeature[feature] && base.printDurationPerFeature[feature].totalSeconds > 0) + { + result += "
" + visible_names[feature] + ": " + base.printDurationPerFeature[feature].getDisplayString(UM.DurationFormat.Short); + } } + result = result.replace(/^\/, ""); // remove newline before first item + return result; } - } - Rectangle - { - id: filamentSpecsRow - anchors.left: parent.left - anchors.bottom: parent.bottom - width: childrenRect.width - height: childrenRect.height Text { - id: lengthSpec + id: timeSpec anchors.left: parent.left anchors.bottom: parent.bottom font: UM.Theme.getFont("small") color: UM.Theme.getColor("text_subtext") - text: - { - var lengths = []; - var weights = []; - var costs = []; - var someCostsKnown = false; - if(base.printMaterialLengths) { - for(var index = 0; index < base.printMaterialLengths.length; index++) + text: (!base.printDuration || !base.printDuration.valid) ? catalog.i18nc("@label", "00h 00min") : base.printDuration.getDisplayString(UM.DurationFormat.Short) + } + } + Text + { + id: lengthSpec + anchors.left: parent.left + anchors.bottom: parent.bottom + font: UM.Theme.getFont("small") + color: UM.Theme.getColor("text_subtext") + text: + { + var lengths = []; + var weights = []; + var costs = []; + var someCostsKnown = false; + if(base.printMaterialLengths) { + for(var index = 0; index < base.printMaterialLengths.length; index++) + { + if(base.printMaterialLengths[index] > 0) { - if(base.printMaterialLengths[index] > 0) + lengths.push(base.printMaterialLengths[index].toFixed(2)); + weights.push(String(Math.floor(base.printMaterialWeights[index]))); + var cost = base.printMaterialCosts[index] == undefined ? 0 : base.printMaterialCosts[index].toFixed(2); + costs.push(cost); + if(cost > 0) { - lengths.push(base.printMaterialLengths[index].toFixed(2)); - weights.push(String(Math.floor(base.printMaterialWeights[index]))); - var cost = base.printMaterialCosts[index] == undefined ? 0 : base.printMaterialCosts[index].toFixed(2); - costs.push(cost); - if(cost > 0) - { - someCostsKnown = true; - } + someCostsKnown = true; } } } - if(lengths.length == 0) - { - lengths = ["0.00"]; - weights = ["0"]; - costs = ["0.00"]; - } - if(someCostsKnown) - { - return catalog.i18nc("@label", "%1 m / ~ %2 g / ~ %4 %3").arg(lengths.join(" + ")) - .arg(weights.join(" + ")).arg(costs.join(" + ")).arg(UM.Preferences.getValue("cura/currency")); - } - else - { - return catalog.i18nc("@label", "%1 m / ~ %2 g").arg(lengths.join(" + ")).arg(weights.join(" + ")); - } + } + if(lengths.length == 0) + { + lengths = ["0.00"]; + weights = ["0"]; + costs = ["0.00"]; + } + if(someCostsKnown) + { + return catalog.i18nc("@label", "%1 m / ~ %2 g / ~ %4 %3").arg(lengths.join(" + ")) + .arg(weights.join(" + ")).arg(costs.join(" + ")).arg(UM.Preferences.getValue("cura/currency")); + } + else + { + return catalog.i18nc("@label", "%1 m / ~ %2 g").arg(lengths.join(" + ")).arg(weights.join(" + ")); } } } From bff00d41d0c43235f120ab2bd03f74172a1eae93 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 14 Aug 2017 09:42:46 +0200 Subject: [PATCH 07/11] Add description for print time It looks a bit weird right below the print time but we'll discuss that later. Contributes to issue CURA-4149. --- resources/qml/Sidebar.qml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index af20e05c55..1968722ae3 100755 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -415,7 +415,7 @@ Rectangle width: timeSpec.width height: timeSpec.height anchors.left: parent.left - anchors.bottom: lengthSpec.top + anchors.bottom: timeSpecDescription.top text: { var order = ["inset_0", "inset_x", "skin", "infill", "support_infill", "support_interface", "support", "travel", "retract", "none"]; @@ -455,6 +455,15 @@ Rectangle } } Text + { + id: timeSpecDescription + anchors.left: parent.left + anchors.bottom: lengthSpec.top + font: UM.Theme.getFont("small") + color: UM.Theme.getColor("text_subtext") + text: catalog.i18nc("@description", "Print time") + } + Text { id: lengthSpec anchors.left: parent.left From addf6429e5ac3a82da6742cd082e199e12b80419 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 14 Aug 2017 09:45:12 +0200 Subject: [PATCH 08/11] Adjust font sizes of time/material estimates Emphasize the time estimate. Contributes to issue CURA-4149. --- resources/qml/Sidebar.qml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 1968722ae3..895d06322a 100755 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -449,7 +449,7 @@ Rectangle id: timeSpec anchors.left: parent.left anchors.bottom: parent.bottom - font: UM.Theme.getFont("small") + font: UM.Theme.getFont("large") color: UM.Theme.getColor("text_subtext") text: (!base.printDuration || !base.printDuration.valid) ? catalog.i18nc("@label", "00h 00min") : base.printDuration.getDisplayString(UM.DurationFormat.Short) } @@ -459,7 +459,7 @@ Rectangle id: timeSpecDescription anchors.left: parent.left anchors.bottom: lengthSpec.top - font: UM.Theme.getFont("small") + font: UM.Theme.getFont("very_small") color: UM.Theme.getColor("text_subtext") text: catalog.i18nc("@description", "Print time") } @@ -468,7 +468,7 @@ Rectangle id: lengthSpec anchors.left: parent.left anchors.bottom: parent.bottom - font: UM.Theme.getFont("small") + font: UM.Theme.getFont("very_small") color: UM.Theme.getColor("text_subtext") text: { From 6a4329c1a066ad1f02f5805926dee8184c2de344 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 14 Aug 2017 10:36:39 +0200 Subject: [PATCH 09/11] Align progress bar and save button better So that they don't overlap with the now larger fonts and such. Contributes to issue CURA-4149. --- resources/qml/MonitorButton.qml | 1 - resources/qml/SaveButton.qml | 1 - resources/qml/Sidebar.qml | 11 +++++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/resources/qml/MonitorButton.qml b/resources/qml/MonitorButton.qml index 8fe6438b87..cfb09d9c9f 100644 --- a/resources/qml/MonitorButton.qml +++ b/resources/qml/MonitorButton.qml @@ -81,7 +81,6 @@ Item } property bool activity: CuraApplication.platformActivity; - property int totalHeight: childrenRect.height + UM.Theme.getSize("default_margin").height property string fileBaseName property string statusText: { diff --git a/resources/qml/SaveButton.qml b/resources/qml/SaveButton.qml index 6f6efad7f1..3f25283596 100644 --- a/resources/qml/SaveButton.qml +++ b/resources/qml/SaveButton.qml @@ -18,7 +18,6 @@ Item { property var backend: CuraApplication.getBackend(); property bool activity: CuraApplication.platformActivity; - property int totalHeight: childrenRect.height + UM.Theme.getSize("default_margin").height property string fileBaseName property string statusText: { diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 895d06322a..be572bae23 100755 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -397,8 +397,8 @@ Rectangle width: parent.width height: UM.Theme.getSize("sidebar_lining").height color: UM.Theme.getColor("sidebar_lining") - anchors.bottom: saveButton.top - anchors.bottomMargin: UM.Theme.getSize("default_margin").height + anchors.bottom: printSpecs.top + anchors.bottomMargin: UM.Theme.getSize("default_margin").height * 2 + UM.Theme.getSize("progressbar").height + UM.Theme.getFont("default_bold").pixelSize } Rectangle @@ -408,6 +408,7 @@ Rectangle anchors.bottom: parent.bottom anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.bottomMargin: UM.Theme.getSize("default_margin").height + height: childrenRect.height UM.TooltipArea { @@ -517,7 +518,8 @@ Rectangle { id: saveButton implicitWidth: base.width - implicitHeight: totalHeight + anchors.top: footerSeparator.bottom + anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.bottom: parent.bottom visible: !monitoringPrint } @@ -526,7 +528,8 @@ Rectangle { id: monitorButton implicitWidth: base.width - implicitHeight: totalHeight + anchors.top: footerSeparator.bottom + anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.bottom: parent.bottom visible: monitoringPrint } From 5866b759a8a6a2180f46ef8ee9fc244f22979810 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 14 Aug 2017 12:06:03 +0200 Subject: [PATCH 10/11] Move material estimate properties to sidebar as well That's where they are used after all. Contributes to issue CURA-4149. --- resources/qml/JobSpecs.qml | 4 ---- resources/qml/Sidebar.qml | 3 +++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/resources/qml/JobSpecs.qml b/resources/qml/JobSpecs.qml index 545615aff0..99bbdc73e6 100644 --- a/resources/qml/JobSpecs.qml +++ b/resources/qml/JobSpecs.qml @@ -23,10 +23,6 @@ Item { UM.I18nCatalog { id: catalog; name:"cura"} - property variant printMaterialLengths: PrintInformation.materialLengths - property variant printMaterialWeights: PrintInformation.materialWeights - property variant printMaterialCosts: PrintInformation.materialCosts - height: childrenRect.height Connections diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index be572bae23..52d24a38e3 100755 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -27,6 +27,9 @@ Rectangle property variant printDuration: PrintInformation.currentPrintTime property variant printDurationPerFeature: PrintInformation.printTimesPerFeature + property variant printMaterialLengths: PrintInformation.materialLengths + property variant printMaterialWeights: PrintInformation.materialWeights + property variant printMaterialCosts: PrintInformation.materialCosts color: UM.Theme.getColor("sidebar") UM.I18nCatalog { id: catalog; name:"cura"} From a4ddd28e8faaffa7567c7ae648baadf422f17fa1 Mon Sep 17 00:00:00 2001 From: alekseisasin Date: Mon, 14 Aug 2017 13:09:31 +0200 Subject: [PATCH 11/11] Removed gap between material length and it's measuring unit feature_move_printing_time --- resources/qml/Sidebar.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 52d24a38e3..702a38a260 100755 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -504,12 +504,12 @@ Rectangle } if(someCostsKnown) { - return catalog.i18nc("@label", "%1 m / ~ %2 g / ~ %4 %3").arg(lengths.join(" + ")) + return catalog.i18nc("@label", "%1m / ~ %2g / ~ %4 %3").arg(lengths.join(" + ")) .arg(weights.join(" + ")).arg(costs.join(" + ")).arg(UM.Preferences.getValue("cura/currency")); } else { - return catalog.i18nc("@label", "%1 m / ~ %2 g").arg(lengths.join(" + ")).arg(weights.join(" + ")); + return catalog.i18nc("@label", "%1m / ~ %2g").arg(lengths.join(" + ")).arg(weights.join(" + ")); } } }