From eb5cca44c6e4e7b09db2043e56678cfbecc54319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mario=20H=C3=BCttel?= Date: Mon, 10 Jan 2022 13:16:34 +0100 Subject: [PATCH] Update 'print_single_mice.py' --- print_single_mice.py | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/print_single_mice.py b/print_single_mice.py index b781b79..62c21bd 100755 --- a/print_single_mice.py +++ b/print_single_mice.py @@ -4,22 +4,25 @@ import shimatta_label.label_image as li import shimatta_label.brother_ql_wrapper as ql_wrapper import sys -printer_model = 'QL-800' -printer_connection = 'usb://0x04f9:0x209b' +def print_label(): + printer_model = 'QL-800' + printer_connection = 'usb://0x04f9:0x209b' -if len(sys.argv) < 4: - print(f'Usage: {sys.argv[0]} ') - heading = input('First (Bold Heading) Line:') - line2 = input('Second Line:') - line3 = input('Third line:') -else: - heading = sys.argv[1] - line2 = sys.argv[2] - line3 = sys.argv[3] + if len(sys.argv) < 4: + print(f'Usage: {sys.argv[0]} ') + heading = input('First (Bold Heading) Line:') + line2 = input('Second Line:') + line3 = input('Third line:') + else: + heading = sys.argv[1] + line2 = sys.argv[2] + line3 = sys.argv[3] -label = li.MiceToiletLabel() -label.put_text(heading, line2, line3) + label = li.MiceToiletLabel() + label.put_text(heading, line2, line3) -printer = ql_wrapper.BrotherQlPrinter(model=printer_model, printer_connection=printer_connection, label_format='12') -printer.print_image(label.get_pillow_image(), cut=True, rotation=270) + printer = ql_wrapper.BrotherQlPrinter(model=printer_model, printer_connection=printer_connection, label_format='12') + printer.print_image(label.get_pillow_image(), cut=True, rotation=270) +if __name__ == '__main__': + print_label() \ No newline at end of file