Add Tkinter label designer with emoji picker
label_app.py: label size presets, multi-line text with auto-fit / bold / alignment, tabbed emoji picker (rendered via Noto Color Emoji, gamma-darkened and dithered for the thermal head), live 1-bit preview, save PNG, print in a background thread. Settings persist in ~/.config/niimprint-label/. main.py is the earlier minimal GUI it supersedes.
This commit is contained in:
@@ -22,7 +22,7 @@ $ python niimprint --help
|
||||
Usage: niimprint [OPTIONS]
|
||||
|
||||
Options:
|
||||
-m, --model [b1|b18|b21|d11|d110] Niimbot printer model [default: b21]
|
||||
-m, --model [b1|b18|b21|d11|d101|d110] Niimbot printer model [default: b21]
|
||||
-c, --conn [usb|bluetooth] Connection type [default: usb]
|
||||
-a, --addr TEXT Bluetooth MAC address OR serial device path
|
||||
-d, --density INTEGER RANGE Print density [default: 5; 1<=x<=5]
|
||||
@@ -45,7 +45,8 @@ Generally, the image comes out of the printer with the same orientation you see
|
||||
As far as we've tested, Niimbot printers have **8 pixels per mm** (~203 dpi) resolution. The CLI prints the image you provided as-is, without any checks of the actual label size, so be careful. However the script will check if the image width is too big for selected printer. The maximum width in pixels is usually slightly less than specified maximum width in mm:
|
||||
|
||||
- **B21, B1, B18**: max 384 pixels (almost equal to 50 mm * 8 px/mm = 400)
|
||||
- **D11**: max 96 pixels (almost equal to 15 mm * 8 px/mm = 120)
|
||||
- **D11, D110**: max 96 pixels (almost equal to 15 mm * 8 px/mm = 120)
|
||||
- **D101**: max 192 pixels (25 mm tape); tested on 12 mm tape
|
||||
|
||||
### USB connection:
|
||||
|
||||
@@ -78,3 +79,18 @@ python niimprint -c bluetooth -a "E2:E1:08:03:09:87" -r 90 -i examples/B21_80x50
|
||||
## Licence
|
||||
|
||||
[MIT](https://choosealicense.com/licenses/mit/). Originally developed by [kjy00302](https://github.com/kjy00302), forked & enhanced by [AndBondStyle](https://github.com/AndBondStyle)
|
||||
|
||||
## Label designer app
|
||||
|
||||
`label_app.py` is a small Tkinter app for designing and printing text + emoji labels:
|
||||
|
||||
```
|
||||
python label_app.py
|
||||
```
|
||||
|
||||
- Pick a label size preset (or custom mm), type text (one line per row), click emojis to insert them
|
||||
- Live 1-bit preview shows exactly what the printer will produce
|
||||
- Auto-fit shrinks the font until the text fits the label
|
||||
- Printer model / connection / address / density are remembered in `~/.config/niimprint-label/settings.json`
|
||||
|
||||
Fonts: DejaVu Sans (`/usr/share/fonts/TTF/`) for text and Noto Color Emoji (`/usr/share/fonts/noto/`) for emoji; edit `TEXT_FONTS` / `EMOJI_FONT` at the top of the file for other distros.
|
||||
|
||||
Reference in New Issue
Block a user