Repository Public License
1#!/usr/bin/env python32# =============================================================================3# SP BOUCHER | SOFTWARE & RESEARCH4# ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5# =============================================================================6#7# PROJECT METADATA8# -----------------------------------------------------------------------------9# Project : ORIX Camera10# File : Scripts/screenshots.py11# Description : Builds docs/screenshots from real captures of the app in12# the Simulator: the named attachments of the last UI test13# runs (build/shots/<simulator>/manifest.json, written by14# Scripts/build.sh uitest) and a few static screens launched15# with Scripts/sim.sh. Images are converted to JPEG, 1100 px16# on the long side. usage: Scripts/screenshots.py (run after17# build.sh uitest on both simulators)18# Module : Scripts19# Repository : https://git.spboucher.ai/orix-camera20# Project Website : https://www.orixlab.dev21# Created : 2026-11-2122# Last Modified : 2026-11-2123#24# =============================================================================25# AUTHOR & PROFESSIONAL AFFILIATION26# =============================================================================27#28# Author : Simon-Pierre Boucher29# Position : Professor of Finance30# Institution : Université du Québec en Outaouais (UQO)31# Department : Département des sciences administratives32# Organization : SP Boucher33#34# Website : https://spboucher.ai35# Git : https://git.spboucher.ai36#37# =============================================================================38# OFFICIAL CONTACT DIRECTORY39# =============================================================================40#41# General : info@spboucher.ai42# Professional : contact@spboucher.ai43# Direct : simon@spboucher.ai44# Research : research@spboucher.ai45# Development : dev@spboucher.ai46# Support : support@spboucher.ai47# Security/Admin : admin@spboucher.ai48# Notifications : notifications@spboucher.ai49#50# Preferred Contact: support@spboucher.ai51#52# =============================================================================53# COPYRIGHT & INTELLECTUAL PROPERTY54# =============================================================================55#56# Copyright (c) 202657# Simon-Pierre Boucher58#59# All rights reserved where applicable.60#61# This file is governed by the applicable project license,62# copyright notices, institutional agreements and relevant law.63#64# Unless expressly authorized by the applicable license or65# rights holder, copying, redistribution, sublicensing,66# publication and commercial exploitation are not permitted.67#68# Existing third-party rights and notices remain unaffected.69#70# =============================================================================71# CONFIDENTIALITY & SECURITY72# =============================================================================73#74# Classification : Public75# Distribution : Public repository; use is governed by the project license76# Security Contact : admin@spboucher.ai77#78# Access to this source does not independently grant permission79# to redistribute or disclose confidential materials.80#81# Do not embed credentials, private keys, access tokens,82# certificates or confidential personal information.83#84# =============================================================================85# LICENSE & MAINTENANCE86# =============================================================================87#88# License : Proprietary, all rights reserved (see license file)89# License File : LICENSE90# Maintainer : Simon-Pierre Boucher91# Technical Contact: dev@spboucher.ai92#93# =============================================================================94# END OF SP BOUCHER SOURCE HEADER95# =============================================================================9697import json98import os99import subprocess100import sys101102ROOT = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))103OUT = os.path.join(ROOT, "docs", "screenshots")104ENGLISH = ["-AppleLanguages", "(en)", "-AppleLocale", "en_CA"]105106# Screens that need interaction come from UI test attachments: output name -> (simulator folder, attachment name).107FROM_TESTS = {108 "iphone-welcome": ("ORIXCamera_iPhone", "welcome"),109 "iphone-auto": ("ORIXCamera_iPhone", "auto"),110 "iphone-pro-photo-dial": ("ORIXCamera_iPhone", "pro-photo-iso"),111 "iphone-format-sheet": ("ORIXCamera_iPhone", "format-sheet"),112 "iphone-pro-video": ("ORIXCamera_iPhone", "pro-video-recording"),113 "iphone-light-trails": ("ORIXCamera_iPhone", "creative-light-trails"),114 "iphone-analysis": ("ORIXCamera_iPhone", "analysis"),115 "iphone-library": ("ORIXCamera_iPhone", "library"),116 "iphone-viewer": ("ORIXCamera_iPhone", "viewer"),117 "iphone-metadata": ("ORIXCamera_iPhone", "metadata"),118 "iphone-editor": ("ORIXCamera_iPhone", "editor-presets"),119 "iphone-editor-crop": ("ORIXCamera_iPhone", "editor-crop"),120 "iphone-export": ("ORIXCamera_iPhone", "export"),121 "iphone-settings": ("ORIXCamera_iPhone", "settings"),122 "ipad-library": ("ORIXCamera_iPad", "library"),123 "ipad-editor": ("ORIXCamera_iPad", "editor-presets"),124 "ipad-camera": ("ORIXCamera_iPad", "pro-photo-iso"),125}126# Static screens: output name -> launch arguments.127FROM_LAUNCH = {128 "iphone-pro-photo": ["-ORIXMode", "photo", "-ORIXTools", "golden"],129 "iphone-histogram": ["-ORIXMode", "photo", "-ORIXTools", "rgb,bigHistogram"],130 "iphone-focus-peaking": ["-ORIXMode", "photo", "-ORIXTools", "peaking"],131 "iphone-zebra": ["-ORIXMode", "video", "-ORIXTools", "zebra,shadows"],132 "iphone-creative": ["-ORIXMode", "creative", "-ORIXCreative", "noiseStack"],133}134135136def convert(source, name):137 target = os.path.join(OUT, name + ".jpg")138 subprocess.run(["sips", "-s", "format", "jpeg", "-s", "formatOptions", "82", "-Z", "1100", source, "--out", target],139 check=True, stdout=subprocess.DEVNULL)140 return target141142143def main():144 os.makedirs(OUT, exist_ok=True)145 missing = []146 for name, (folder, attachment) in FROM_TESTS.items():147 directory = os.path.join(ROOT, "build", "shots", folder)148 manifest = os.path.join(directory, "manifest.json")149 found = None150 if os.path.exists(manifest):151 for test in json.load(open(manifest)):152 for item in test.get("attachments", []):153 if item.get("suggestedHumanReadableName", "").startswith(attachment + "_"):154 found = os.path.join(directory, item["exportedFileName"])155 if found and os.path.exists(found):156 convert(found, name)157 else:158 missing.append(name)159 for name, arguments in FROM_LAUNCH.items():160 raw = os.path.join(ROOT, "build", "shots", name + ".png")161 subprocess.run([os.path.join(ROOT, "Scripts", "sim.sh"), raw, "6"] + ENGLISH + ["-ORIXUITest", "YES", "-ORIXReset", "YES"] + arguments,162 check=True, stdout=subprocess.DEVNULL)163 convert(raw, name)164 print("%d screenshots in docs/screenshots" % len([f for f in os.listdir(OUT) if f.endswith(".jpg")]))165 if missing:166 print("missing (run Scripts/build.sh uitest on both simulators first): %s" % ", ".join(missing))167 sys.exit(1)168169170if __name__ == "__main__":171 main()172