mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-15 00:56:01 +08:00
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.
This commit is contained in:
parent
e514a9f474
commit
454293f926
@ -409,110 +409,94 @@ Rectangle
|
|||||||
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
||||||
anchors.bottomMargin: UM.Theme.getSize("default_margin").height
|
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.left: parent.left
|
||||||
anchors.bottom: filamentSpecsRow.top
|
anchors.bottom: lengthSpec.top
|
||||||
|
|
||||||
UM.TooltipArea
|
text: {
|
||||||
{
|
var order = ["inset_0", "inset_x", "skin", "infill", "support_infill", "support_interface", "support", "travel", "retract", "none"];
|
||||||
id: timeSpecPerFeatureTooltipArea
|
var visible_names = {
|
||||||
width: timeSpec.width
|
"inset_0": catalog.i18nc("@tooltip", "Outer Wall"),
|
||||||
height: timeSpec.height
|
"inset_x": catalog.i18nc("@tooltip", "Inner Walls"),
|
||||||
anchors.left: parent.left
|
"skin": catalog.i18nc("@tooltip", "Skin"),
|
||||||
anchors.bottom: parent.bottom
|
"infill": catalog.i18nc("@tooltip", "Infill"),
|
||||||
|
"support_infill": catalog.i18nc("@tooltip", "Support Infill"),
|
||||||
text: {
|
"support_interface": catalog.i18nc("@tooltip", "Support Interface"),
|
||||||
var order = ["inset_0", "inset_x", "skin", "infill", "support_infill", "support_interface", "support", "travel", "retract", "none"];
|
"support": catalog.i18nc("@tooltip", "Support"),
|
||||||
var visible_names = {
|
"travel": catalog.i18nc("@tooltip", "Travel"),
|
||||||
"inset_0": catalog.i18nc("@tooltip", "Outer Wall"),
|
"retract": catalog.i18nc("@tooltip", "Retractions"),
|
||||||
"inset_x": catalog.i18nc("@tooltip", "Inner Walls"),
|
"none": catalog.i18nc("@tooltip", "Other")
|
||||||
"skin": catalog.i18nc("@tooltip", "Skin"),
|
};
|
||||||
"infill": catalog.i18nc("@tooltip", "Infill"),
|
var result = "";
|
||||||
"support_infill": catalog.i18nc("@tooltip", "Support Infill"),
|
for(var feature in order)
|
||||||
"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 += "<br/>" + visible_names[feature] + ": " + base.printDurationPerFeature[feature].getDisplayString(UM.DurationFormat.Short);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
result = result.replace(/^\<br\/\>/, ""); // remove newline before first item
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
Text
|
|
||||||
{
|
{
|
||||||
id: timeSpec
|
feature = order[feature];
|
||||||
anchors.left: parent.left
|
if(base.printDurationPerFeature[feature] && base.printDurationPerFeature[feature].totalSeconds > 0)
|
||||||
anchors.bottom: parent.bottom
|
{
|
||||||
font: UM.Theme.getFont("small")
|
result += "<br/>" + visible_names[feature] + ": " + base.printDurationPerFeature[feature].getDisplayString(UM.DurationFormat.Short);
|
||||||
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(/^\<br\/\>/, ""); // 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
|
Text
|
||||||
{
|
{
|
||||||
id: lengthSpec
|
id: timeSpec
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
font: UM.Theme.getFont("small")
|
font: UM.Theme.getFont("small")
|
||||||
color: UM.Theme.getColor("text_subtext")
|
color: UM.Theme.getColor("text_subtext")
|
||||||
text:
|
text: (!base.printDuration || !base.printDuration.valid) ? catalog.i18nc("@label", "00h 00min") : base.printDuration.getDisplayString(UM.DurationFormat.Short)
|
||||||
{
|
}
|
||||||
var lengths = [];
|
}
|
||||||
var weights = [];
|
Text
|
||||||
var costs = [];
|
{
|
||||||
var someCostsKnown = false;
|
id: lengthSpec
|
||||||
if(base.printMaterialLengths) {
|
anchors.left: parent.left
|
||||||
for(var index = 0; index < base.printMaterialLengths.length; index++)
|
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));
|
someCostsKnown = true;
|
||||||
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)
|
}
|
||||||
{
|
if(lengths.length == 0)
|
||||||
lengths = ["0.00"];
|
{
|
||||||
weights = ["0"];
|
lengths = ["0.00"];
|
||||||
costs = ["0.00"];
|
weights = ["0"];
|
||||||
}
|
costs = ["0.00"];
|
||||||
if(someCostsKnown)
|
}
|
||||||
{
|
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"));
|
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
|
}
|
||||||
{
|
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…
x
Reference in New Issue
Block a user