From 083498865daacfcb68a812b0f2704a56fcbfd354 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Fri, 28 Dec 2012 20:04:43 +0100 Subject: [PATCH] Adapted progress callback of gcodeInterpreter to also work if a list object is supplied as gcodeFile (e.g. when using loadList instead of load) --- Cura/util/gcodeInterpreter.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Cura/util/gcodeInterpreter.py b/Cura/util/gcodeInterpreter.py index 1de7a6bf..de09eb12 100644 --- a/Cura/util/gcodeInterpreter.py +++ b/Cura/util/gcodeInterpreter.py @@ -75,10 +75,12 @@ class gcode(object): if type(line) is tuple: line = line[0] if self.progressCallback != None: - if filePos != gcodeFile.tell(): - filePos = gcodeFile.tell() + if isinstance(gcodeFile, (file)): self.progressCallback(float(filePos) / float(self._fileSize)) - + elif isinstance(gcodeFile, (list)): + self.progressCallback(float(filePos) / float(len(gcodeFile))) + filePos += 1 + #Parse Cura_SF comments if line.startswith(';TYPE:'): pathType = line[6:].strip()