129 lines
3 KiB
Python
129 lines
3 KiB
Python
import threading
|
||
import time
|
||
import os
|
||
import signal
|
||
|
||
import pyprctl
|
||
|
||
|
||
slides = []
|
||
current_slide = 0
|
||
|
||
slides.append(("static", """Herzlich
|
||
Willkommen,
|
||
zur 26. Auflage
|
||
der Tech Talks
|
||
des Kassel Code
|
||
Meetups in der
|
||
Caricatura Bar"""))
|
||
|
||
slides.append(("static", """
|
||
Die Agenda fuer
|
||
Heute:
|
||
|
||
19:15 - 19:30
|
||
Begruessung
|
||
|
||
19:30 - 20:00
|
||
Talk No 1
|
||
Goodbye
|
||
Hydration –
|
||
Resumable Pages
|
||
mit Qwik
|
||
Entdecke die
|
||
Macht der
|
||
Webcomponents
|
||
- Sven
|
||
|
||
20:00 - 20:30
|
||
Talk No 2
|
||
Capture The Flag
|
||
- Marlon
|
||
|
||
20:30 - 21:00
|
||
Talk No 3
|
||
Reverse
|
||
Engineering
|
||
old
|
||
Datastructures
|
||
From System
|
||
Programming
|
||
To The Web
|
||
and back!
|
||
- Enno
|
||
|
||
21:00 - 21:30
|
||
Pizza
|
||
|
||
21:30 - 22:00
|
||
Whats Next
|
||
"""))
|
||
|
||
slides.append(("walking", """ ______ ____ _ __ ___
|
||
/_ __/___ _/ / /__ / | / /___ < /
|
||
/ / / __ `/ / //_/ / |/ / __ \ / /
|
||
/ / / /_/ / / ,< / /| / /_/ / / /
|
||
/_/ \__,_/_/_/|_| /_/ |_/\____(_) /_/ """))
|
||
|
||
slides.append(("walking", """ ______ ____ _ __ ___
|
||
/_ __/___ _/ / /__ / | / /___ |__ |
|
||
/ / / __ `/ / //_/ / |/ / __ \ __/ /
|
||
/ / / /_/ / / ,< / /| / /_/ / / __/
|
||
/_/ \__,_/_/_/|_| /_/ |_/\____(_) /____/ """))
|
||
|
||
slides.append(("walking", """ ______ ____ _ __ _____
|
||
/_ __/___ _/ / /__ / | / /___ |__ /
|
||
/ / / __ `/ / //_/ / |/ / __ \ /_ <
|
||
/ / / /_/ / / ,< / /| / /_/ / ___/ /
|
||
/_/ \__,_/_/_/|_| /_/ |_/\____(_) /____/ """))
|
||
|
||
slides.append(("walking", """ ____ ______________ ___ ______
|
||
/ __ \/ _/__ /__ / / | / / / /
|
||
/ /_/ // / / / / / / /| | / / / /
|
||
/ ____// / / /__/ /__/ ___ |/_/_/_/
|
||
/_/ /___/ /____/____/_/ |_(_|_|_) """))
|
||
|
||
|
||
def create_named_thread(name: str, slide: int) -> None:
|
||
pyprctl.set_name(name)
|
||
while current_slide == slide:
|
||
time.sleep(1)
|
||
|
||
|
||
def create_walking_thread(name: str, slide: int) -> None:
|
||
nth = 0
|
||
while current_slide == slide:
|
||
pyprctl.set_name(name[nth % len(name):nth + 15])
|
||
nth = nth + 1
|
||
time.sleep(0.5)
|
||
|
||
|
||
def render_slide() -> None:
|
||
if slides[current_slide][0] == "static":
|
||
for line in slides[current_slide][1].split('\n'):
|
||
threading.Thread(target=create_named_thread, args=(line, current_slide)).start()
|
||
if slides[current_slide][0] == "walking":
|
||
for line in slides[current_slide][1].split('\n'):
|
||
threading.Thread(target=create_walking_thread, args=(line, current_slide)).start()
|
||
|
||
|
||
if __name__ == "__main__":
|
||
render_slide()
|
||
print(f"run: 'top -p {os.getpid()} -H -d 0.5' to view the presentation")
|
||
while True:
|
||
print(slides[current_slide][1])
|
||
nav = input("j -> Next, k -> previous, q -> quit : ")
|
||
|
||
if nav =='j':
|
||
current_slide += 1
|
||
if nav == 'k':
|
||
current_slide -= 1
|
||
if nav == 'q':
|
||
os.kill(os.getpid(), signal.SIGTERM)
|
||
|
||
if current_slide < 0:
|
||
current_slide = 0
|
||
if current_slide > len(slides) - 1:
|
||
current_slide = len(slides) - 1
|
||
render_slide()
|
||
|