mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 23:46:22 -06:00
TimeTotal and timeSpent are now set
CURA-1068
This commit is contained in:
parent
99a30573ce
commit
df94373664
1 changed files with 6 additions and 1 deletions
|
@ -190,11 +190,16 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
|
||||||
pass # TODO: Handle errors
|
pass # TODO: Handle errors
|
||||||
elif "print_job" in reply.url().toString(): # Status update from print_job:
|
elif "print_job" in reply.url().toString(): # Status update from print_job:
|
||||||
if reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) == 200:
|
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 is 0 add a bit so another print can't be sent.
|
||||||
if progress == 0:
|
if progress == 0:
|
||||||
progress += 0.001
|
progress += 0.001
|
||||||
self.setProgress(progress)
|
self.setProgress(progress)
|
||||||
|
|
||||||
|
self.setTimeElapsed(json_data["time_elapsed"])
|
||||||
|
self.setTimeTotal(json_data["time_total"])
|
||||||
|
|
||||||
elif reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) == 404:
|
elif reply.attribute(QNetworkRequest.HttpStatusCodeAttribute) == 404:
|
||||||
self.setProgress(0) # No print job found, so there can't be progress!
|
self.setProgress(0) # No print job found, so there can't be progress!
|
||||||
elif "snapshot" in reply.url().toString(): # Status update from image:
|
elif "snapshot" in reply.url().toString(): # Status update from image:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue