From 00406587c1417c9c84cdefe12456d5d637a2d421 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20W=C3=BCst?= Date: Sun, 14 Jul 2013 19:28:22 +0200 Subject: load whole file instead of one line. (bzr r12417.1.4) --- share/extensions/hpgl_decoder.py | 1 + share/extensions/hpgl_input.py | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/share/extensions/hpgl_decoder.py b/share/extensions/hpgl_decoder.py index a2427cc8e..e9fe2f020 100644 --- a/share/extensions/hpgl_decoder.py +++ b/share/extensions/hpgl_decoder.py @@ -40,6 +40,7 @@ class hpglDecoder: def getSvg(self): # parse hpgl data + # TODO:2013-07-13:Sebastian Wüst:Try to parse all the different HPGL formats correctly. hpglData = self.hpglString.split(';') if hpglData[-1].strip() == '': hpglData.pop() diff --git a/share/extensions/hpgl_input.py b/share/extensions/hpgl_input.py index 41e7cc608..3bd698082 100644 --- a/share/extensions/hpgl_input.py +++ b/share/extensions/hpgl_input.py @@ -38,10 +38,14 @@ parser.add_option('--showMovements', action='store', type='inkbool', dest='showM options.docWidth = 210.0 * 3.5433070866 # 210mm to pixels (DIN A4) options.docHeight = 297.0 * 3.5433070866 # 297mm to pixels (DIN A4) -# TODO:2013-07-13:Sebastian Wüst:Load the whole file and try to parse all the different HPGL formats correctly. -# read file (read only one line, there should not be more than one line) -stream = open(args[0], 'r') -hpglString = stream.readline().strip() +# read file +fobj = open(args[0], 'r') +hpglString = [] +for line in fobj: + hpglString.append(line.strip()) +fobj.close() +# combine all lines +hpglString = ';'.join(hpglString) # interpret HPGL data myHpglDecoder = hpgl_decoder.hpglDecoder(hpglString, options) -- cgit v1.2.3