from pptx import Presentation
from pptx.util import Emu,Pt,Inches
from lxml import etree
from copy import deepcopy
import os
prs=Presentation("/tmp/out3.pptx")
ns={"p":"http://schemas.openxmlformats.org/presentationml/2006/main","a":"http://schemas.openxmlformats.org/drawingml/2006/main",
"r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships"}
def fix_soy_slide(slide_idx):
 slide=prs.slides[slide_idx]
 to_remove=[]
 for shape in slide.shapes:
  n=shape.name
  if shape.shape_type==16: to_remove.append(shape)
  if n=="CuadroTexto 13": to_remove.append(shape)
  if n=="CuadroTexto 15":
   for p in shape.text_frame.paragraphs:
    for r in p.runs: r.text="Orador principal"
 for shape in to_remove:
  sp=shape._element
  sp.getparent().remove(sp)
 print(f"Fixed slide {slide_idx+1}")
fix_soy_slide(69)
fix_soy_slide(80)
prs.save("/tmp/out4.pptx")
print("Saved out4")
