Rewrite label designer as an item-based canvas editor
- Items (text blocks, emoji) are placed freely: click to select, drag to move, arrow-key nudge, rotate to any angle, resize, duplicate, fit/center - Emoji picker now covers the full emoji set via emoji-data-python (~1,900, 9 categories, name search, hover shows the name); thumbnails are rendered by Pillow with Noto Color Emoji so ZWJ sequences and flags display exactly as they print - Designs save/open as JSON; last design restored on launch
This commit is contained in:
+618
-222
File diff suppressed because it is too large
Load Diff
@@ -9,6 +9,7 @@ python = "~3.11"
|
|||||||
pyserial = "^3.5"
|
pyserial = "^3.5"
|
||||||
pillow = "^10.1.0"
|
pillow = "^10.1.0"
|
||||||
click = "^8.1.7"
|
click = "^8.1.7"
|
||||||
|
emoji-data-python = "^1.6"
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core"]
|
requires = ["poetry-core"]
|
||||||
|
|||||||
@@ -82,15 +82,18 @@ python niimprint -c bluetooth -a "E2:E1:08:03:09:87" -r 90 -i examples/B21_80x50
|
|||||||
|
|
||||||
## Label designer app
|
## Label designer app
|
||||||
|
|
||||||
`label_app.py` is a small Tkinter app for designing and printing text + emoji labels:
|
`label_app.py` is a Tkinter app for designing and printing labels with text and emoji:
|
||||||
|
|
||||||
```
|
```
|
||||||
python label_app.py
|
python label_app.py
|
||||||
```
|
```
|
||||||
|
|
||||||
- Pick a label size preset (or custom mm), type text (one line per row), click emojis to insert them
|
- Pick a label size preset (or custom mm)
|
||||||
- Live 1-bit preview shows exactly what the printer will produce
|
- **+ Text** adds a text block; click any emoji in the picker (all ~1,900, searchable by name) to add it
|
||||||
- Auto-fit shrinks the font until the text fits the label
|
- Click an item to select it, drag to move, arrow keys nudge (Shift = 10 px), Delete removes
|
||||||
- Printer model / connection / address / density are remembered in `~/.config/niimprint-label/settings.json`
|
- Selected item panel: edit text, size, angle (any degrees, or the ⟲/⟳ 90° buttons), X/Y, bold, alignment
|
||||||
|
- **Fit** resizes the item to fill the label; **Center H/V** aligns it
|
||||||
|
- The canvas shows the dithered 1-bit image exactly as the printer will produce it
|
||||||
|
- **Save…/Open…** store designs as JSON; the last design and printer settings are restored on launch
|
||||||
|
|
||||||
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.
|
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. Emoji are rendered by Pillow with the same font that prints, so the picker is WYSIWYG.
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
click==8.1.7
|
click==8.1.7
|
||||||
pillow==10.1.0
|
pillow==10.1.0
|
||||||
pyserial==3.5
|
pyserial==3.5
|
||||||
|
emoji-data-python==1.6.0
|
||||||
|
|||||||
Reference in New Issue
Block a user