feat: a PNG that records 200 DPI or more offers its own size, Manter, and the Prumo says if it was kept (Rodada 5, A1)
The Site reads the pHYs chunk of a loose art; at 200 DPI or more the size in the file is the default width and a Manter button sits before the table sizes (also when the art is turned 90 degrees). The source carries saved_width_cm and saved_dpi, used only by the Prumo report. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -132,6 +132,10 @@ class ProductionSource(StrictModel):
|
||||
# and printed; the file itself is length_cm plus both trims long.
|
||||
trim_top_cm: Decimal = Field(default=Decimal(0), ge=0, le=6000)
|
||||
trim_bottom_cm: Decimal = Field(default=Decimal(0), ge=0, le=6000)
|
||||
# The size the PNG itself recorded (item A1, round 5), only for the Prumo
|
||||
# report; nothing on the server prices or packs by it.
|
||||
saved_width_cm: Decimal | None = Field(default=None, gt=0, le=10000)
|
||||
saved_dpi: int | None = Field(default=None, ge=1, le=10000, strict=True)
|
||||
|
||||
class ProductionPlacement(StrictModel):
|
||||
source_index: int = Field(ge=0, le=199, strict=True)
|
||||
|
||||
21
app/prumo.py
21
app/prumo.py
@@ -103,6 +103,27 @@ def report(order, uploads):
|
||||
lines.append(f'{lead}{len(placements)} arte{"s" if len(placements) != 1 else ""}, '
|
||||
f'{rotated} girada{"s" if rotated != 1 else ""} (couberam melhor), '
|
||||
f'altura {_cm(production.get("height_cm"))} cm')
|
||||
# The size the PNG said it had (item A1, round 5): whether the
|
||||
# customer kept it or changed it.
|
||||
for k, source in enumerate(production.get('sources') or []):
|
||||
saved = source.get('saved_width_cm')
|
||||
if not saved:
|
||||
continue
|
||||
width = Decimal(str(source.get('width_cm')))
|
||||
length = Decimal(str(source.get('length_cm')))
|
||||
# Turned 90°, the art's own width runs along the film.
|
||||
if source.get('rotation_degrees') == 90:
|
||||
width, length = length, width
|
||||
saved_w = Decimal(str(saved))
|
||||
altura = saved_w * length / width if width else Decimal(0)
|
||||
dpi = source.get('saved_dpi')
|
||||
if abs(width - saved_w) < Decimal('0.05'):
|
||||
lines.append(f'{lead}Arte {k + 1}: tamanho lido do arquivo '
|
||||
f'{_cm(saved_w)} × {_cm(altura)} cm ({dpi} DPI), mantido')
|
||||
else:
|
||||
lines.append(f'{lead}Arte {k + 1}: tamanho lido do arquivo '
|
||||
f'{_cm(saved_w)} × {_cm(altura)} cm ({dpi} DPI), '
|
||||
f'alterado pelo cliente para {_cm(width)} cm')
|
||||
# The empty strips the Site cut from a ready sheet (Marcus, 2026-11-18).
|
||||
trimmed = sum(Decimal(str(s.get('trim_top_cm') or 0)) + Decimal(str(s.get('trim_bottom_cm') or 0))
|
||||
for s in production.get('sources') or [])
|
||||
|
||||
Reference in New Issue
Block a user