Cells never move; each NumericSelectLabel shows the number it holds on white and the empty cell takes the board colour via a linked backgroundColor. Adds the V2 generator, build step (with a direct-Java sedonac fallback), offline verifier mode (--v2) and viewer support. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
53 lines
2.1 KiB
Python
53 lines
2.1 KiB
Python
"""Builds aspirin(.sax/_solver.sax/V2.sax) -> .sab and packages app-ORION-<name>.zip for simulatorLauncher.exe.
|
|
|
|
Zip layout matches the launcher's ExampleApp backups:
|
|
app.sax, device/app.sab, device/kits.scode, device/fonts/*.oxfl, fontBankXL/*.oxfl
|
|
"""
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
import zipfile
|
|
|
|
SEDONA = r"C:\Users\aa\OneDrive - Ontrol\Documents\_is\NiagaraAXSedona\sedona"
|
|
SIM = os.path.join(SEDONA, "ontrol", "ontrolSimulator")
|
|
EXAMPLE = os.path.join(SIM, "ExampleApp", "app-ORION-VM_miniini.zip") # source of Orion kits.scode
|
|
FONTS = os.path.join(SEDONA, "ontrol", "fontBankXL")
|
|
USED_FONTS = ["18pt Tahoma.oxfl", "24pt Tahoma.oxfl", "32pt Tahoma.oxfl",
|
|
"bold 32pt Tahoma.oxfl", "bold 36pt Tahoma.oxfl", "bold 48pt Tahoma.oxfl",
|
|
"bold 52pt Tahoma.oxfl"]
|
|
|
|
here = os.path.dirname(os.path.abspath(__file__))
|
|
os.chdir(here)
|
|
env = dict(os.environ, sedona_home=SEDONA)
|
|
with zipfile.ZipFile(EXAMPLE) as src:
|
|
scode = src.read("device/kits.scode")
|
|
|
|
JAVA = r"C:\Niagara\Niagara-4.15.1.16\jre\bin\java.exe" # fallback when sedonac.exe finds no JVM
|
|
|
|
|
|
def sedonac(sax):
|
|
if subprocess.call([os.path.join(SEDONA, "bin", "sedonac.exe"), sax], env=env) == 0:
|
|
return
|
|
lib = os.path.join(SEDONA, "lib")
|
|
subprocess.check_call([JAVA, f"-Dsedona.home={SEDONA}", "-cp",
|
|
os.pathsep.join([os.path.join(lib, "sedonac.jar"),
|
|
os.path.join(lib, "sedona.jar")]),
|
|
"sedonac.Main", sax])
|
|
|
|
|
|
for name, gen in (("aspirin", ["gen_aspirin.py"]),
|
|
("aspirin_solver", ["gen_aspirin.py", "--solver"]),
|
|
("aspirinV2", ["gen_aspirinV2.py"])):
|
|
subprocess.check_call([sys.executable] + gen)
|
|
sedonac(f"{name}.sax")
|
|
out = f"app-ORION-{name}.zip"
|
|
with zipfile.ZipFile(out, "w", zipfile.ZIP_DEFLATED) as z:
|
|
z.write(f"{name}.sax", "app.sax")
|
|
z.write(f"{name}.sab", "device/app.sab")
|
|
z.writestr("device/kits.scode", scode)
|
|
for f in USED_FONTS:
|
|
p = os.path.join(FONTS, f)
|
|
z.write(p, f"device/fonts/{f}")
|
|
z.write(p, f"fontBankXL/{f}")
|
|
print("wrote", out)
|