Rearrange landscape puzzle layout

Landscape leaves now lay the puzzle out in two columns: the whole grid
keeps one column (square, sized to the page) with the heading, area
totals, hint/undo and notes beside it, and the leaf navigation folds
into a single row. The game leaf also keeps its actions in a compact
bottom bar, so the board and controls are visible without scrolling.

- Leaf gains an optional wideBody used on landscape pages.
- Board gains maxWidth, defaulting to the previous 350.
- Split the puzzle body into area, board and note builders so both
  layouts share the same controls.
- Add a landscape widget regression test and document the layout.

This snapshot also carries the pending 2.0.2 notebook work already in
the tree: read-ahead restore, bundled PCM WAV narration assets, the
audio consistency comment, version 2.0.2+11, and the related unit,
integration and script updates.
This commit is contained in:
Hadrian Burkhardt
2026-10-31 06:21:36 +01:00
parent 302ad6d38e
commit a863b0ca93
22 changed files with 971 additions and 374 deletions
+3 -2
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
"""Prepare immutable WAV masters and bundled FLACs; Android performs no speech synthesis."""
import argparse, hashlib, importlib.metadata, json, subprocess
import argparse, hashlib, importlib.metadata, json, subprocess, shutil
from pathlib import Path
import numpy as np
import soundfile as sf
@@ -46,10 +46,11 @@ for record in json.loads((source/'scripts.json').read_text()):
audio*=.86/peak
wav=source/'wav'/f"{record['resource']}.wav";flac=raw/f"{record['resource']}.flac"
sf.write(wav,audio,rate,subtype='PCM_16')
shutil.copyfile(wav,raw/wav.name)
subprocess.run(['ffmpeg','-v','error','-y','-i',str(wav),'-c:a','flac','-compression_level','8',str(flac)],check=True)
decoded,check_rate=sf.read(flac,dtype='int16');master,_=sf.read(wav,dtype='int16')
assert check_rate==rate and np.array_equal(decoded,master)
tracks[record['pageId']]={**record,'file':flac.name,'sampleRate':rate,'channels':1,'frames':len(audio),
tracks[record['pageId']]={**record,'file':wav.name,'flacFile':flac.name,'wavSha256':hashlib.sha256(wav.read_bytes()).hexdigest(),'sampleRate':rate,'channels':1,'frames':len(audio),
'durationMs':round(len(audio)*1000/rate),'textSha256':hashlib.sha256(record['text'].encode()).hexdigest(),
'flacSha256':hashlib.sha256(flac.read_bytes()).hexdigest(),'cues':cues}
print(f"Saved {wav.name}: {len(audio)/rate:.1f}s; lossless FLAC verified",flush=True)