mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-13 22:05:56 +08:00
Remove binding loop by cleaning up tooltipText creation
This commit is contained in:
parent
6d4ea381f0
commit
84002a70d0
@ -382,7 +382,7 @@ Rectangle
|
|||||||
color: UM.Theme.getColor("text_subtext")
|
color: UM.Theme.getColor("text_subtext")
|
||||||
elide: Text.ElideMiddle
|
elide: Text.ElideMiddle
|
||||||
width: parent.width
|
width: parent.width
|
||||||
property string tooltipText: "test"
|
property string tooltipText
|
||||||
text:
|
text:
|
||||||
{
|
{
|
||||||
var lengths = [];
|
var lengths = [];
|
||||||
@ -419,15 +419,32 @@ Rectangle
|
|||||||
costs = ["0.00"];
|
costs = ["0.00"];
|
||||||
}
|
}
|
||||||
|
|
||||||
tooltipText = catalog.i18nc("@tooltip", "<b>Cost specification</b><br/><table>");
|
var tooltip_html = "<b>%1</b><br/><table>".arg(catalog.i18nc("@label", "Cost specification"));
|
||||||
for(var index = 0; index < lengths.length; index++)
|
for(var index = 0; index < lengths.length; index++)
|
||||||
{
|
{
|
||||||
tooltipText += catalog.i18nc("@label Print estimates: m for meters, g for grams, %4 is currency and %3 is print cost", "<tr><td>Extruder %0: </td><td>%1m </td><td>%2g </td><td>%4 %3</td></tr>").arg(index + 1).arg(lengths[index])
|
var item_strings = [
|
||||||
.arg(weights[index]).arg(costs[index]).arg(UM.Preferences.getValue("cura/currency"));
|
catalog.i18nc("@label", "Extruder %1:").arg(index + 1),
|
||||||
|
catalog.i18nc("@label m for meter", "%1m").arg(lengths[index]),
|
||||||
|
catalog.i18nc("@label g for grams", "%1g").arg(weights[index]),
|
||||||
|
"%1 %2".arg(UM.Preferences.getValue("cura/currency")).arg(costs[index]),
|
||||||
|
];
|
||||||
|
tooltip_html += "<tr>";
|
||||||
|
for(var item = 0; item < item_strings.length; item++) {
|
||||||
|
tooltip_html += "<td>%1 </td>".arg(item_strings[item]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
tooltipText += catalog.i18nc("@label Print totals: m for meters, g for grams, %4 is currency and %3 is print cost", "<tr><td>Total: </td><td>%1m </td><td>%2g </td><td>%4 %3</td></tr>").arg(total_length.toFixed(2))
|
var item_strings = [
|
||||||
.arg(Math.round(total_weight)).arg(total_cost.toFixed(2)).arg(UM.Preferences.getValue("cura/currency"));
|
catalog.i18nc("@label", "Total:"),
|
||||||
tooltipText += "</table>";
|
catalog.i18nc("@label m for meter", "%1m").arg(total_length.toFixed(2)),
|
||||||
|
catalog.i18nc("@label g for grams", "%1g").arg(Math.round(total_weight)),
|
||||||
|
"%1 %2".arg(UM.Preferences.getValue("cura/currency")).arg(total_cost.toFixed(2)),
|
||||||
|
];
|
||||||
|
tooltip_html += "<tr>";
|
||||||
|
for(var item = 0; item < item_strings.length; item++) {
|
||||||
|
tooltip_html += "<td>%1 </td>".arg(item_strings[item]);
|
||||||
|
}
|
||||||
|
tooltip_html += "</tr></table>";
|
||||||
|
tooltipText = tooltip_html;
|
||||||
|
|
||||||
if(some_costs_known)
|
if(some_costs_known)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user