Commit 6112e689 by murtaugh

first interesting poster with misfits

parent e8667897
......@@ -17,7 +17,7 @@ X inventory... a sortable (JSON) structure ?!..
}
]
* name(s) ??!!
X name(s) ??!!
* year
* dimensions
......
......@@ -116,51 +116,52 @@ canvas.setStrokeColorRGB(0.0,0.0,0.0)
canvas.setFont('LabelFont', args.fontsize)
print ("{0} items".format(len(data)), file=sys.stderr)
# SORT
data.sort(key=lambda x: value(x['inventory']))
print ("[inventory] range from {0} to {1}".format(label(data[0]['inventory']), label(data[-1]['inventory'])))
# split the data into 3 groups: min, middle, max
# each group has groupcols items
midpoint = len(data)//2
midstart = midpoint - (groupcols//2)
groups = data[0:groupcols], data[midstart:midstart+groupcols], data[-groupcols:]
# for x in groups:
# assert (len(x) == groupcols)
groupx = pagemargin['left']
fillDataBox = False
for gi, group in enumerate(groups):
c, r = 0, 0
for i in group:
ipath = os.path.join(args.imagespath, i['img'])
im = Image.open(ipath)
im.thumbnail((100, 100), Image.ANTIALIAS)
imw = (im.size[0]/100) * ccw
imh = (im.size[1]/100) * cch
# centering dx,dy
dx, dy = (ccw - imw) / 2, (cch - imh) / 2
cx = groupx + (c*cellwidth)
cy = pageheight - pagemargin['top'] - ((r+1+1)*cellheight)
# DRAW IMAGE
canvas.drawImage(ImageReader(im), cx+dx+cellmargin['left'], cy+dy+cellmargin['bottom'], width=imw, height=imh)
# canvas.rect(cx, cy, cellwidth, cellheight)
# DRAW DATA BOX
cy = pageheight - pagemargin['top'] - ((r+1)*cellheight)
if fillDataBox:
canvas.setFillColorRGB(*boxfill)
canvas.rect(cx+dx+cellmargin['left'], cy+dy+cellmargin['bottom'], imw, imh, stroke=0, fill=1)
# drawTextCenteredInBox
# txt = i['FileModifyDate_parsed'].strftime("%Y-%m-%d %H:%M:%S")
txt = label(i['inventory'])
canvas.setFillColorRGB(*textcolor)
canvas.drawCentredString(cx+dx+cellmargin['left']+(imw/2), cy+dy+cellmargin['bottom']+(imh/2), "{0}".format(txt))
# print("cx, cy", cx, cy, file=sys.stderr)
c += 1
groupx += groupborder + (cellwidth*groupcols)
r = 0
for sortkey in "name inventory image_filesize dimensions dating".split():
# SORT
data.sort(key=lambda x: value(x[sortkey]))
print ("[{0}] range from {1} to {2}".format(sortkey, label(data[0][sortkey]), label(data[-1][sortkey])))
# split the data into 3 groups: min, middle, max
# each group has groupcols items
midpoint = len(data)//2
midstart = midpoint - (groupcols//2)
groups = data[0:groupcols], data[midstart:midstart+groupcols], data[-groupcols:]
# for x in groups:
# assert (len(x) == groupcols)
groupx = pagemargin['left']
fillDataBox = False
for gi, group in enumerate(groups):
c= 0
for i in group:
ipath = os.path.join(args.imagespath, i['img'])
im = Image.open(ipath)
im.thumbnail((100, 100), Image.ANTIALIAS)
imw = (im.size[0]/100) * ccw
imh = (im.size[1]/100) * cch
# centering dx,dy
dx, dy = (ccw - imw) / 2, (cch - imh) / 2
cx = groupx + (c*cellwidth)
cy = pageheight - pagemargin['top'] - ((r+1+1)*cellheight)
# DRAW IMAGE
canvas.drawImage(ImageReader(im), cx+dx+cellmargin['left'], cy+dy+cellmargin['bottom'], width=imw, height=imh)
# canvas.rect(cx, cy, cellwidth, cellheight)
# DRAW DATA BOX
cy = pageheight - pagemargin['top'] - ((r+1)*cellheight)
if fillDataBox:
canvas.setFillColorRGB(*boxfill)
canvas.rect(cx+dx+cellmargin['left'], cy+dy+cellmargin['bottom'], imw, imh, stroke=0, fill=1)
# drawTextCenteredInBox
# txt = i['FileModifyDate_parsed'].strftime("%Y-%m-%d %H:%M:%S")
txt = label(i[sortkey])
canvas.setFillColorRGB(*textcolor)
canvas.drawCentredString(cx+dx+cellmargin['left']+(imw/2), cy+dy+cellmargin['bottom']+(imh/2), "{0}".format(txt))
# print("cx, cy", cx, cy, file=sys.stderr)
c += 1
groupx += groupborder + (cellwidth*groupcols)
r += 2
# for i in range(1000):
#
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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