AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He
fix(editor): stop reporting silent failures as success
hugohe39f2d0704d194
diff --git a/skills/ppt-master/scripts/check_annotations.py b/skills/ppt-master/scripts/check_annotations.pyindex 79d509d6..fca2496b 100644--- a/skills/ppt-master/scripts/check_annotations.py+++ b/skills/ppt-master/scripts/check_annotations.py@@ -28,13 +28,14 @@ from slide_roster import discover_slide_svgsconfigure_utf8_stdio()-def scan_svg_file(svg_path: Path) -> list[dict]:- """Scan a single SVG file for edit annotations."""- try:- tree = ET.parse(svg_path)- except ET.ParseError:- return []+ """Scan a single SVG file for edit annotations.++ Propagates ``ET.ParseError``: whether one unreadable slide is fatal is+ the caller's call, and an empty annotation list must never stand in for+ a file that could not be read.+ """+ tree = ET.parse(svg_path)root = tree.getroot()annotations = []@@ -59,19 +60,28 @@ def scan_svg_file(svg_path: Path) -> list[dict]:return annotations-def scan_directory(dir_path: Path) -> dict[str, list[dict]]:- """Scan all SVG files in svg_output/ for edit annotations."""+def scan_directory(dir_path: Path) -> tuple[dict[str, list[dict]], list[str]]:+ """Scan all SVG files in svg_output/ for edit annotations.++ Returns the annotations found plus one message per slide that could not+ be parsed, so a broken page cannot pass as a page with no annotations.+ """svg_dir = dir_path / 'svg_output'if not svg_dir.exists():- return {}+ return {}, []results = {}+ unreadable = []for svg_file in discover_slide_svgs(svg_dir):- annotations = scan_svg_file(svg_file)+ try:+ annotations = scan_svg_file(svg_file)+ except ET.ParseError as exc:+ unreadable.append(f"{svg_file}: {exc}")+ continueif annotations:results[svg_file.name] = annotations- return results+ return results, unreadabledef print_results(results: dict[str, list[dict]]) -> None:@@ -107,6 +117,7 @@ def build_parser() -> argparse.ArgumentParser:def main(argv: Optional[list[str]] = None) -> int:parser = build_parser()args = parser.parse_args(argv)+ unreadable: list[str] = []target = Path(args.path).resolve()@@ -115,16 +126,24 @@ def main(argv: Optional[list[str]] = None) -> int:return 1if target.is_file() and target.suffix == '.svg':- annotations = scan_svg_file(target)+ try:+ annotations = scan_svg_file(target)+ except ET.ParseError as exc:+ unreadable.append(f"{target}: {exc}")+ annotations = []results = {target.name: annotations} if annotations else {}elif target.is_dir():- results = scan_directory(target)+ results, unreadable = scan_directory(target)else:print(f"Error: Expected a project directory or .svg file, got: {target}", file=sys.stderr)return 1- print_results(results)- return 0+ for message in unreadable:+ print(f"[ERROR] Failed to parse SVG {message}", file=sys.stderr)++ if results or not unreadable:+ print_results(results)+ return 1 if unreadable else 0if __name__ == '__main__':diff --git a/skills/ppt-master/scripts/svg_editor/server.py b/skills/ppt-master/scripts/svg_editor/server.pyindex 9e2e2bce..ffce4221 100644--- a/skills/ppt-master/scripts/svg_editor/server.py+++ b/skills/ppt-master/scripts/svg_editor/server.py@@ -929,6 +929,7 @@ def create_app(annotations = app.config['ANNOTATIONS']pending_edits = app.config['PENDING_EDITS']modified = []+ failures = []filenames = sorted(set(annotations.keys()) | set(pending_edits.keys()))for filename in filenames:@@ -939,20 +940,29 @@ def create_app(# need to write so the on-disk data-edit-* attributes are cleared.svg_file = _safe_svg_path(filename)- if svg_file is None or not svg_file.exists():+ if svg_file is None:+ failures.append(f'{filename}: Invalid slide path')+ continue+ if not svg_file.exists():+ failures.append(f'{filename}: Slide not found')continuetry:tree = ET.parse(str(svg_file))root = tree.getroot()- except ET.ParseError:+ except ET.ParseError as exc:+ failures.append(f'{filename}: Failed to parse SVG: {exc}')+ continue+ except OSError as exc:+ failures.append(f'{filename}: Failed to read SVG: {exc}')continueassign_temp_ids(root)ok, reason = _apply_edit_records(root, edits)if not ok:- return jsonify({'error': f'Failed to apply edits in {filename}: {reason}'}), 400+ failures.append(f'{filename}: Failed to apply edits: {reason}')+ continueold_annotations = {item['element_id']: item['annotation']@@ -975,7 +985,11 @@ def create_app(annotated_ids = set(anns.keys())strip_unused_temp_ids(root, annotated_ids)- tree.write(str(svg_file), encoding='UTF-8', xml_declaration=True)+ try:+ tree.write(str(svg_file), encoding='UTF-8', xml_declaration=True)+ except OSError as exc:+ failures.append(f'{filename}: Failed to write SVG: {exc}')+ continuets = time.time()for element_id, annotation_text in anns.items():old_text = old_annotations.get(element_id)@@ -1000,9 +1014,14 @@ def create_app('old': chg.get('old'), 'new': chg.get('new'),})modified.append(filename)-- app.config['ANNOTATIONS'] = {}- app.config['PENDING_EDITS'] = {}+ annotations.pop(filename, None)+ pending_edits.pop(filename, None)++ if failures:+ return jsonify({+ 'error': 'Failed to save: ' + '; '.join(failures),+ 'files_modified': modified,+ }), 500return jsonify({'status': 'ok', 'files_modified': modified})