cleanup directory and add pdf manuals

This commit is contained in:
S Groesz 2021-04-15 04:33:26 +00:00
parent cb72d27810
commit 489e04151b
4 changed files with 1 additions and 90 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
*.pdf
*.tmp

BIN
HP 3457A Operating.pdf Normal file

Binary file not shown.

BIN
HP 3457A Service.pdf Normal file

Binary file not shown.

View File

@ -1,89 +0,0 @@
from pylibdmtx import pylibdmtx as dmtx
from PIL import Image, ImageDraw, ImageOps
white = (255, 255, 255)
black = (0, 0, 0)
nullimg = Image.new('RGB', (9, 15), white)
chars = [0] * 10
# Draw zero
chars[0] = nullimg.copy()
draw = ImageDraw.Draw(chars[0])
draw.rectangle([(0, 0), (8, 14)], fill=white, outline=black, width=3)
# Draw one
chars[1] = nullimg.copy()
draw = ImageDraw.Draw(chars[1])
draw.rectangle([(3, 0), (5, 14)], fill=black, outline=black, width=3)
# Draw eight
chars[8] = chars[0].copy()
draw = ImageDraw.Draw(chars[8])
draw.rectangle([(3, 6), (5, 8)], fill=black, outline=black, width=3)
# Draw two and three
chars[2] = chars[8].copy()
draw = ImageDraw.Draw(chars[2])
draw.rectangle([(0, 3), (2, 5)], fill=white, outline=white, width=3)
chars[3] = chars[2].copy() # copy to three
draw.rectangle([(6, 9), (8, 11)], fill=white, outline=white, width=3)
# Finish three
draw = ImageDraw.Draw(chars[3])
draw.rectangle([(0, 9), (2, 11)], fill=white, outline=white, width=3)
# Draw nine
chars[9] = chars[8].copy()
draw = ImageDraw.Draw(chars[9])
draw.rectangle([(0, 9), (5, 14)], fill=white, outline=white, width=3)
# draw four
chars[4] = chars[9].copy()
draw = ImageDraw.Draw(chars[4])
draw.rectangle([(3, 0), (5, 2)], fill=white, outline=white, width=3)
# draw five
chars[5] = chars[8].copy()
draw = ImageDraw.Draw(chars[5])
draw.rectangle([(6, 3), (8, 5)], fill=white, outline=white, width=3)
draw.rectangle([(0, 9), (2, 11)], fill=white, outline=white, width=3)
# draw six
chars[6] = chars[8].copy()
draw = ImageDraw.Draw(chars[6])
draw.rectangle([(3, 0), (8, 5)], fill=white, outline=white, width=3)
# draw seven
chars[7] = chars[8].copy()
draw = ImageDraw.Draw(chars[7])
draw.rectangle([(0, 3), (5, 14)], fill=white, outline=white, width=3)
tgt = 'cmdsite/polls/static/polls/'
def dmxcreate(value):
val = str(int(value))
# create value image
valimg = Image.new('RGB',
(((9 * len(val)) + (3 * (len(val) - 1))), 15),
white)
for i, x in enumerate(val):
valimg.paste(chars[int(x)], ((9 * i) + (3 * i), 0))
# create datamatrix
datamatrix = dmtx.encode(val.encode('utf-8'))
dmximg = Image.frombytes('RGB',
(datamatrix.width, datamatrix.height),
datamatrix.pixels)
# combine datamatrix with text value
img = Image.new('RGB',
(max([dmximg.width, valimg.width]),
dmximg.height + valimg.height),
white)
img.paste(dmximg, (round(abs((dmximg.width - img.width) / 2)), 0))
img.paste(valimg, (round(abs((valimg.width - img.width) / 2)),
dmximg.height))
# Return grayscale image with transparency
img.putalpha(ImageOps.invert(img).convert('L'))
return img.convert('LA')