Repository navigation
py2max 0.4.1
Changes since the last release
Two rect-handling bugs, both of which broke documented entry points on any
patch that came off disk rather than out of a script.
Fixed
-
Layout operations work on patches loaded from disk. JSON has no tuple type, so every rect in a loaded patch arrived as a plain list, while
Box.patching_rectis declaredOptional[Rect]and read attribute-wise (rect.y) by the layout managers. Any layout call on a loaded patch therefore died withAttributeError: 'list' object has no attribute 'y'-- including the documentedpy2max optimize <file>CLI subcommand, which failed on every input file.Patcher.from_dictandBox.from_dictnow restore rect-valued keys (rect,patching_rect,presentation_rect) toRect.Round-trip fidelity is unaffected:
to_dict()normalizes those keys back to plain lists, so the serialized form stays pure JSON and a load/save cycle still reproduces its input exactly. Only the three keys py2max actually interprets are touched; opaque passthrough props such asclient_rect,dstrectandstorage_rectare left alone. -
enforce_integer_coords()no longer crashes on aRect. The rounding helper assigned torect.x/rect.y/rect.w/rect.h, butRectis aNamedTupleand immutable, so rounding any programmatically built patch with non-integer coordinates raisedAttributeError: can't set attribute. A rounded rect is now rebuilt and assigned back, preserving the storage form (Rectin,Rectout; list in, list out).