Added only pause/resume sub commands to job API

Implements #1393
This commit is contained in:
Gina Häußge committed 2016-06-30 12:56:18 +02:00
1 parent 0376bc4235
commit 73a85646c5
6 files changed
+136 -20

No files matched your search

+10 -2
View File
@@ -43,7 +43,15 @@ def controlJob():
elif command == "pause":
if not activePrintjob:
return make_response("Printer is neither printing nor paused, 'pause' command cannot be performed", 409)
printer.toggle_pause_print()
action = data.get("action", "toggle")
if action == "toggle":
printer.toggle_pause_print()
elif action == "pause":
printer.pause_print()
elif action == "resume":
printer.resume_print()
else:
return make_response("Unknown action '{}', allowed values for action parameter are 'pause', 'resume' and 'toggle'".format(action), 400)
elif command == "cancel":
if not activePrintjob:
return make_response("Printer is neither printing nor paused, 'cancel' command cannot be performed", 409)
@@ -58,4 +66,4 @@ def jobState():
"job": currentData["job"],
"progress": currentData["progress"],
"state": currentData["state"]["text"]
})
})