added functionality to remove comments ahead of time to remove the progress bar bug on gcode files with embeded (base64) images.

This commit is contained in:
make-ing 2016-06-15 11:30:53 +02:00
parent 0c5804e51a
commit 3bbdd702db

View file

@ -1169,6 +1169,9 @@ class PrintingGcodeFileInformation(PrintingFileInformation):
if not os.path.exists(self._filename) or not os.path.isfile(self._filename):
raise IOError("File %s does not exist" % self._filename)
self._stripCommments()
self._size = os.stat(self._filename).st_size
self._pos = 0
@ -1222,6 +1225,16 @@ class PrintingGcodeFileInformation(PrintingFileInformation):
self._logger.exception("Exception while processing line")
raise e
def _stripCommments(self):
dir = os.path.dirname(os.path.abspath(self._filename))
tmpfile = open(dir + '/gcode.tmp', 'w')
with open(self._filename, "r") as fileobject:
for line in fileobject:
if process_gcode_line(line) is not None:
tmpfile.write(line)
tmpfile.close()
self._filename = dir + '/gcode.tmp'
def convert_pause_triggers(configured_triggers):
triggers = {
"enable": [],