update script
This commit is contained in:
parent
00d54045c1
commit
7608b7f39a
2 changed files with 5 additions and 7 deletions
|
@ -6,7 +6,7 @@ Labels for homebox
|
||||||
```
|
```
|
||||||
python3 -m venv py
|
python3 -m venv py
|
||||||
source py/bin/activate
|
source py/bin/activate
|
||||||
cat generate_labels.py
|
|
||||||
pip install svgwrite
|
apt install qrencode
|
||||||
pip install svgwrite qrcode[pil]
|
pip install svgwrite qrcode[pil]
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import svgwrite
|
import svgwrite
|
||||||
import pyqrcode
|
import os
|
||||||
|
|
||||||
lost_and_found_content = "Found? https://l3d.ch/kontakt"
|
lost_and_found_content = "Found? https://l3d.ch/kontakt"
|
||||||
asset_content_prefix = "000-"
|
asset_content_prefix = "000-"
|
||||||
|
@ -33,11 +33,9 @@ def create_a4_svg(output_filename):
|
||||||
dwg.add(dwg.rect(insert=(f'{x*70+29.7+0.5}mm', f'{y*29.7+28.2}mm'), size=('38.3mm', '0.2mm'), fill="grey", stroke="none"))
|
dwg.add(dwg.rect(insert=(f'{x*70+29.7+0.5}mm', f'{y*29.7+28.2}mm'), size=('38.3mm', '0.2mm'), fill="grey", stroke="none"))
|
||||||
|
|
||||||
# create qr-code
|
# create qr-code
|
||||||
qr = pyqrcode.create(f'https://i.l3d.ch/a/{asset_content_prefix}{asset_content_suffix:03}', error="H")
|
os.system(f'qrencode -t svg -l H -s 42 "https://i.l3d.ch/a/{asset_content_prefix}{asset_content_suffix:03}" -o /tmp/homebox-{asset_content_prefix}{asset_content_suffix:03}.svg')
|
||||||
# Save QR code as SVG
|
|
||||||
qr.svg('/tmp/qr.svg', scale=50)
|
|
||||||
# import
|
# import
|
||||||
qr_code_svg = svgwrite.image.Image('/tmp/qr.svg', insert=(f'{x*70}mm', f'{y*29.7}mm'), size=('29.7mm', '29.7mm'))
|
qr_code_svg = svgwrite.image.Image(f'/tmp/homebox-{asset_content_prefix}{asset_content_suffix:03}.svg', insert=(f'{x*70}mm', f'{y*29.7}mm'), size=('29.7mm', '29.7mm'))
|
||||||
dwg.add(qr_code_svg)
|
dwg.add(qr_code_svg)
|
||||||
asset_content_suffix+= 1
|
asset_content_suffix+= 1
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue