Commit a7efa52f authored by gijs's avatar gijs

Multipen?

parent 23c2740a
...@@ -44,10 +44,24 @@ def ploteps(): ...@@ -44,10 +44,24 @@ def ploteps():
hpglfile hpglfile
]) ])
handle = open(hpglfile) handle = open(hpglfile)
dirtyhpgl = ''.join(handle.readlines()).replace('\n', '') dirtyhpgl = ''.join(handle.readlines()).replace('\n', '')
cleanhpgl = ';'.join([part for part in dirtyhpgl.split(';') if part[0:2] in ['PA', 'PR', 'PU', 'PD']]) cleanhpglchunks = []
pencount = 3
for chunk in dirtyhpgl.split(';'):
if chunk[0:2] in ['PA', 'PR', 'PU', 'PD']:
cleanhpglchunks.append(chunk)
elif chunk[0:2] == 'SP':
pen += 1
if pen > pencount:
pen = 1
cleanhpglchunks.append('SP{}'.format(pen))
cleanhpgl = ';'.join(cleanhpglchunks)
textbox = Textbox( textbox = Textbox(
font=font, font=font,
...@@ -59,7 +73,7 @@ def ploteps(): ...@@ -59,7 +73,7 @@ def ploteps():
textbox.insertText('{0} \n{1} \n\ntype.code, Maison du Livre, Bruxelles'.format(hpglfile, datetime.now().strftime("%d-%m-%Y %H:%M"))) textbox.insertText('{0} \n{1} \n\ntype.code, Maison du Livre, Bruxelles'.format(hpglfile, datetime.now().strftime("%d-%m-%Y %H:%M")))
hpgl = 'IN;RO90;IP0,0,7600,10870;SC{0},{1},{2},{3};SP{4};FS{5};VS{6};PU;{7};PU;'.format(page['left'], page['right'], page['bottom'], page['top'], pen, force, speed, cleanhpgl) hpgl = 'IN;RO90;IP0,0,7600,10870;SC{0},{1},{2},{3};FS{5};SP{4};VS{6};PU;{7};PU;'.format(page['left'], page['right'], page['bottom'], page['top'], pen, force, speed, cleanhpgl)
# hpgl += box((page['left'] + 200, page['bottom'] + 200), 200 * 40, 287 * 40) # hpgl += box((page['left'] + 200, page['bottom'] + 200), 200 * 40, 287 * 40)
hpgl += textbox.hpgl() hpgl += textbox.hpgl()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment