diff options
| author | Sebastian Wüst <sebi@timewaster.de> | 2013-07-14 17:28:22 +0000 |
|---|---|---|
| committer | Sebastian Wüst <sebi@timewaster.de> | 2013-07-14 17:28:22 +0000 |
| commit | 00406587c1417c9c84cdefe12456d5d637a2d421 (patch) | |
| tree | 478d0297fa709553046cdc64a849ab403cc5f402 | |
| parent | changed how decoder is called and errors are passed (diff) | |
| download | inkscape-00406587c1417c9c84cdefe12456d5d637a2d421.tar.gz inkscape-00406587c1417c9c84cdefe12456d5d637a2d421.zip | |
load whole file instead of one line.
(bzr r12417.1.4)
| -rw-r--r-- | share/extensions/hpgl_decoder.py | 1 | ||||
| -rw-r--r-- | 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) |
