mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-11 21:09:00 +08:00
Made time total & time remaining pretty
CURA-1036
This commit is contained in:
parent
168246d594
commit
ef9ce7ad55
@ -34,6 +34,21 @@ Rectangle
|
|||||||
tooltip.hide();
|
tooltip.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function strPadLeft(string, pad, length) {
|
||||||
|
return (new Array(length + 1).join(pad) + string).slice(-length);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getPrettyTime(time)
|
||||||
|
{
|
||||||
|
var hours = Math.floor(time / 3600)
|
||||||
|
time -= hours * 3600
|
||||||
|
var minutes = Math.floor(time / 60);
|
||||||
|
time -= minutes * 60
|
||||||
|
var seconds = Math.floor(time);
|
||||||
|
|
||||||
|
var finalTime = strPadLeft(hours, "0", 2) + ':' + strPadLeft(minutes,'0',2)+ ':' + strPadLeft(seconds,'0',2);
|
||||||
|
return finalTime;
|
||||||
|
}
|
||||||
MouseArea
|
MouseArea
|
||||||
{
|
{
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
@ -289,9 +304,10 @@ Rectangle
|
|||||||
{
|
{
|
||||||
text: "Printing Time:"
|
text: "Printing Time:"
|
||||||
}
|
}
|
||||||
|
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
text: " " + Cura.MachineManager.printerOutputDevices[0].timeTotal
|
text: " " + getPrettyTime(Cura.MachineManager.printerOutputDevices[0].timeTotal)
|
||||||
}
|
}
|
||||||
|
|
||||||
Label
|
Label
|
||||||
@ -300,7 +316,7 @@ Rectangle
|
|||||||
}
|
}
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
text: " " + (Cura.MachineManager.printerOutputDevices[0].timeTotal - Cura.MachineManager.printerOutputDevices[0].timeElapsed)
|
text: " " + getPrettyTime(Cura.MachineManager.printerOutputDevices[0].timeTotal - Cura.MachineManager.printerOutputDevices[0].timeElapsed)
|
||||||
}
|
}
|
||||||
|
|
||||||
Label
|
Label
|
||||||
|
Loading…
x
Reference in New Issue
Block a user