21 lines
646 B
Python
21 lines
646 B
Python
|
import pandas as pd
|
||
|
import shimatta_label.label_image as li
|
||
|
import shimatta_label.brother_ql_wrapper as ql_wrapper
|
||
|
import os
|
||
|
|
||
|
medir = os.path.dirname(__file__)
|
||
|
example_data_path = os.path.join(medir, 'labels.csv')
|
||
|
|
||
|
df = pd.read_csv(example_data_path)
|
||
|
|
||
|
printer = ql_wrapper.BrotherQlPrinter(model='QL-800', printer_connection='usb://0x04f9:0x209b')
|
||
|
|
||
|
for _, row in df.iterrows():
|
||
|
label = li.MiceToiletLabel()
|
||
|
label.put_text(row['Heading'], row['Line1'], row['Line2'])
|
||
|
file_path = label.save()
|
||
|
cut = False
|
||
|
if row['Cut'] == 1:
|
||
|
cut = True
|
||
|
printer.print_image(file_path, cut = cut, rotation=270)
|
||
|
os.remove(file_path)
|