Projektarbeit-MYP/backend/app/create_presentation.py
Till Tomczak 736f2fae4c fix: Update documentation in SUMMARY.md for kiosk mode enhancements
- Revised the Kiosk-Mode section in SUMMARY.md to include recent changes related to SSL support and improved user experience.
- Clarified instructions for setting up kiosk mode with the new SSL configuration.
- Ensured consistency in formatting and alignment for better readability.
2025-05-25 21:43:14 +02:00

344 lines
9.5 KiB
Python

import os
from pptx import Presentation
from pptx.util import Inches, Pt
from pptx.dml.color import RGBColor
from pptx.enum.text import PP_ALIGN
# Stile und Konstanten
TITLE_FONT = 'Helvetica Neue'
BODY_FONT = 'Helvetica Neue'
PRIMARY_COLOR = RGBColor(0, 122, 255) # Apple Blau
DARK_TEXT = RGBColor(50, 50, 50)
LIGHT_TEXT = RGBColor(240, 240, 240)
BACKGROUND_COLOR = RGBColor(250, 250, 250)
SLIDE_WIDTH = Inches(13.333)
SLIDE_HEIGHT = Inches(7.5)
# Ausgabepfad
output_dir = os.path.dirname(os.path.abspath(__file__))
output_path = os.path.join(output_dir, 'MYP_Backend_Schulung.pptx')
# Neue Präsentation erstellen
prs = Presentation()
# Foliengröße auf 16:9 setzen
prs.slide_width = SLIDE_WIDTH
prs.slide_height = SLIDE_HEIGHT
# Hilfsfunktion für einheitliche Formatierung
def apply_text_style(paragraph, font_size, bold=False, color=DARK_TEXT, alignment=PP_ALIGN.LEFT):
paragraph.alignment = alignment
run = paragraph.runs[0]
run.font.name = BODY_FONT
run.font.size = Pt(font_size)
run.font.bold = bold
run.font.color.rgb = color
# Titelfolie
slide_layout = prs.slide_layouts[0] # Titelfolie
slide = prs.slides.add_slide(slide_layout)
# Hintergrund anpassen (einfacher weißer Hintergrund für Apple-ähnlichen Look)
background = slide.background
fill = background.fill
fill.solid()
fill.fore_color.rgb = BACKGROUND_COLOR
# Titel hinzufügen
title_shape = slide.shapes.title
title_shape.text = "MYP Platform"
title_paragraph = title_shape.text_frame.paragraphs[0]
apply_text_style(title_paragraph, 54, bold=True, color=PRIMARY_COLOR, alignment=PP_ALIGN.CENTER)
# Untertitel hinzufügen
subtitle_shape = slide.placeholders[1]
subtitle_shape.text = "3D-Drucker Reservierungssystem\nBackend-Schulung"
subtitle_paragraph = subtitle_shape.text_frame.paragraphs[0]
apply_text_style(subtitle_paragraph, 32, color=DARK_TEXT, alignment=PP_ALIGN.CENTER)
# Folie 2: Überblick
slide = prs.slides.add_slide(prs.slide_layouts[1])
title = slide.shapes.title
title.text = "Systemüberblick"
title_paragraph = title.text_frame.paragraphs[0]
apply_text_style(title_paragraph, 44, bold=True, color=PRIMARY_COLOR, alignment=PP_ALIGN.LEFT)
# Inhalt
content = slide.placeholders[1]
tf = content.text_frame
p = tf.paragraphs[0]
p.text = "• Reservierungssystem für 3D-Drucker"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = "• Automatische Steuerung von Smart Plugs"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = "• Echtzeit-Überwachung von Druckaufträgen"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = "• Administrationsfunktionen"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = "• Statistik und Analyse"
apply_text_style(p, 28)
# Folie 3: Technologie-Stack
slide = prs.slides.add_slide(prs.slide_layouts[1])
title = slide.shapes.title
title.text = "Technologie-Stack"
title_paragraph = title.text_frame.paragraphs[0]
apply_text_style(title_paragraph, 44, bold=True, color=PRIMARY_COLOR, alignment=PP_ALIGN.LEFT)
# Inhalt
content = slide.placeholders[1]
tf = content.text_frame
p = tf.paragraphs[0]
p.text = "• Backend: Python 3.11 mit Flask"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = "• Frontend: HTML/CSS/JavaScript mit Tailwind CSS"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = "• Datenbank: SQLite mit SQLAlchemy ORM"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = "• Authentifizierung: Flask-Login"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = "• Hardware-Integration: PyP110 für Tapo Smart Plug Steuerung"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = "• Automatisierung: Integrierter Job-Scheduler"
apply_text_style(p, 28)
# Folie 4: Architektur
slide = prs.slides.add_slide(prs.slide_layouts[1])
title = slide.shapes.title
title.text = "Backend-Architektur"
title_paragraph = title.text_frame.paragraphs[0]
apply_text_style(title_paragraph, 44, bold=True, color=PRIMARY_COLOR, alignment=PP_ALIGN.LEFT)
# Inhalt
content = slide.placeholders[1]
tf = content.text_frame
p = tf.paragraphs[0]
p.text = "• Flask-App: Zentrale Anwendungslogik"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = "• Blueprints: Modulare Strukturierung (auth, user, kiosk)"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = "• Models: SQLAlchemy ORM für Datenbankkommunikation"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = "• Utils: Job-Scheduler, Logging, Template-Helpers"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = "• API: RESTful-Endpunkte für Frontend-Kommunikation"
apply_text_style(p, 28)
# Folie 5: Datenmodell
slide = prs.slides.add_slide(prs.slide_layouts[1])
title = slide.shapes.title
title.text = "Datenmodell"
title_paragraph = title.text_frame.paragraphs[0]
apply_text_style(title_paragraph, 44, bold=True, color=PRIMARY_COLOR, alignment=PP_ALIGN.LEFT)
# Inhalt
content = slide.placeholders[1]
tf = content.text_frame
p = tf.paragraphs[0]
p.text = "• User: Benutzer mit Rollen und Authentifizierung"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = "• Printer: 3D-Drucker mit Smart-Plug-Konfigurationen"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = "• Job: Druckaufträge mit Status und Zeitplanung"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = "• Stats: Systemstatistiken und Metriken"
apply_text_style(p, 28)
# Folie 6: API-Endpunkte
slide = prs.slides.add_slide(prs.slide_layouts[1])
title = slide.shapes.title
title.text = "API-Endpunkte"
title_paragraph = title.text_frame.paragraphs[0]
apply_text_style(title_paragraph, 44, bold=True, color=PRIMARY_COLOR, alignment=PP_ALIGN.LEFT)
# Inhalt
content = slide.placeholders[1]
tf = content.text_frame
p = tf.paragraphs[0]
p.text = "• /api/jobs: Druckaufträge verwalten"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = "• /api/printers: Drucker verwalten"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = "• /api/users: Benutzer verwalten"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = "• /api/stats: Statistiken abrufen"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = "• /api/scheduler: Scheduler steuern"
apply_text_style(p, 28)
# Folie 7: Scheduler
slide = prs.slides.add_slide(prs.slide_layouts[1])
title = slide.shapes.title
title.text = "Job-Scheduler"
title_paragraph = title.text_frame.paragraphs[0]
apply_text_style(title_paragraph, 44, bold=True, color=PRIMARY_COLOR, alignment=PP_ALIGN.LEFT)
# Inhalt
content = slide.placeholders[1]
tf = content.text_frame
p = tf.paragraphs[0]
p.text = "• Automatische Steuerung der Drucker"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = "• Einschalten bei Auftragsstart"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = "• Ausschalten bei Auftragsende"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = "• Statusüberwachung und -aktualisierung"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = "• Sammeln von Statistiken"
apply_text_style(p, 28)
# Folie 8: Logging
slide = prs.slides.add_slide(prs.slide_layouts[1])
title = slide.shapes.title
title.text = "Logging-System"
title_paragraph = title.text_frame.paragraphs[0]
apply_text_style(title_paragraph, 44, bold=True, color=PRIMARY_COLOR, alignment=PP_ALIGN.LEFT)
# Inhalt
content = slide.placeholders[1]
tf = content.text_frame
p = tf.paragraphs[0]
p.text = "• Separate Logs für verschiedene Bereiche:"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = " - App-Logs: Allgemeine Anwendungslogs"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = " - Auth-Logs: Authentifizierungsereignisse"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = " - Job-Logs: Druckauftragsoperationen"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = " - Printer-Logs: Druckerstatusänderungen"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = " - Scheduler-Logs: Automatisierungsaktionen"
apply_text_style(p, 28)
# Folie 9: Sicherheit
slide = prs.slides.add_slide(prs.slide_layouts[1])
title = slide.shapes.title
title.text = "Sicherheitskonzept"
title_paragraph = title.text_frame.paragraphs[0]
apply_text_style(title_paragraph, 44, bold=True, color=PRIMARY_COLOR, alignment=PP_ALIGN.LEFT)
# Inhalt
content = slide.placeholders[1]
tf = content.text_frame
p = tf.paragraphs[0]
p.text = "• Benutzerauthentifizierung mit bcrypt"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = "• Rollenbasierte Zugriffskontrolle"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = "• CSRF-Schutz bei Formularen"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = "• Besitzer-Check für Druckaufträge"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = "• Sichere HTTP-Header"
apply_text_style(p, 28)
# Folie 10: Zusammenfassung
slide = prs.slides.add_slide(prs.slide_layouts[1])
title = slide.shapes.title
title.text = "Zusammenfassung"
title_paragraph = title.text_frame.paragraphs[0]
apply_text_style(title_paragraph, 44, bold=True, color=PRIMARY_COLOR, alignment=PP_ALIGN.LEFT)
# Inhalt
content = slide.placeholders[1]
tf = content.text_frame
p = tf.paragraphs[0]
p.text = "• Vollständige Lösung für 3D-Drucker-Management"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = "• Modulare Architektur für einfache Erweiterbarkeit"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = "• Robuste Sicherheitskonzepte"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = "• Umfassendes Logging und Überwachung"
apply_text_style(p, 28)
p = tf.add_paragraph()
p.text = "• Automatisierung von Routineaufgaben"
apply_text_style(p, 28)
# Präsentation speichern
prs.save(output_path)
print(f"Präsentation wurde erstellt: {output_path}")