From 2c790e1fe1c2910f38fae9c352fbd57f0893ab29 Mon Sep 17 00:00:00 2001 From: Christoffer Viken Date: Mon, 27 Mar 2017 16:02:24 +0000 Subject: [PATCH] Bar code lengths give different formats. --- text_interface/printermenu.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/text_interface/printermenu.py b/text_interface/printermenu.py index 449db46..74ea237 100644 --- a/text_interface/printermenu.py +++ b/text_interface/printermenu.py @@ -19,7 +19,13 @@ Put it up somewhere in the vicinity. thing = self.input_thing('Prodct/User> ') if isinstance(thing, Product): - print_bar_code(thing.bar_code, thing.name, barcode_type="ean13", rotate=conf.label_rotate, + if len(thing.bar_code) == 13: + bar_type = "ean13" + elif len(thing.bar_code) == 8: + bar_type = "ean8" + else: + bar_type = "code39" + print_bar_code(thing.bar_code, thing.name, barcode_type=bar_type, rotate=conf.label_rotate, printer_type="QL-700", label_type=conf.label_type) elif isinstance(thing, User): print_name_label(text=thing.name, label_type=conf.label_type, rotate=conf.label_rotate,