HEX
Server: LiteSpeed
System: Linux houston.panomity.com 6.8.0-100-generic #100-Ubuntu SMP PREEMPT_DYNAMIC Tue Jan 13 16:40:06 UTC 2026 x86_64
User: nudepix (1011)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //proc/thread-self/root/workspace/pptx_redesign.py
#!/usr/bin/env python3
"""PPTX-Redesign im Montessori-Stil"""

from pptx import Presentation
from pptx.util import Inches, Pt, Emu
from pptx.dml.color import RGBColor
from pptx.enum.text import PP_ALIGN, MSO_ANCHOR
from pptx.enum.shapes import MSO_SHAPE
import os

# Farbpalette
COLORS = {
    'creme': RGBColor(250, 247, 240),
    'sand': RGBColor(242, 235, 220),
    'salbei': RGBColor(195, 210, 195),
    'blau_staubig': RGBColor(176, 188, 200),
    'terrakotta': RGBColor(196, 164, 145),
    'dunkel_grau': RGBColor(70, 70, 70),
    'mittel_grau': RGBColor(100, 100, 100),
}

def redesign_pptx(input_path, output_path, title_slide_bg='sand', content_bg='creme'):
    """Redesign einer Präsentation"""
    print(f"Verarbeite: {os.path.basename(input_path)}")
    
    prs_orig = Presentation(input_path)
    prs = Presentation()
    
    # Foliengröße auf 16:9 setzen
    prs.slide_width = Inches(13.333)
    prs.slide_height = Inches(7.5)
    
    for i, slide_orig in enumerate(prs_orig.slides):
        # Alle Texte extrahieren
        texts = []
        for shape in slide_orig.shapes:
            if hasattr(shape, "text") and shape.text.strip():
                texts.append(shape.text.strip())
        
        # Leere Folie hinzufügen
        blank_layout = prs.slide_layouts[6]  # Blank layout
        slide = prs.slides.add_slide(blank_layout)
        
        # Hintergrundfarbe
        bg_color = title_slide_bg if i == 0 else content_bg
        background = slide.background
        fill = background.fill
        fill.solid()
        fill.fore_color.rgb = COLORS[bg_color]
        
        # Titel-Folie
        if i == 0:
            create_title_slide(slide, texts)
        # Inhaltsfolien
        else:
            create_content_slide(slide, texts, i)
    
    prs.save(output_path)
    print(f"  ✓ Gespeichert: {os.path.basename(output_path)}")

def create_title_slide(slide, texts):
    """Erstellt Titelfolie"""
    # Haupttitel
    title = texts[0] if texts else "Präsentation"
    subtitle = texts[1] if len(texts) > 1 else ""
    
    # Titel-Box
    left = Inches(0.5)
    top = Inches(2.5)
    width = Inches(12.333)
    height = Inches(1.5)
    
    title_box = slide.shapes.add_textbox(left, top, width, height)
    tf = title_box.text_frame
    p = tf.paragraphs[0]
    p.text = title
    p.font.size = Pt(44)
    p.font.bold = True
    p.font.color.rgb = COLORS['dunkel_grau']
    p.alignment = PP_ALIGN.CENTER
    
    # Untertitel
    if subtitle:
        top = Inches(4.2)
        height = Inches(1)
        subtitle_box = slide.shapes.add_textbox(left, top, width, height)
        tf = subtitle_box.text_frame
        p = tf.paragraphs[0]
        p.text = subtitle
        p.font.size = Pt(24)
        p.font.color.rgb = COLORS['mittel_grau']
        p.alignment = PP_ALIGN.CENTER
    
    # Akzentlinie unten
    line = slide.shapes.add_shape(
        MSO_SHAPE.RECTANGLE,
        Inches(5), Inches(5.5), Inches(3.333), Pt(4)
    )
    line.fill.solid()
    line.fill.fore_color.rgb = COLORS['terrakotta']
    line.line.fill.background()

def create_content_slide(slide, texts, slide_num):
    """Erstellt Inhaltsfolie"""
    if not texts:
        return
    
    # Überschrift
    title = texts[0]
    content = "\n".join(texts[1:]) if len(texts) > 1 else ""
    
    # Titel oben
    left = Inches(0.5)
    top = Inches(0.3)
    width = Inches(12.333)
    height = Inches(0.8)
    
    title_box = slide.shapes.add_textbox(left, top, width, height)
    tf = title_box.text_frame
    p = tf.paragraphs[0]
    p.text = title
    p.font.size = Pt(32)
    p.font.bold = True
    p.font.color.rgb = COLORS['dunkel_grau']
    
    # Trennlinie
    line = slide.shapes.add_shape(
        MSO_SHAPE.RECTANGLE,
        Inches(0.5), Inches(1.2), Inches(3), Pt(3)
    )
    line.fill.solid()
    line.fill.fore_color.rgb = COLORS['salbei']
    line.line.fill.background()
    
    # Inhaltsbereich
    if content:
        left = Inches(0.5)
        top = Inches(1.6)
        width = Inches(12.333)
        height = Inches(5.5)
        
        # Box mit Hintergrund
        shape = slide.shapes.add_shape(
            MSO_SHAPE.ROUNDED_RECTANGLE,
            left, top, width, height
        )
        shape.fill.solid()
        shape.fill.fore_color.rgb = COLORS['sand']
        shape.line.color.rgb = COLORS['salbei']
        shape.line.width = Pt(1)
        
        # Text in der Box
        tf = shape.text_frame
        tf.word_wrap = True
        tf.paragraphs[0].text = content
        tf.paragraphs[0].font.size = Pt(18)
        tf.paragraphs[0].font.color.rgb = COLORS['dunkel_grau']
        tf.paragraphs[0].space_before = Pt(12)

def main():
    base = "/mnt/onedrive_write/FOS_Deutsch_Lehrplanvergleich_2026"
    
    presentations = [
        ("02_Vorklasse/Präsentationen", "Einführung_Vorklasse_Deutsch_2026.pptx"),
        ("02_Vorklasse/Präsentationen", "Arbeitsphasen_Vorklasse_KI-Schreiben.pptx"),
        ("03_Jahrgang_11/Präsentationen", "Einführung_Jahrgang11_Deutsch_2026.pptx"),
        ("03_Jahrgang_11/Präsentationen", "Arbeitsphasen_Jahrgang11_Social-Media.pptx"),
        ("04_Jahrgang_12/Präsentationen", "Einführung_Medienkompetenz_JG12.pptx"),
        ("04_Jahrgang_12/Präsentationen", "Arbeitsphasen_Medienkompetenz_JG12.pptx"),
    ]
    
    print("=" * 60)
    print("REDESIGN: PPTX-Präsentationen → Montessori-Stil")
    print("=" * 60)
    
    done = []
    errors = []
    
    for folder, filename in presentations:
        input_path = os.path.join(base, folder, filename)
        
        if not os.path.exists(input_path):
            print(f"  ⚠ Nicht gefunden: {filename}")
            errors.append(filename)
            continue
        
        base_name = filename.replace('.pptx', '')
        output_path = os.path.join(base, folder, f"{base_name}_Montessori.pptx")
        
        try:
            redesign_pptx(input_path, output_path)
            done.append({'original': filename, 'neu': f"{base_name}_Montessori.pptx"})
        except Exception as e:
            print(f"  ✗ Fehler: {e}")
            import traceback
            traceback.print_exc()
            errors.append(filename)
    
    print("\n" + "=" * 60)
    print(f"Redesigniert: {len(done)} Präsentationen")
    print(f"Fehler: {len(errors)}")
    
    return done, errors

if __name__ == '__main__':
    done, errors = main()