mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-13 18:55:59 +08:00
Merge remote-tracking branch 'origin/4.0'
This commit is contained in:
commit
87bdd10dab
@ -306,7 +306,7 @@ Item
|
|||||||
}
|
}
|
||||||
if (printer && printer.state == "unreachable")
|
if (printer && printer.state == "unreachable")
|
||||||
{
|
{
|
||||||
return catalog.i18nc("@label:status", "Unavailable")
|
return catalog.i18nc("@label:status", "Unreachable")
|
||||||
}
|
}
|
||||||
if (printer && !printer.activePrintJob && printer.state == "idle")
|
if (printer && !printer.activePrintJob && printer.state == "idle")
|
||||||
{
|
{
|
||||||
@ -398,6 +398,7 @@ Item
|
|||||||
font: UM.Theme.getFont("default")
|
font: UM.Theme.getFont("default")
|
||||||
text: catalog.i18nc("@label:status", "Requires configuration changes")
|
text: catalog.i18nc("@label:status", "Requires configuration changes")
|
||||||
visible: printer && printer.activePrintJob && printer.activePrintJob.configurationChanges.length > 0 && !printerStatus.visible
|
visible: printer && printer.activePrintJob && printer.activePrintJob.configurationChanges.length > 0 && !printerStatus.visible
|
||||||
|
color: UM.Theme.getColor("monitor_text_primary")
|
||||||
|
|
||||||
// FIXED-LINE-HEIGHT:
|
// FIXED-LINE-HEIGHT:
|
||||||
height: 18 * screenScaleFactor // TODO: Theme!
|
height: 18 * screenScaleFactor // TODO: Theme!
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) 2018 Ultimaker B.V.
|
// Copyright (c) 2019 Ultimaker B.V.
|
||||||
// Cura is released under the terms of the LGPLv3 or higher.
|
// Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
import QtQuick 2.7
|
import QtQuick 2.7
|
||||||
@ -36,30 +36,63 @@ Column
|
|||||||
|
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
property var printDuration: PrintInformation.currentPrintTime
|
id: byLineType
|
||||||
|
|
||||||
text:
|
property var printDuration: PrintInformation.currentPrintTime
|
||||||
|
property var columnWidthMultipliers: [ 0.4, 0.3, 0.3 ]
|
||||||
|
property var columnHorizontalAligns: [ TextInput.AlignLeft, TextInput.AlignHCenter, TextInput.AlignHCenter ]
|
||||||
|
|
||||||
|
function getMaterialTable()
|
||||||
{
|
{
|
||||||
|
var result = []
|
||||||
|
|
||||||
// All the time information for the different features is achieved
|
// All the time information for the different features is achieved
|
||||||
var printTime = PrintInformation.getFeaturePrintTimes()
|
var printTime = PrintInformation.getFeaturePrintTimes()
|
||||||
var totalSeconds = parseInt(printDuration.getDisplayString(UM.DurationFormat.Seconds))
|
var totalSeconds = parseInt(printDuration.getDisplayString(UM.DurationFormat.Seconds))
|
||||||
|
|
||||||
// A message is created and displayed when the user hover the time label
|
// A message is created and displayed when the user hover the time label
|
||||||
var text = "<table width=\"100%\">"
|
|
||||||
for(var feature in printTime)
|
for(var feature in printTime)
|
||||||
{
|
{
|
||||||
if(!printTime[feature].isTotalDurationZero)
|
if(!printTime[feature].isTotalDurationZero)
|
||||||
{
|
{
|
||||||
text += "<tr><td>" + feature + ":</td>" +
|
var row = []
|
||||||
"<td align=\"right\" valign=\"bottom\"> %1</td>".arg(printTime[feature].getDisplayString(UM.DurationFormat.ISO8601).slice(0,-3)) +
|
row.push(feature + ": ")
|
||||||
"<td align=\"right\" valign=\"bottom\"> %1%</td>".arg(Math.round(100 * parseInt(printTime[feature].getDisplayString(UM.DurationFormat.Seconds)) / totalSeconds)) +
|
row.push("%1".arg(printTime[feature].getDisplayString(UM.DurationFormat.ISO8601).slice(0,-3)))
|
||||||
"</tr>"
|
row.push("%1%".arg(Math.round(100 * parseInt(printTime[feature].getDisplayString(UM.DurationFormat.Seconds)) / totalSeconds)))
|
||||||
|
result.push(row)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
text += "</table>"
|
|
||||||
return text
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Column
|
||||||
|
{
|
||||||
|
Repeater
|
||||||
|
{
|
||||||
|
model: byLineType.getMaterialTable()
|
||||||
|
Row
|
||||||
|
{
|
||||||
|
Repeater
|
||||||
|
{
|
||||||
|
model: modelData
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
width: Math.round(byLineType.width * byLineType.columnWidthMultipliers[index])
|
||||||
|
height: contentHeight
|
||||||
|
horizontalAlignment: byLineType.columnHorizontalAligns[index]
|
||||||
|
font: UM.Theme.getFont("default")
|
||||||
|
wrapMode: Text.WrapAnywhere
|
||||||
|
text: modelData
|
||||||
|
renderType: Text.NativeRendering
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
width: parent.width - 2 * UM.Theme.getSize("default_margin").width
|
width: parent.width - 2 * UM.Theme.getSize("default_margin").width
|
||||||
|
height: childrenRect.height
|
||||||
color: UM.Theme.getColor("text")
|
color: UM.Theme.getColor("text")
|
||||||
font: UM.Theme.getFont("default")
|
font: UM.Theme.getFont("default")
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
@ -85,31 +118,19 @@ Column
|
|||||||
|
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
|
id: byMaterialType
|
||||||
|
|
||||||
property var printMaterialLengths: PrintInformation.materialLengths
|
property var printMaterialLengths: PrintInformation.materialLengths
|
||||||
property var printMaterialWeights: PrintInformation.materialWeights
|
property var printMaterialWeights: PrintInformation.materialWeights
|
||||||
property var printMaterialCosts: PrintInformation.materialCosts
|
property var printMaterialCosts: PrintInformation.materialCosts
|
||||||
property var printMaterialNames: PrintInformation.materialNames
|
property var printMaterialNames: PrintInformation.materialNames
|
||||||
|
property var columnWidthMultipliers: [ 0.4, 0.2, 0.2, 0.2 ]
|
||||||
|
property var columnHorizontalAligns: [ TextInput.AlignLeft, TextInput.AlignHCenter, TextInput.AlignHCenter, TextInput.AlignHCenter ]
|
||||||
|
|
||||||
function formatRow(items)
|
function getMaterialTable()
|
||||||
{
|
{
|
||||||
var rowHTML = "<tr>"
|
var result = []
|
||||||
for(var item = 0; item < items.length; item++)
|
|
||||||
{
|
|
||||||
if (item == 0)
|
|
||||||
{
|
|
||||||
rowHTML += "<td valign=\"bottom\">%1</td>".arg(items[item])
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rowHTML += "<td align=\"right\" valign=\"bottom\"> %1</td>".arg(items[item])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
rowHTML += "</tr>"
|
|
||||||
return rowHTML
|
|
||||||
}
|
|
||||||
|
|
||||||
text:
|
|
||||||
{
|
|
||||||
var lengths = []
|
var lengths = []
|
||||||
var weights = []
|
var weights = []
|
||||||
var costs = []
|
var costs = []
|
||||||
@ -135,21 +156,46 @@ Column
|
|||||||
costs = ["0.00"]
|
costs = ["0.00"]
|
||||||
}
|
}
|
||||||
|
|
||||||
var text = "<table width=\"100%\">"
|
|
||||||
for(var index = 0; index < lengths.length; index++)
|
for(var index = 0; index < lengths.length; index++)
|
||||||
{
|
{
|
||||||
text += formatRow([
|
var row = []
|
||||||
"%1:".arg(names[index]),
|
row.push("%1".arg(names[index]))
|
||||||
catalog.i18nc("@label m for meter", "%1m").arg(lengths[index]),
|
row.push(catalog.i18nc("@label m for meter", "%1m").arg(lengths[index]))
|
||||||
catalog.i18nc("@label g for grams", "%1g").arg(weights[index]),
|
row.push(catalog.i18nc("@label g for grams", "%1g").arg(weights[index]))
|
||||||
"%1 %2".arg(UM.Preferences.getValue("cura/currency")).arg(costs[index]),
|
row.push("%1 %2".arg(UM.Preferences.getValue("cura/currency")).arg(costs[index]))
|
||||||
])
|
result.push(row)
|
||||||
}
|
}
|
||||||
text += "</table>"
|
|
||||||
|
|
||||||
return text
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Column
|
||||||
|
{
|
||||||
|
Repeater
|
||||||
|
{
|
||||||
|
model: byMaterialType.getMaterialTable()
|
||||||
|
Row
|
||||||
|
{
|
||||||
|
Repeater
|
||||||
|
{
|
||||||
|
model: modelData
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
width: Math.round(byMaterialType.width * byMaterialType.columnWidthMultipliers[index])
|
||||||
|
height: contentHeight
|
||||||
|
horizontalAlignment: byLineType.columnHorizontalAligns[index]
|
||||||
|
font: UM.Theme.getFont("default")
|
||||||
|
wrapMode: Text.WrapAnywhere
|
||||||
|
text: modelData
|
||||||
|
renderType: Text.NativeRendering
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
width: parent.width - 2 * UM.Theme.getSize("default_margin").width
|
width: parent.width - 2 * UM.Theme.getSize("default_margin").width
|
||||||
|
height: childrenRect.height
|
||||||
color: UM.Theme.getColor("text")
|
color: UM.Theme.getColor("text")
|
||||||
font: UM.Theme.getFont("default")
|
font: UM.Theme.getFont("default")
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
|
Loading…
x
Reference in New Issue
Block a user