Add model table, PrinterError, and port upstream PRs #28/#12

Library changes on top of upstream 35c41a7:

- models.py: MODELS table (max width / density / needs_print_clear per
  model) and prepare_print(), replacing the duplicated width/density
  logic in the CLI. Adds d101 (192px head, tested on 12mm tape).
- _transceive raises PrinterError instead of returning None (callers
  used to crash with AttributeError on a silent printer).
- PR #28: send ALLOW_PRINT_CLEAR / SET_QUANTITY for D-series models
  (labels taller than ~210px failed on D11 without them) and pause 1ms
  between line packets.
- PR #12: replace the fixed sleep after END_PAGE_PRINT with
  get_print_status() polling (30s deadline, fallback for firmwares that
  do not answer). get_print_status returns PrintStatus(finished,
  progress, feed_progress, error).
- set_dimension parameter names match their use.

Verified on a D101 over Bluetooth.
This commit is contained in:
Gracious
2026-09-21 08:02:58 +01:00
parent 35c41a705c
commit 90137dd111
5 changed files with 154 additions and 44 deletions
+1
View File
@@ -1 +1,2 @@
from .models import MODELS, PrinterError, PrinterModel, get_model, prepare_print
from .printer import BluetoothTransport, PrinterClient, SerialTransport