#!/usr/bin/env python3 """Put the money faces' painted materials into the Loom package's catalogue. python3 scripts/import-money-materials.py [] The layers were painted with Codex (29-30 Oct 2026, after the till-receipt and ledger-card pictures chosen for Money) and cut out of the paintings (keyed off green, the receipt widened a little, each shadow made from its silhouette, the felt made seamless at #1B2433); the directory holds them as the faces lay them (CottonFaces' `Cotton/TransactionReceiptFace.swift`, `Cotton/TransactionChequeFace.swift` and `Cotton/AccountStatementFace.swift`, the felt by `FaceGroundSurface`). No word or figure is on any of them but the account card's five printed column heads (Date, Particulars, Dr, Cr, Balance: the card's print, not a record's words): the faces write every other word live. receipt-paper a till's thermal receipt, blank, its foot serrated by the cutter receipt-paper-shadow its shadow on the felt, larger than the paper cheque-leaf a blank cheque: security paper, its rules, amount box and foot band in dark blue cheque-leaf-shadow its shadow on the felt statement-card the buff account card: its balance panel, month band, heads and rows in green, its hole statement-card-shadow its shadow on the felt statement-tab the red signal clip on its top edge statement-tab-shadow the clip's shadow on the card Each is at least 3x the most it is drawn at on a phone (the shadows, blurs, half that), declared 3x (2x on the Mac) as the card paper is; the face sets the frame it draws each at. The aspects, rules and columns measured off the paintings are the faces' knobs (`ReceiptFaceKnobs`, `ChequeFaceKnobs`, `StatementFaceKnobs`): a repainted layer owes new ones. """ import json import pathlib import sys HERE = pathlib.Path(__file__).resolve().parent CATALOGUE = HERE.parent / 'apps/loom/Sources/CottonPaper/Media.xcassets' NAMES = [ 'receipt-paper', 'receipt-paper-shadow', 'cheque-leaf', 'cheque-leaf-shadow', 'statement-card', 'statement-card-shadow', 'statement-tab', 'statement-tab-shadow' ] def imageset(name, extension): folder = CATALOGUE / f'{name}.imageset' folder.mkdir(exist_ok=True) for old in folder.iterdir(): old.unlink() contents = { 'images': [ {'filename': f'{name}.{extension}', 'idiom': 'universal', 'scale': '3x'}, {'filename': f'{name}.{extension}', 'idiom': 'mac', 'scale': '2x'}, ], 'info': {'author': 'xcode', 'version': 1}, 'properties': {'preserves-vector-representation': False}, } (folder / 'Contents.json').write_text(json.dumps(contents, indent=2) + '\n') return folder / f'{name}.{extension}' def main(source): source = pathlib.Path(source) total = 0 for name in NAMES: found = [source / f'{name}.{extension}' for extension in ('png', 'jpg') if (source / f'{name}.{extension}').exists()] if len(found) != 1: sys.exit(f'{source} holds {len(found)} pictures named {name}, not one') picture = found[0] target = imageset(name, picture.suffix[1:]) target.write_bytes(picture.read_bytes()) total += picture.stat().st_size print(f'{picture.name} -> {name}') print(f'{total // 1024} KB in all') if __name__ == '__main__': main(sys.argv[1] if len(sys.argv) > 1 else str(pathlib.Path.home() / 'lane-briefs/money-faces/layers'))