mirror of
https://github.com/aborelis/ASN-Label-Generator.git
synced 2026-03-14 16:43:27 +00:00
cleanp
This commit is contained in:
parent
a9337407b7
commit
26138614e3
1 changed files with 8 additions and 3 deletions
|
|
@ -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,
|
||||||
*,
|
*,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue