app foldee
This commit is contained in:
+33
-42
@@ -1,36 +1,33 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Folie 4 – Eventstream als Quelle; Aussagen links, Lupen rechts, Strecke unten."""
|
||||
"""Folie 4 – Eventstream als Quelle; Aussagen links, Lupen rechts, Strecke unten
|
||||
(adesso-Styling)."""
|
||||
|
||||
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, MSO_ANCHOR
|
||||
from pptx.enum.shapes import MSO_SHAPE
|
||||
from adesso_style import (WHITE, INK, BLUE, TEAL, GREEN, CORAL, LIGHT, RECF, F, FC,
|
||||
paint_background, chrome)
|
||||
|
||||
INK = RGBColor(0x2A, 0x2F, 0x3A)
|
||||
NAVY = RGBColor(0x1F, 0x3A, 0x5F)
|
||||
ACCENT = RGBColor(0xC0, 0x49, 0x2F)
|
||||
TEAL = RGBColor(0x2F, 0x8F, 0x83)
|
||||
AMBER = RGBColor(0xC8, 0x8A, 0x3A)
|
||||
MUTE = RGBColor(0x8A, 0x93, 0xA0)
|
||||
GLASS = RGBColor(0xF2, 0xF5, 0xF8)
|
||||
BELT = RGBColor(0xD7, 0xDC, 0xE2)
|
||||
DARK = RGBColor(0x33, 0x39, 0x44)
|
||||
LINEC = RGBColor(0xC3, 0xC9, 0xD1)
|
||||
THIN = RGBColor(0xDD, 0xE2, 0xE8)
|
||||
STREAM = RGBColor(0x24, 0x37, 0x52)
|
||||
BG = RGBColor(0xFF, 0xFF, 0xFF)
|
||||
WHITE = RGBColor(0xFF, 0xFF, 0xFF)
|
||||
F = "Calibri"
|
||||
# Rollen-Mapping auf die adesso-Palette
|
||||
NAVY = INK # dunkle Füllungen (Lupe, Maschine)
|
||||
ACCENT = CORAL
|
||||
AMBER = GREEN
|
||||
GLASS = RECF
|
||||
BELT = RECF
|
||||
DARK = INK
|
||||
LINEC = LIGHT
|
||||
THIN = LIGHT
|
||||
STREAM = INK
|
||||
MID = RGBColor(0x34, 0x4E, 0x70)
|
||||
|
||||
prs = Presentation()
|
||||
prs.slide_width = Inches(13.333)
|
||||
prs.slide_height = Inches(7.5)
|
||||
SW, SH = prs.slide_width, prs.slide_height
|
||||
s = prs.slides.add_slide(prs.slide_layouts[6])
|
||||
bgr = s.shapes.add_shape(MSO_SHAPE.RECTANGLE, 0, 0, SW, SH)
|
||||
bgr.fill.solid(); bgr.fill.fore_color.rgb = BG; bgr.line.fill.background()
|
||||
bgr.shadow.inherit = False
|
||||
|
||||
|
||||
def shp(kind, x, y, w, h, fill=None, line=None, lw=Pt(1), rot=0):
|
||||
@@ -44,25 +41,21 @@ def shp(kind, x, y, w, h, fill=None, line=None, lw=Pt(1), rot=0):
|
||||
return sh
|
||||
|
||||
|
||||
def txt(x, y, w, h, t, size=16, color=INK, bold=False, italic=False,
|
||||
align=PP_ALIGN.LEFT, spc=None):
|
||||
def txt(x, y, w, h, t, size=16, color=WHITE, bold=False, italic=False,
|
||||
align=PP_ALIGN.LEFT, spc=None, font=F):
|
||||
tb = s.shapes.add_textbox(x, y, w, h); tf = tb.text_frame
|
||||
tf.word_wrap = True; tf.vertical_anchor = MSO_ANCHOR.MIDDLE
|
||||
tf.margin_left = tf.margin_right = tf.margin_top = tf.margin_bottom = Pt(0)
|
||||
p = tf.paragraphs[0]; p.alignment = align
|
||||
r = p.add_run(); r.text = t
|
||||
r.font.size = Pt(size); r.font.bold = bold; r.font.italic = italic
|
||||
r.font.name = F; r.font.color.rgb = color
|
||||
r.font.name = font; r.font.color.rgb = color
|
||||
if spc: r.font._rPr.set('spc', str(spc))
|
||||
return tb
|
||||
|
||||
|
||||
# ---- Kopf (ganz oben) ------------------------------------------------------
|
||||
txt(Inches(0.95), Inches(0.32), Inches(8), Inches(0.35), "MODELL",
|
||||
size=12.5, color=ACCENT, bold=True, spc=240)
|
||||
txt(Inches(0.95), Inches(0.62), Inches(11), Inches(0.85), "Zustand oder Ereignis",
|
||||
size=31, color=NAVY, bold=True)
|
||||
shp(MSO_SHAPE.RECTANGLE, Inches(0.95), Inches(1.34), Inches(0.6), Pt(4), fill=ACCENT)
|
||||
paint_background(s, SW, SH)
|
||||
chrome(s, "Zustand oder Ereignis", 5)
|
||||
|
||||
x0, x1 = Inches(1.0), Inches(12.33)
|
||||
beltw = x1 - x0
|
||||
@@ -77,25 +70,23 @@ cy = Inches(1.95)
|
||||
for i, c in enumerate(claims):
|
||||
y = cy + Inches(0.6) * i
|
||||
shp(MSO_SHAPE.RECTANGLE, Inches(0.95), y + Inches(0.1), Inches(0.14), Inches(0.14), fill=ACCENT)
|
||||
bold = (i == 0)
|
||||
txt(Inches(1.28), y, Inches(4.6), Inches(0.45), c,
|
||||
size=16.5, color=INK, bold=bold)
|
||||
txt(Inches(1.28), y, Inches(4.6), Inches(0.45), c, size=16.5, color=WHITE, bold=(i == 0))
|
||||
|
||||
# ===========================================================================
|
||||
# LUPEN (Projektionen) – nach rechts gerückt
|
||||
# LUPEN (Projektionen)
|
||||
# ===========================================================================
|
||||
def lupe(cx, label, label_w):
|
||||
cy = Inches(2.45)
|
||||
cyy = Inches(2.45)
|
||||
d = Inches(0.9)
|
||||
shp(MSO_SHAPE.OVAL, cx - d / 2, cy - d / 2, d, d, fill=WHITE, line=NAVY, lw=Pt(4))
|
||||
shp(MSO_SHAPE.OVAL, cx - d / 2 + Inches(0.13), cy - d / 2 + Inches(0.12),
|
||||
Inches(0.17), Inches(0.13), fill=RGBColor(0xED,0xF1,0xF5))
|
||||
shp(MSO_SHAPE.OVAL, cx - d / 2, cyy - d / 2, d, d, fill=WHITE, line=NAVY, lw=Pt(4))
|
||||
shp(MSO_SHAPE.OVAL, cx - d / 2 + Inches(0.13), cyy - d / 2 + Inches(0.12),
|
||||
Inches(0.17), Inches(0.13), fill=RECF)
|
||||
hw, hh = Inches(0.48), Inches(0.15)
|
||||
hcx, hcy = cx + d * 0.52, cy + d * 0.52
|
||||
hcx, hcy = cx + d * 0.52, cyy + d * 0.52
|
||||
shp(MSO_SHAPE.ROUNDED_RECTANGLE, hcx - hw / 2, hcy - hh / 2, hw, hh, fill=NAVY, rot=45)
|
||||
txt(cx - label_w / 2, cy + d / 2 + Inches(0.16), label_w, Inches(0.6),
|
||||
label, size=14, color=NAVY, bold=True, align=PP_ALIGN.CENTER)
|
||||
return cy + d / 2
|
||||
txt(cx - label_w / 2, cyy + d / 2 + Inches(0.16), label_w, Inches(0.6),
|
||||
label, size=14, color=WHITE, bold=True, align=PP_ALIGN.CENTER)
|
||||
return cyy + d / 2
|
||||
|
||||
|
||||
lupes = [
|
||||
@@ -133,7 +124,7 @@ mx, mw = Inches(5.45), Inches(2.45)
|
||||
my, mh = Inches(5.2), Inches(1.5)
|
||||
shp(MSO_SHAPE.ROUNDED_RECTANGLE, mx, my, mw, mh, fill=NAVY)
|
||||
shp(MSO_SHAPE.ROUNDED_RECTANGLE, mx + Inches(0.3), my + Inches(0.22),
|
||||
mw - Inches(0.6), Inches(0.32), fill=RGBColor(0x34,0x4E,0x70))
|
||||
mw - Inches(0.6), Inches(0.32), fill=MID)
|
||||
shp(MSO_SHAPE.OVAL, mx + Inches(0.35), my + Inches(0.74), Inches(0.15), Inches(0.15), fill=TEAL)
|
||||
shp(MSO_SHAPE.OVAL, mx + Inches(0.6), my + Inches(0.74), Inches(0.15), Inches(0.15), fill=AMBER)
|
||||
shp(MSO_SHAPE.RECTANGLE, mx - Inches(0.02), belt_top - Inches(0.02),
|
||||
@@ -165,6 +156,6 @@ for xv in pre_x + post_x:
|
||||
shp(MSO_SHAPE.OVAL, Inches(xv) - Inches(0.05), acx - Inches(0.05),
|
||||
Inches(0.1), Inches(0.1), fill=AMBER)
|
||||
|
||||
out = "/home/marcuh/claude-projects/limbach/Folie4.pptx"
|
||||
out = os.path.join(os.path.dirname(os.path.abspath(__file__)), "Folie4.pptx")
|
||||
prs.save(out)
|
||||
print("saved", out)
|
||||
|
||||
Reference in New Issue
Block a user