Times are correctly displayed for Cluster again

CL-541
This commit is contained in:
Jaime van Kessel 2017-11-30 10:53:38 +01:00
parent e841896090
commit 3d3b140526
2 changed files with 9 additions and 4 deletions

View File

@ -6,6 +6,7 @@ from UM.Application import Application
from UM.Settings.ContainerRegistry import ContainerRegistry from UM.Settings.ContainerRegistry import ContainerRegistry
from UM.i18n import i18nCatalog from UM.i18n import i18nCatalog
from UM.Message import Message from UM.Message import Message
from UM.Qt.Duration import Duration, DurationFormat
from cura.PrinterOutput.NetworkedPrinterOutputDevice import NetworkedPrinterOutputDevice, AuthState from cura.PrinterOutput.NetworkedPrinterOutputDevice import NetworkedPrinterOutputDevice, AuthState
from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel from cura.PrinterOutput.PrinterOutputModel import PrinterOutputModel
@ -164,6 +165,10 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
result.append({"machine_type": machine_type, "count": printer_count[machine_type]}) result.append({"machine_type": machine_type, "count": printer_count[machine_type]})
return result return result
@pyqtSlot(int, result=str)
def formatDuration(self, seconds):
return Duration(seconds).getDisplayString(DurationFormat.Format.Short)
def _update(self): def _update(self):
if not super()._update(): if not super()._update():
return return
@ -201,7 +206,7 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
print_jobs_seen.append(print_job) print_jobs_seen.append(print_job)
for old_job in self._print_jobs: for old_job in self._print_jobs:
if old_job not in print_jobs_seen: if old_job not in print_jobs_seen and old_job.assignedPrinter:
# Print job needs to be removed. # Print job needs to be removed.
old_job.assignedPrinter.updateActivePrintJob(None) old_job.assignedPrinter.updateActivePrintJob(None)

View File

@ -22,11 +22,11 @@ Rectangle
{ {
return ""; return "";
} }
if (printJob.time_total === 0) if (printJob.timeTotal === 0)
{ {
return ""; return "";
} }
return Math.min(100, Math.round(printJob.time_elapsed / printJob.time_total * 100)) + "%"; return Math.min(100, Math.round(printJob.timeElapsed / printJob.timeTotal * 100)) + "%";
} }
function printerStatusText(printer) function printerStatusText(printer)
@ -114,7 +114,7 @@ Rectangle
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("default_margin").width anchors.rightMargin: UM.Theme.getSize("default_margin").width
text: printJob != null ? getPrettyTime(printJob.time_total) : "" text: printJob != null ? getPrettyTime(printJob.timeTotal) : ""
opacity: 0.65 opacity: 0.65
font: UM.Theme.getFont("default") font: UM.Theme.getFont("default")
elide: Text.ElideRight elide: Text.ElideRight