Adapted progress callback of gcodeInterpreter to also work if a list object is supplied as gcodeFile (e.g. when using loadList instead of load)

master
Gina Häußge 2012-12-28 20:04:43 +01:00
parent c6cca8c7a3
commit 083498865d
1 changed files with 5 additions and 3 deletions

View File

@ -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()