Render QR codes pixel-exact with an own encoder

nxhmi.qr is a dependency-free QR encoder. Measured in the Editor
simulator: numeric/alphanumeric/byte mode by content, level L, mask 0,
smallest version; scaled to w - 2*dis by width (not clipped to h), last
column run one pixel narrower, logo centred, nothing when too small.
Basic rendering is now 20/20 pixel-exact.

Also: unknown component kinds give a clean CLI error instead of a
traceback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mangavalkandClaude Opus 5.5 committed 2026-11-15 16:17:23 +01:00
1 parent f0bcc608b1
commit 842591a14c
10 files changed
+429 -9

No files matched your search

+8
View File
@@ -67,6 +67,14 @@ class Cli(unittest.TestCase):
sch = json.loads(self.run_cli("schema", "slider")[1])
self.assertIn("vertical", next(x for x in sch["attributes"] if x["name"] == "mode")["values"])
def test_unknown_kind_is_a_clean_error(self):
err = io.StringIO()
with contextlib.redirect_stderr(err):
rc, _ = self.run_cli("schema", "qr_code")
self.assertEqual(rc, 2)
self.assertIn("known kinds", err.getvalue())
self.assertIn("qrcode", err.getvalue())
def test_decode_encode(self):
d = os.path.join(self.tmp, "dec")
self.run_cli("decode", self.hmi, d)