#!/usr/bin/env python3 """Build the UI recovery document from the template and real Rust widget renders.""" import argparse import base64 from pathlib import Path import hashlib import json ROOT=Path(__file__).resolve().parent PREVIEWS=ROOT.parent/'analysis/parsec/research/ui/recovered-layout/previews' SHOTS=[('computers-1100','Computers · 1100×780 · 100%'),('computers-768','Computers · 768×700 · 100%'),('computers-1100-150dpi','Computers · 논리 1100×780 · 150%'),('settings-1100','Settings · 1100×780 · 100%')] LAYOUT=ROOT.parent/'analysis/parsec/research/ui/client-layout' LAYOUT_SHOTS=[('before/host-1100-1','수정 전 · Host 간격과 긴 PC 이름'), ('after/host-1100-1','수정 후 · Host 간격과 긴 PC 이름'), ('before/password-760-1','수정 전 · 긴 오류로 연결 버튼 잘림'), ('after/password-760-1','수정 후 · 오류 스크롤과 연결 버튼'), ('after/updates-1100-1','수정 후 · Client Updates 간격')] def main(): parser=argparse.ArgumentParser(description=__doc__);parser.add_argument('--check',action='store_true');args=parser.parse_args() gallery=[];records=[] for name,label in SHOTS: raw=(PREVIEWS/f'{name}.png').read_bytes() gallery.append(f'

{label}

{label}
{label} · production Rust widgets / fixture devices / Linux render
') records.append({'file':name+'.png','sha256':hashlib.sha256(raw).hexdigest(),'label':label}) layout_gallery=[] for name,label in LAYOUT_SHOTS: raw=(LAYOUT/f'{name}.png').read_bytes() layout_gallery.append(f'

{label}

{label}
{label} · 실제 Desktop::draw / 임시 프로필 fixture / Linux 한국어 글꼴 / Windows 전용 행 제외
') records.append({'file':'../../client-layout/'+name+'.png','sha256':hashlib.sha256(raw).hexdigest(),'label':label}) html=(ROOT/'ui-recovery.template.html').read_text().replace('{{gallery}}','\n'.join(gallery)).replace('{{layout_gallery}}','\n'.join(layout_gallery)) files={ROOT/'ui-recovery.html':html,PREVIEWS/'manifest.json':json.dumps({'renderer':'egui_kittest wgpu / Linux software Vulkan','originalWindowsCapture':False,'files':records},ensure_ascii=False,indent=2)+'\n'} for path,text in files.items(): if args.check: if path.read_text()!=text:raise SystemExit('Stale generated UI recovery document: '+str(path)) else:path.write_text(text) print('UI_RECOVERY_DOCUMENT_OK') if __name__=='__main__':main()