#!/usr/bin/env python3 """Build a presentation to test the classroom's library with. Representative test material, NOT the pastor's own files. The shape is copied from the real Bible study decks and nothing else about them is: slide 1 a generic opening, the same on every session slide 2 the one that names the session slide 3+ the session's content That first pair is the whole reason Quick Look lets a teacher choose which slide becomes the library thumbnail. A library that assumed slide one would show every session under the same picture. Writes a flat ODF presentation, which LibreOffice then converts to whatever the test needs: tools/lab/make-presentation --slides 12 --session 7 out.fodp soffice --headless --convert-to pptx out.fodp soffice --headless --convert-to pdf out.fodp """ import argparse import html import sys HEADER = """ """ FOOTER = """ """ PAGE = """ {title} {body} """ # Deliberately ordinary words. Nothing here is anybody's lesson. POINTS = ( "Read the passage aloud together", "What does this tell us about God?", "Where do you see this in your own week?", "One thing to carry into Sunday", ) def paragraphs(lines): return "".join( f"{html.escape(line)}" for line in lines ) def build(slides, session): pages = [] # Slide 1 — the generic opening every session shares. pages.append(PAGE.format( name="page1", title=paragraphs(["Wednesday Bible Study"]), body=paragraphs(["River of Glory", "Welcome"]), )) # Slide 2 — the one a teacher has to be able to pick as the thumbnail. pages.append(PAGE.format( name="page2", title=paragraphs([f"Session {session}"]), body=paragraphs([f"Session {session} of the autumn study", "Tonight's passage and questions"]), )) for number in range(3, slides + 1): pages.append(PAGE.format( name=f"page{number}", title=paragraphs([f"Point {number - 2}"]), body=paragraphs([ POINTS[(number - 3) % len(POINTS)], f"(slide {number} of {slides})", ]), )) return HEADER + "".join(pages) + FOOTER def main(): parser = argparse.ArgumentParser( description="Build representative Bible study test material.") parser.add_argument("output", help="where to write the .fodp") parser.add_argument("--slides", type=int, default=10, help="how many slides in total (minimum 2)") parser.add_argument("--session", type=int, default=7, help="the session number slide 2 announces") arguments = parser.parse_args() if arguments.slides < 2: print("a test deck needs at least the opening and the session slide", file=sys.stderr) return 2 with open(arguments.output, "w", encoding="utf-8") as handle: handle.write(build(arguments.slides, arguments.session)) print(f"{arguments.output}: {arguments.slides} slides, session " f"{arguments.session}") return 0 if __name__ == "__main__": sys.exit(main())