From df943736645c579df0919ae3f388246cd393e749 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 15 Jun 2016 16:46:41 +0200 Subject: [PATCH] TimeTotal and timeSpent are now set CURA-1068 --- NetworkPrinterOutputDevice.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/NetworkPrinterOutputDevice.py b/NetworkPrinterOutputDevice.py index 57a7086b97..f943e97bc3 100644 --- a/NetworkPrinterOutputDevice.py +++ b/NetworkPrinterOutputDevice.py @@ -190,11 +190,16 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): pass # TODO: Handle errors elif "print_job" in reply.url().toString(): # Status update from print_job: if reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) == 200: - progress = json.loads(bytes(reply.readAll()).decode("utf-8"))["progress"] + json_data = json.loads(bytes(reply.readAll()).decode("utf-8")) + progress = json_data["progress"] ## If progress is 0 add a bit so another print can't be sent. if progress == 0: progress += 0.001 self.setProgress(progress) + + self.setTimeElapsed(json_data["time_elapsed"]) + self.setTimeTotal(json_data["time_total"]) + elif reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) == 404: self.setProgress(0) # No print job found, so there can't be progress! elif "snapshot" in reply.url().toString(): # Status update from image: