feat: "Abrir e conferir", the print file full screen, in pieces (item 7)
All checks were successful
Build and deploy / Validate source (push) Successful in 9s
Build and deploy / Integration suite on a real stack (push) Successful in 4m28s
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Successful in 1m17s
All checks were successful
Build and deploy / Validate source (push) Successful in 9s
Build and deploy / Integration suite on a real stack (push) Successful in 4m28s
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Successful in 1m17s
The card's "Abrir e conferir" opens the order's print file full screen (Dropstar's third round, item 7): zoom up to 100% real (one file pixel, one screen pixel), the position in cm, the order's files one after the other without closing, and the background behind the transparency light, dark or checkered, remembered (Dropstar, 2026-10-30). Closed in Arte recebida, it asks "Está OK?": the class of each item, prefilled with the measure, then "Mover para Arte conferida" (the final approved, the class kept, the card moved) or "Tratar a arte". A 15 m film is loaded like a map: while the PNG is written, its strips of 512 rows go to storage at 100% and at each halving (app/printtiles.py, originals/tiles/<upload>/), and the viewer (web/kanban-viewer.js) fetches only those on screen. They go when their file expires. Storing a print file that fails is now an attempt like a failed render, not a claim held for an hour. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -56,6 +56,32 @@ class PngStreamTests(unittest.TestCase):
|
||||
self.assertEqual(written.convert('RGBA').tobytes(), image.tobytes())
|
||||
|
||||
|
||||
class PyramidTests(unittest.TestCase):
|
||||
def test_strips_rebuild_the_film_at_each_level(self):
|
||||
from app import printtiles
|
||||
image = pattern(90, 1300)
|
||||
strips = {}
|
||||
with mock.patch.object(printtiles, 'STRIP_ROWS', 64), mock.patch.object(printtiles, 'SMALLEST_ROWS', 200):
|
||||
pyramid = printtiles.Pyramid(90, 1300, lambda level, index, data: strips.setdefault(level, []).append(data))
|
||||
for top in range(0, 1300, 100):
|
||||
pyramid.band(image.crop((0, top, 90, min(1300, top + 100))))
|
||||
manifest = pyramid.close()
|
||||
self.assertEqual(len(manifest['levels']), 4) # 1300, 650, 325, 163 rows
|
||||
for level, info in enumerate(manifest['levels']):
|
||||
pieces = [Image.open(io.BytesIO(data)) for data in strips[level]]
|
||||
self.assertEqual(len(pieces), info['strips'])
|
||||
self.assertEqual(sum(p.height for p in pieces), info['height'], level)
|
||||
self.assertTrue(all(p.width == info['width'] for p in pieces), level)
|
||||
# Level 0 is the film itself.
|
||||
whole = Image.new('RGBA', (90, 1300))
|
||||
top = 0
|
||||
for data in strips[0]:
|
||||
piece = Image.open(io.BytesIO(data))
|
||||
whole.paste(piece, (0, top))
|
||||
top += piece.height
|
||||
self.assertEqual(whole.tobytes(), image.tobytes())
|
||||
|
||||
|
||||
class PngRenderTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.dir = tempfile.TemporaryDirectory()
|
||||
@@ -120,6 +146,16 @@ class PngRenderTests(unittest.TestCase):
|
||||
self.assertEqual(second.convert('RGBA').getpixel((10, px(22) - px(21) + 5))[:3], RED)
|
||||
self.assertEqual([p['name'] for p in detail['parts']], ['DTF-7-item-1-p1.png', 'DTF-7-item-1-p2.png'])
|
||||
|
||||
def test_pieces_for_the_viewer_come_with_the_file(self):
|
||||
art = quadrants(118, 59, alpha=True)
|
||||
spec = item([placement(0, 0, 1, 0.5)], [source(1, 0.5)], 0.5)
|
||||
parts, detail = render(spec, {0: (self.save(art, 'art.png'), 'art.png')},
|
||||
self.dir.name, 'DTF-7-item-1', footer='DROPSTAR · Pedido DTF-7', tiles=True)
|
||||
tiles = detail['parts'][0]['tiles']
|
||||
self.assertEqual((tiles['width'], tiles['height']), Image.open(parts[0][0]).size)
|
||||
first = Image.open(os.path.join(self.dir.name, 'tiles', 'DTF-7-item-1.png', '0', '0.png'))
|
||||
self.assertEqual(first.crop((0, 0, 118, 59)).tobytes(), art.tobytes())
|
||||
|
||||
def test_a_pdf_page_is_rendered_at_300_dpi(self):
|
||||
art = quadrants(118, 59)
|
||||
path = os.path.join(self.dir.name, 'sheet.pdf')
|
||||
|
||||
Reference in New Issue
Block a user