1
0
mirror of https://github.com/python-escpos/python-escpos synced 2025-08-24 09:03:34 +00:00

test add type-check for the qr-printing

This commit is contained in:
Patrick Kanzler
2016-08-15 22:33:23 +02:00
parent a38c124bb1
commit e8d91a6735
2 changed files with 34 additions and 3 deletions

View File

@@ -157,7 +157,7 @@ class Escpos(object):
if not native:
# Map ESC/POS error correction levels to python 'qrcode' library constant and render to an image
if model != QR_MODEL_2:
raise ValueError("Invalid QR model for qrlib rendering (must be QR_MODEL_2)")
raise ValueError("Invalid QR model for python-qrcode rendering (must be QR_MODEL_2)")
python_qr_ec = {
QR_ECLEVEL_H: qrcode.constants.ERROR_CORRECT_H,
QR_ECLEVEL_L: qrcode.constants.ERROR_CORRECT_L,
@@ -168,8 +168,7 @@ class Escpos(object):
qr_code.add_data(content)
qr_code.make(fit=True)
qr_img = qr_code.make_image()
im = qr_img._img.convert("RGB")
# Convert the RGB image in printable image
im = qr_img.convert("RGB") # Convert the RGB image in printable image
self.image(im)
return
# Native 2D code printing