From 3130c0c30baa2d64b4e5120adacaacc5791fa8cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Mon, 27 May 2013 01:20:45 +0200 Subject: [PATCH] Fixed jobData key --- octoprint/events.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/octoprint/events.py b/octoprint/events.py index ecbd6f7..3c003eb 100644 --- a/octoprint/events.py +++ b/octoprint/events.py @@ -191,10 +191,12 @@ class CommandTrigger(GenericEventListener): if "currentZ" in currentData.keys() and currentData["currentZ"] is not None: params["currentZ"] = str(currentData["currentZ"]) - if "jobData" in currentData.keys() and currentData["jobData"] is not None: - params["filename"] = currentData["jobData"]["filename"] - if "progress" in currentData.keys() and currentData["progress"] is not None and currentData["jobData"]["lines"] is not None: - params["progress"] = str(round(currentData["progress"] * 100 / currentData["jobData"]["lines"])) + if "job" in currentData.keys() and currentData["job"] is not None: + params["filename"] = currentData["job"]["filename"] + if "progress" in currentData.keys() and currentData["progress"] is not None \ + and "progress" in currentData["progress"].keys() and currentData["progress"]["progress"] is not None \ + and currentData["job"]["lines"] is not None: + params["progress"] = str(round(currentData["progress"]["progress"] * 100 / currentData["job"]["lines"])) return command % params