Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ commands are:
* `QR`: Creates a QR code block
* `BARCODE`: Creates a barcode block. Optional: Can be preceded by #`TYPE`,
to generate a different barcode; default is CODE128, . e.g. `BARCODE#EAN:123456789012`
* `BARCODE-WITH-TEXT`: Creates a barcode block with text overlaid in the barcode.
Optional: Can be preceded by #`TYPE`, to generate a different barcode;
default is CODE128, e.g. `BARCODE-WITH-TEXT:im-a-text`

For instance, this input:

Expand Down
19 changes: 19 additions & 0 deletions src/labelle/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,20 @@ def flush_all():
render_engines.append(
BarcodeRenderEngine("\n".join(accumulator), barcode_type)
)
elif accumulator_type == "barcode-with-text":
barcode_type = (
BarcodeType(accumulator_options[0].lower())
if accumulator_options
else DEFAULT_BARCODE_TYPE
)
render_engines.append(
BarcodeWithTextRenderEngine(
content="\n".join(accumulator),
barcode_type=barcode_type,
font_file_name=font_path,
frame_width_px=frame_width_px,
)
)

accumulator = []
accumulator_type = "empty"
Expand Down Expand Up @@ -560,6 +574,11 @@ def flush_all():
accumulator_type = "barcode"
accumulator_options = options
accumulator.append(value)
elif setting == "BARCODE-WITH-TEXT":
flush_all()
accumulator_type = "barcode-with-text"
accumulator_options = options
accumulator.append(value)
elif setting == "NEWLINE":
accumulator.append(value)
else:
Expand Down