This commit is contained in:
Aborelis 2024-05-14 02:12:57 +02:00
parent a9337407b7
commit 26138614e3

View file

@ -22,6 +22,8 @@ PROJECT_HOMEPAGE = "https://github.com/aborelis/ASN-Label-Generator"
class LabelContext: class LabelContext:
# pylint: disable=too-many-instance-attributes
def __init__(self, data): def __init__(self, data):
self.filename = None self.filename = None
@ -54,7 +56,8 @@ class LabelContext:
self.current_asn = self.first_asn self.current_asn = self.first_asn
def incASN(self): def inc_asn(self):
"""increase current asn count """
self.current_asn = self.current_asn + 1 self.current_asn = self.current_asn + 1
@ -76,7 +79,7 @@ def render(context: LabelContext, c: canvas.Canvas, width: float, height: float)
barcode_value = context.prefix + str(context.current_asn).zfill( barcode_value = context.prefix + str(context.current_asn).zfill(
context.num_digits context.num_digits
) )
context.incASN() context.inc_asn()
qr = QRCodeImage(barcode_value, size=sub_labelheight * context.qr_size) qr = QRCodeImage(barcode_value, size=sub_labelheight * context.qr_size)
qr.drawOn( qr.drawOn(
@ -126,6 +129,8 @@ def render(context: LabelContext, c: canvas.Canvas, width: float, height: float)
c.restoreState() c.restoreState()
# pylint: disable=too-many-locals
def generate( def generate(
filename=None, filename=None,
*, *,