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(pptx_intake): report grouped shapes in slide space by applying every enclosing grpSp transform
hugohe39e0c24689116
diff --git a/skills/ppt-master/scripts/pptx_ooxml/analyzer.py b/skills/ppt-master/scripts/pptx_ooxml/analyzer.pyindex 578bad49..6c0d98a7 100644--- a/skills/ppt-master/scripts/pptx_ooxml/analyzer.py+++ b/skills/ppt-master/scripts/pptx_ooxml/analyzer.py@@ -258,7 +258,7 @@ def analyze_pptx(pptx_path: Path) -> dict[str, Any]:shape_id, shape_name = _shape_identity(container, order)paragraphs = _paragraph_texts(container)text = "\n".join(paragraphs)- geometry = _container_geometry(container)+ geometry = _container_geometry(container, slide_root)role = _slot_role({"text": text,diff --git a/skills/ppt-master/scripts/pptx_ooxml/diagram_read.py b/skills/ppt-master/scripts/pptx_ooxml/diagram_read.pyindex 878763f0..3c877107 100644--- a/skills/ppt-master/scripts/pptx_ooxml/diagram_read.py+++ b/skills/ppt-master/scripts/pptx_ooxml/diagram_read.py@@ -387,6 +387,7 @@ def _read_diagram_container(zf: zipfile.ZipFile,container: ET.Element,*,+ slide_root: ET.Element,slide_part: str,slide_index: int,order: int,@@ -431,7 +432,7 @@ def _read_diagram_container("kind": "smartart","shape_id": shape_id,"shape_name": shape_name,- "geometry": _container_geometry(container),+ "geometry": _container_geometry(container, slide_root),"layout": _layout_info(layout_root, data_root),"root_ids": [node["id"] for node in nodes if node["parent_id"] is None],"nodes": nodes,@@ -452,6 +453,7 @@ def _read_diagram_container(def _failed_diagram(container: ET.Element,*,+ slide_root: ET.Element,slide_index: int,order: int,error: Exception,@@ -463,7 +465,7 @@ def _failed_diagram("kind": "smartart","shape_id": shape_id,"shape_name": shape_name,- "geometry": _container_geometry(container),+ "geometry": _container_geometry(container, slide_root),"layout": {"name": None, "unique_id": None, "categories": []},"root_ids": [],"nodes": [],@@ -502,6 +504,7 @@ def read_smartart_diagrams(diagram = _read_diagram_container(zf,container,+ slide_root=slide_root,slide_part=slide_part,slide_index=slide_index,order=order,@@ -512,6 +515,7 @@ def read_smartart_diagrams(except (OSError, RuntimeError, zipfile.BadZipFile, ET.ParseError, KeyError, ValueError) as exc:diagram = _failed_diagram(container,+ slide_root=slide_root,slide_index=slide_index,order=order,error=exc,diff --git a/skills/ppt-master/scripts/pptx_ooxml/ooxml.py b/skills/ppt-master/scripts/pptx_ooxml/ooxml.pyindex f26d2df9..60790f25 100644--- a/skills/ppt-master/scripts/pptx_ooxml/ooxml.py+++ b/skills/ppt-master/scripts/pptx_ooxml/ooxml.py@@ -182,7 +182,30 @@ def _paragraph_texts(container: ET.Element) -> list[str]:return [text] if text else []-def _container_geometry(container: ET.Element) -> dict[str, int | None]:+def _group_chain(container: ET.Element, slide_root: ET.Element) -> list[ET.Element]:+ """Return the ``p:grpSp`` ancestors of ``container``, innermost first."""+ parents = {child: parent for parent in slide_root.iter() for child in parent}+ chain: list[ET.Element] = []+ node = parents.get(container)+ group_tag = f"{{{NS['p']}}}grpSp"+ while node is not None:+ if node.tag == group_tag:+ chain.append(node)+ node = parents.get(node)+ return chain+++def _container_geometry(+ container: ET.Element,+ slide_root: ET.Element | None = None,+) -> dict[str, int | None]:+ """Return the container's slide-space box in px.++ A shape inside ``p:grpSp`` stores its ``a:xfrm`` in the group's child+ space; with ``slide_root`` every enclosing group's ``off/ext`` versus+ ``chOff/chExt`` mapping is applied so nested siblings do not all report+ the same local corner.+ """xfrm = container.find("p:spPr/a:xfrm", NS)if xfrm is None:xfrm = container.find("p:xfrm", NS)@@ -192,12 +215,42 @@ def _container_geometry(container: ET.Element) -> dict[str, int | None]:return {"x": None, "y": None, "width": None, "height": None}off = xfrm.find("a:off", NS)ext = xfrm.find("a:ext", NS)- return {- "x": _emu_to_px(off.attrib.get("x")) if off is not None else None,- "y": _emu_to_px(off.attrib.get("y")) if off is not None else None,- "width": _emu_to_px(ext.attrib.get("cx")) if ext is not None else None,- "height": _emu_to_px(ext.attrib.get("cy")) if ext is not None else None,- }+ try:+ x = float(off.attrib["x"]) if off is not None else None+ y = float(off.attrib["y"]) if off is not None else None+ width = float(ext.attrib["cx"]) if ext is not None else None+ height = float(ext.attrib["cy"]) if ext is not None else None+ except (KeyError, ValueError):+ return {"x": None, "y": None, "width": None, "height": None}+ if slide_root is not None:+ for group in _group_chain(container, slide_root):+ group_xfrm = group.find("p:grpSpPr/a:xfrm", NS)+ if group_xfrm is None:+ continue+ parts = [group_xfrm.find(name, NS) for name in ("a:off", "a:ext", "a:chOff", "a:chExt")]+ if any(part is None for part in parts):+ continue+ g_off, g_ext, ch_off, ch_ext = parts+ try:+ ch_cx = float(ch_ext.attrib["cx"])+ ch_cy = float(ch_ext.attrib["cy"])+ scale_x = float(g_ext.attrib["cx"]) / ch_cx if ch_cx else 1.0+ scale_y = float(g_ext.attrib["cy"]) / ch_cy if ch_cy else 1.0+ if x is not None:+ x = float(g_off.attrib["x"]) + (x - float(ch_off.attrib["x"])) * scale_x+ if y is not None:+ y = float(g_off.attrib["y"]) + (y - float(ch_off.attrib["y"])) * scale_y+ except (KeyError, ValueError):+ continue+ if width is not None:+ width *= scale_x+ if height is not None:+ height *= scale_y++ def _px(value: float | None) -> int | None:+ return None if value is None else round(value / EMU_PER_INCH * PX_PER_INCH)++ return {"x": _px(x), "y": _px(y), "width": _px(width), "height": _px(height)}def _text_containers(slide_root: ET.Element) -> list[ET.Element]: