mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-07 05:53:59 -06:00
Show material cost in Job Specs area...
...if weight/price information is available
This commit is contained in:
parent
27cf300ba6
commit
a83c397d69
2 changed files with 67 additions and 12 deletions
|
@ -26,6 +26,7 @@ Rectangle {
|
|||
property variant printDuration: PrintInformation.currentPrintTime
|
||||
property variant printMaterialLengths: PrintInformation.materialLengths
|
||||
property variant printMaterialWeights: PrintInformation.materialWeights
|
||||
property variant printMaterialCosts: PrintInformation.materialCosts
|
||||
|
||||
height: childrenRect.height
|
||||
color: "transparent"
|
||||
|
@ -133,7 +134,8 @@ Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
Label{
|
||||
Label
|
||||
{
|
||||
id: boundingSpec
|
||||
anchors.top: jobNameRow.bottom
|
||||
anchors.right: parent.right
|
||||
|
@ -144,17 +146,20 @@ Rectangle {
|
|||
text: Printer.getSceneBoundingBoxString
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
Rectangle
|
||||
{
|
||||
id: specsRow
|
||||
anchors.top: boundingSpec.bottom
|
||||
anchors.right: parent.right
|
||||
height: UM.Theme.getSize("jobspecs_line").height
|
||||
|
||||
Item{
|
||||
Item
|
||||
{
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
|
||||
UM.RecolorImage {
|
||||
UM.RecolorImage
|
||||
{
|
||||
id: timeIcon
|
||||
anchors.right: timeSpec.left
|
||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width/2
|
||||
|
@ -166,7 +171,8 @@ Rectangle {
|
|||
color: UM.Theme.getColor("text_subtext")
|
||||
source: UM.Theme.getIcon("print_time")
|
||||
}
|
||||
Label{
|
||||
Label
|
||||
{
|
||||
id: timeSpec
|
||||
anchors.right: lengthIcon.left
|
||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||
|
@ -175,7 +181,8 @@ Rectangle {
|
|||
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 {
|
||||
UM.RecolorImage
|
||||
{
|
||||
id: lengthIcon
|
||||
anchors.right: lengthSpec.left
|
||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width/2
|
||||
|
@ -187,7 +194,8 @@ Rectangle {
|
|||
color: UM.Theme.getColor("text_subtext")
|
||||
source: UM.Theme.getIcon("category_material")
|
||||
}
|
||||
Label{
|
||||
Label
|
||||
{
|
||||
id: lengthSpec
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
@ -197,19 +205,38 @@ Rectangle {
|
|||
{
|
||||
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) {
|
||||
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])));
|
||||
costs.push(base.printMaterialCosts[index].toFixed(2));
|
||||
if(base.printMaterialCosts[index] > 0)
|
||||
{
|
||||
someCostsKnown = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(lengths.length == 0) {
|
||||
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(" + "));
|
||||
}
|
||||
return catalog.i18nc("@label", "%1 m / ~ %2 g").arg(lengths.join(" + ")).arg(weights.join(" + "));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue