You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 KiB

In [1]:
quilt = [
["2-louisa-final","Camilo","newest patch_floor_rain","jacopo.otherness.def"],
["kendalpatch","euna", "patchericoforthefuture","punctuationflag"],
["euna","punctuationflag","euna","patchericoforthefuture"],
["2-louisa-final","MARTIN_GRADIENTENSE", "jacopo.otherness.def","kendalpatch"],
]
In [2]:
quilt
Out[2]:
[['2-louisa-final',
  'Camilo',
  'newest patch_floor_rain',
  'jacopo.otherness.def'],
 ['kendalpatch', 'euna', 'patchericoforthefuture', 'punctuationflag'],
 ['euna', 'punctuationflag', 'euna', 'patchericoforthefuture'],
 ['2-louisa-final',
  'MARTIN_GRADIENTENSE',
  'jacopo.otherness.def',
  'kendalpatch']]
In [6]:
output = open("my-fantastic-quilt", 'w')
for row in quilt:

    for linenumber in range(74):
        for patch in row:
            print(f"line {linenumber} {patch}")
            line = open(f"patches/{patch}.txt").readlines()[linenumber]
            line = line.rstrip("\n")
            print(line, file=output, end='')
        print(file=output)
#     print(line)
line 0 2-louisa-final
line 0 Camilo
line 0 newest patch_floor_rain
line 0 jacopo.otherness.def
line 1 2-louisa-final
line 1 Camilo
line 1 newest patch_floor_rain
line 1 jacopo.otherness.def
line 2 2-louisa-final
line 2 Camilo
line 2 newest patch_floor_rain
line 2 jacopo.otherness.def
line 3 2-louisa-final
line 3 Camilo
line 3 newest patch_floor_rain
line 3 jacopo.otherness.def
line 4 2-louisa-final
line 4 Camilo
line 4 newest patch_floor_rain
line 4 jacopo.otherness.def
line 5 2-louisa-final
line 5 Camilo
line 5 newest patch_floor_rain
line 5 jacopo.otherness.def
line 6 2-louisa-final
line 6 Camilo
line 6 newest patch_floor_rain
line 6 jacopo.otherness.def
line 7 2-louisa-final
line 7 Camilo
line 7 newest patch_floor_rain
line 7 jacopo.otherness.def
line 8 2-louisa-final
line 8 Camilo
line 8 newest patch_floor_rain
line 8 jacopo.otherness.def
line 9 2-louisa-final
line 9 Camilo
line 9 newest patch_floor_rain
line 9 jacopo.otherness.def
line 10 2-louisa-final
line 10 Camilo
line 10 newest patch_floor_rain
line 10 jacopo.otherness.def
line 11 2-louisa-final
line 11 Camilo
line 11 newest patch_floor_rain
line 11 jacopo.otherness.def
line 12 2-louisa-final
line 12 Camilo
line 12 newest patch_floor_rain
line 12 jacopo.otherness.def
line 13 2-louisa-final
line 13 Camilo
line 13 newest patch_floor_rain
line 13 jacopo.otherness.def
line 14 2-louisa-final
line 14 Camilo
line 14 newest patch_floor_rain
line 14 jacopo.otherness.def
line 15 2-louisa-final
line 15 Camilo
line 15 newest patch_floor_rain
line 15 jacopo.otherness.def
line 16 2-louisa-final
line 16 Camilo
line 16 newest patch_floor_rain
line 16 jacopo.otherness.def
line 17 2-louisa-final
line 17 Camilo
line 17 newest patch_floor_rain
line 17 jacopo.otherness.def
line 18 2-louisa-final
line 18 Camilo
line 18 newest patch_floor_rain
line 18 jacopo.otherness.def
line 19 2-louisa-final
line 19 Camilo
line 19 newest patch_floor_rain
line 19 jacopo.otherness.def
line 20 2-louisa-final
line 20 Camilo
line 20 newest patch_floor_rain
line 20 jacopo.otherness.def
line 21 2-louisa-final
line 21 Camilo
line 21 newest patch_floor_rain
line 21 jacopo.otherness.def
line 22 2-louisa-final
line 22 Camilo
line 22 newest patch_floor_rain
line 22 jacopo.otherness.def
line 23 2-louisa-final
line 23 Camilo
line 23 newest patch_floor_rain
line 23 jacopo.otherness.def
line 24 2-louisa-final
line 24 Camilo
line 24 newest patch_floor_rain
line 24 jacopo.otherness.def
line 25 2-louisa-final
line 25 Camilo
line 25 newest patch_floor_rain
line 25 jacopo.otherness.def
line 26 2-louisa-final
line 26 Camilo
line 26 newest patch_floor_rain
line 26 jacopo.otherness.def
line 27 2-louisa-final
line 27 Camilo
line 27 newest patch_floor_rain
line 27 jacopo.otherness.def
line 28 2-louisa-final
line 28 Camilo
line 28 newest patch_floor_rain
line 28 jacopo.otherness.def
line 29 2-louisa-final
line 29 Camilo
line 29 newest patch_floor_rain
line 29 jacopo.otherness.def
line 30 2-louisa-final
line 30 Camilo
line 30 newest patch_floor_rain
line 30 jacopo.otherness.def
line 31 2-louisa-final
line 31 Camilo
line 31 newest patch_floor_rain
line 31 jacopo.otherness.def
line 32 2-louisa-final
line 32 Camilo
line 32 newest patch_floor_rain
line 32 jacopo.otherness.def
line 33 2-louisa-final
line 33 Camilo
line 33 newest patch_floor_rain
line 33 jacopo.otherness.def
line 34 2-louisa-final
line 34 Camilo
line 34 newest patch_floor_rain
line 34 jacopo.otherness.def
line 35 2-louisa-final
line 35 Camilo
line 35 newest patch_floor_rain
line 35 jacopo.otherness.def
line 36 2-louisa-final
line 36 Camilo
line 36 newest patch_floor_rain
line 36 jacopo.otherness.def
line 37 2-louisa-final
line 37 Camilo
line 37 newest patch_floor_rain
line 37 jacopo.otherness.def
line 38 2-louisa-final
line 38 Camilo
line 38 newest patch_floor_rain
line 38 jacopo.otherness.def
line 39 2-louisa-final
line 39 Camilo
line 39 newest patch_floor_rain
line 39 jacopo.otherness.def
line 40 2-louisa-final
line 40 Camilo
line 40 newest patch_floor_rain
line 40 jacopo.otherness.def
line 41 2-louisa-final
line 41 Camilo
line 41 newest patch_floor_rain
line 41 jacopo.otherness.def
line 42 2-louisa-final
line 42 Camilo
line 42 newest patch_floor_rain
line 42 jacopo.otherness.def
line 43 2-louisa-final
line 43 Camilo
line 43 newest patch_floor_rain
line 43 jacopo.otherness.def
line 44 2-louisa-final
line 44 Camilo
line 44 newest patch_floor_rain
line 44 jacopo.otherness.def
line 45 2-louisa-final
line 45 Camilo
line 45 newest patch_floor_rain
line 45 jacopo.otherness.def
line 46 2-louisa-final
line 46 Camilo
line 46 newest patch_floor_rain
line 46 jacopo.otherness.def
line 47 2-louisa-final
line 47 Camilo
line 47 newest patch_floor_rain
line 47 jacopo.otherness.def
line 48 2-louisa-final
line 48 Camilo
line 48 newest patch_floor_rain
line 48 jacopo.otherness.def
line 49 2-louisa-final
line 49 Camilo
line 49 newest patch_floor_rain
line 49 jacopo.otherness.def
line 50 2-louisa-final
line 50 Camilo
line 50 newest patch_floor_rain
line 50 jacopo.otherness.def
line 51 2-louisa-final
line 51 Camilo
line 51 newest patch_floor_rain
line 51 jacopo.otherness.def
line 52 2-louisa-final
line 52 Camilo
line 52 newest patch_floor_rain
line 52 jacopo.otherness.def
line 53 2-louisa-final
line 53 Camilo
line 53 newest patch_floor_rain
line 53 jacopo.otherness.def
line 54 2-louisa-final
line 54 Camilo
line 54 newest patch_floor_rain
line 54 jacopo.otherness.def
line 55 2-louisa-final
line 55 Camilo
line 55 newest patch_floor_rain
line 55 jacopo.otherness.def
line 56 2-louisa-final
line 56 Camilo
line 56 newest patch_floor_rain
line 56 jacopo.otherness.def
line 57 2-louisa-final
line 57 Camilo
line 57 newest patch_floor_rain
line 57 jacopo.otherness.def
line 58 2-louisa-final
line 58 Camilo
line 58 newest patch_floor_rain
line 58 jacopo.otherness.def
line 59 2-louisa-final
line 59 Camilo
line 59 newest patch_floor_rain
line 59 jacopo.otherness.def
line 60 2-louisa-final
line 60 Camilo
line 60 newest patch_floor_rain
line 60 jacopo.otherness.def
line 61 2-louisa-final
line 61 Camilo
line 61 newest patch_floor_rain
line 61 jacopo.otherness.def
line 62 2-louisa-final
line 62 Camilo
line 62 newest patch_floor_rain
line 62 jacopo.otherness.def
line 63 2-louisa-final
line 63 Camilo
line 63 newest patch_floor_rain
line 63 jacopo.otherness.def
line 64 2-louisa-final
line 64 Camilo
line 64 newest patch_floor_rain
line 64 jacopo.otherness.def
line 65 2-louisa-final
line 65 Camilo
line 65 newest patch_floor_rain
line 65 jacopo.otherness.def
line 66 2-louisa-final
line 66 Camilo
line 66 newest patch_floor_rain
line 66 jacopo.otherness.def
line 67 2-louisa-final
line 67 Camilo
line 67 newest patch_floor_rain
line 67 jacopo.otherness.def
line 68 2-louisa-final
line 68 Camilo
line 68 newest patch_floor_rain
line 68 jacopo.otherness.def
line 69 2-louisa-final
line 69 Camilo
line 69 newest patch_floor_rain
line 69 jacopo.otherness.def
line 70 2-louisa-final
line 70 Camilo
line 70 newest patch_floor_rain
line 70 jacopo.otherness.def
line 71 2-louisa-final
line 71 Camilo
line 71 newest patch_floor_rain
line 71 jacopo.otherness.def
line 72 2-louisa-final
line 72 Camilo
line 72 newest patch_floor_rain
line 72 jacopo.otherness.def
line 73 2-louisa-final
line 73 Camilo
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-6-c95e08ba452e> in <module>
      5         for patch in row:
      6             print(f"line {linenumber} {patch}")
----> 7             line = open(f"patches/{patch}.txt").readlines()[linenumber]
      8             line = line.rstrip("\n")
      9             print(line, file=output, end='')

IndexError: list index out of range
In [5]:
from reportlab.pdfgen.canvas import Canvas
from reportlab.lib.pagesizes import A4,A0
from reportlab.lib.units import mm
from reportlab.pdfbase.ttfonts import TTFont, pdfmetrics

pagewidth, pageheight = A0

c = Canvas("quilts/quilt_WFTF.pdf", pagesize=(pagewidth, pageheight), bottomup=0) 


fontpath = "fonts/mplus-1m-regular.ttf"
font =  TTFont('1mregular', fontpath)
pdfmetrics.registerFont(font)

# To set a font in the PDF
c.setFont('1mregular', 14.4)

start_y = 5*mm
y = start_y
lineheight = 4*mm

lines = open("my-fantastic-quilt").readlines()

for line in lines:
    c.drawString(2*mm, y, line)
    y += lineheight

c.save()
In [ ]:
 
In [ ]: