From 29a7a6608555af13c54eb51d8bb41a6afe567363 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20J=C3=A4ckle?= Date: Sat, 18 Dec 2021 22:30:16 +0100 Subject: [PATCH] load CH-Kreuz as python module, not as svg file --- CH-Kreuz_7mm.svg | 14 -------------- ch_kreuz.py | 20 ++++++++++++++++++++ qrr.py | 6 +++--- 3 files changed, 23 insertions(+), 17 deletions(-) delete mode 100755 CH-Kreuz_7mm.svg create mode 100644 ch_kreuz.py diff --git a/CH-Kreuz_7mm.svg b/CH-Kreuz_7mm.svg deleted file mode 100755 index f1296f3..0000000 --- a/CH-Kreuz_7mm.svg +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - diff --git a/ch_kreuz.py b/ch_kreuz.py new file mode 100644 index 0000000..6f2453e --- /dev/null +++ b/ch_kreuz.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 + +import svgutils.transform as st + + +def swisscross(): + return st.fromstring( + '\ + \ + \ + \ + \ + \ + \ + ' + ).getroot() diff --git a/qrr.py b/qrr.py index 1d7bef8..299d360 100755 --- a/qrr.py +++ b/qrr.py @@ -3,8 +3,8 @@ import os.path import qrcode import qrcode.image.svg -import svgutils.transform as st - +from svgutils import transform as st +from ch_kreuz import swisscross as get_swisscross class qr_rechnung(): data = '' @@ -39,7 +39,7 @@ class qr_rechnung(): qrcode = st.fromfile(filepath) offset = self.calc_move_offset(qrcode.get_size()[0]) - swisscross = st.fromfile("CH-Kreuz_7mm.svg").getroot() + swisscross = get_swisscross() swisscross.moveto( x=offset['offset'], y=offset['offset'],