mirror of
https://github.com/brmlab/brmbar.git
synced 2025-06-07 21:04:00 +02:00
barcodes
This commit is contained in:
parent
4986b6c288
commit
3cbb55a2be
4 changed files with 17 additions and 14 deletions
2
Makefile
2
Makefile
|
@ -6,7 +6,7 @@ all: brmbar.c
|
||||||
bcc -Md -W brmbar.c dataio.c -o brmbar.com
|
bcc -Md -W brmbar.c dataio.c -o brmbar.com
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f brmbar.com brmbar
|
rm -f brmbar.com brmbar barcodes.svg
|
||||||
|
|
||||||
dos:
|
dos:
|
||||||
dosbox brmbar.com
|
dosbox brmbar.com
|
||||||
|
|
14
barcodes.py
14
barcodes.py
|
@ -14,7 +14,7 @@ svgfoot = """
|
||||||
</svg>
|
</svg>
|
||||||
"""
|
"""
|
||||||
|
|
||||||
cntx = 5
|
cntx = 6
|
||||||
cnty = 10
|
cnty = 10
|
||||||
scalex = 1.2
|
scalex = 1.2
|
||||||
scaley = 1.2
|
scaley = 1.2
|
||||||
|
@ -24,18 +24,20 @@ items = f.readlines()
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
items = map(lambda x: x.strip(), items)
|
items = map(lambda x: x.strip(), items)
|
||||||
items += ['cred50','cred100','cred200','cred500','cred1000','RESET']
|
itemss = map(lambda x: x[0:3], items)
|
||||||
|
items += ['credit 20', 'credit 50', 'credit 100', 'credit 200', 'credit 500', 'credit 1000', 'RESET']
|
||||||
|
itemss += ['$02','$05','$10','$20','$50','$1k','RST']
|
||||||
|
|
||||||
f = open('barcodes.svg','w')
|
f = open('barcodes.svg','w')
|
||||||
f.write(svghead)
|
f.write(svghead)
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
j = 0
|
j = 0
|
||||||
for item in items:
|
for idx in xrange(len(items)):
|
||||||
elem = Popen(('zint','--directsvg','-d', item), stdout = PIPE).communicate()[0].split('\n')
|
elem = Popen(('zint','--directsvg','-d', itemss[idx]), stdout = PIPE).communicate()[0].split('\n')
|
||||||
elem = elem[8:-2]
|
elem = elem[8:-2]
|
||||||
elem[0] = elem[0].replace('id="barcode"', 'transform="matrix(%f,0,0,%f,%f,%f)"' % (scalex, scaley, 42+i*200 , 14+j*90) )
|
elem[0] = elem[0].replace('id="barcode"', 'transform="matrix(%f,0,0,%f,%f,%f)"' % (scalex, scaley, 52+i*160 , 14+j*100) )
|
||||||
elem[23] = item
|
elem[23] = items[idx]
|
||||||
f.write('\n'.join(elem))
|
f.write('\n'.join(elem))
|
||||||
i += 1
|
i += 1
|
||||||
if i >= cntx:
|
if i >= cntx:
|
||||||
|
|
2
brmbar.c
2
brmbar.c
|
@ -110,7 +110,7 @@ void read_input()
|
||||||
|
|
||||||
// scan people
|
// scan people
|
||||||
for (i = 0; i < people_count; ++i) {
|
for (i = 0; i < people_count; ++i) {
|
||||||
if (!strncmp( buf, people[i], strlen(people[i]) )) {
|
if (!strncmp( buf, people[i], 3 )) {
|
||||||
printf("\nMember %s ", people[i]);
|
printf("\nMember %s ", people[i]);
|
||||||
if (last_item == -1) {
|
if (last_item == -1) {
|
||||||
balance = modify_credit(people[i], 0);
|
balance = modify_credit(people[i], 0);
|
||||||
|
|
13
items.txt
13
items.txt
|
@ -1,8 +1,9 @@
|
||||||
cred50 Credit 50
|
$02 Credit 20
|
||||||
cred100 Credit 100
|
$05 Credit 50
|
||||||
cred200 Credit 200
|
$10 Credit 100
|
||||||
cred500 Credit 500
|
$20 Credit 200
|
||||||
cred1000 Credit 1000
|
$50 Credit 500
|
||||||
RESET RESET 0
|
$1k Credit 1000
|
||||||
|
RST RESET 0
|
||||||
4029764001807 Club Mate 0.5L -35
|
4029764001807 Club Mate 0.5L -35
|
||||||
4029764001821 Club Mate 0.33L -25
|
4029764001821 Club Mate 0.33L -25
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue