Add example printing from CSV
This commit is contained in:
parent
08c09cc696
commit
7f88dcaab5
12
.vscode/launch.json
vendored
12
.vscode/launch.json
vendored
@ -4,13 +4,23 @@
|
|||||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"configurations": [
|
"configurations": [
|
||||||
|
|
||||||
{
|
{
|
||||||
"name": "Python: Current File",
|
"name": "Python: Example Print",
|
||||||
"type": "python",
|
"type": "python",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"program": "${workspaceFolder}/generate_label_example.py",
|
"program": "${workspaceFolder}/generate_label_example.py",
|
||||||
"console": "integratedTerminal",
|
"console": "integratedTerminal",
|
||||||
"args": []
|
"args": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Python: Print CSV",
|
||||||
|
"type": "python",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder}/print_labels_from_csv.py",
|
||||||
|
"console": "integratedTerminal",
|
||||||
|
"args": []
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
}
|
}
|
@ -1,3 +1,6 @@
|
|||||||
|
# Prerequisites
|
||||||
|
- This project requires the brother_ql binary from the ``brother_ql`` project to be in the PATH.
|
||||||
|
|
||||||
# License
|
# License
|
||||||
|
|
||||||
This project is licensed under the GPLv2 license.
|
This project is licensed under the GPLv2 license.
|
||||||
|
10
labels.csv
Normal file
10
labels.csv
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
Heading,Line1,Line2,Cut
|
||||||
|
100n 10%,0603 X7R 10V,AVX,
|
||||||
|
100n 10%,0603 X7R 10V,Kemet,
|
||||||
|
100n 10%,0603 X7R 10V,AVX,
|
||||||
|
100n 10%,0805 X7R 10V,Taiyo Yuden,
|
||||||
|
100n 10%,0805 X7R 10V,TKK,
|
||||||
|
100n 20%,1206 X7R 25V,Murata,
|
||||||
|
220n 20%,0805 X5R 100V,Murata,
|
||||||
|
120n 10%,1206 X7R 10V,Samsung,1
|
||||||
|
|
|
21
print_labels_from_csv.py
Normal file
21
print_labels_from_csv.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
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)
|
Loading…
Reference in New Issue
Block a user