From 87bbc9a8c6ea86330fb31ab0391c5bc066c63660 Mon Sep 17 00:00:00 2001 From: Federico Galatolo Date: Mon, 28 Jun 2021 20:16:46 +0200 Subject: [PATCH] Added configuration wizard --- manim_presentation/wizard.py | 51 ++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 manim_presentation/wizard.py diff --git a/manim_presentation/wizard.py b/manim_presentation/wizard.py new file mode 100644 index 0000000..d4733d5 --- /dev/null +++ b/manim_presentation/wizard.py @@ -0,0 +1,51 @@ +import cv2 +import numpy as np +import json +import os +import sys + +def prompt(question): + font_args = (cv2.FONT_HERSHEY_SIMPLEX, 0.7, 255) + display = np.zeros((130, 420), np.uint8) + + cv2.putText( + display, + "* Manim Presentation Wizard *", + (50, 33), + *font_args + ) + cv2.putText( + display, + question, + (30, 85), + *font_args + ) + + cv2.imshow("wizard", display) + return cv2.waitKeyEx(-1) + +def main(): + if(os.path.exists("./manim-presentation.json")): + print("The manim-presentation.json configuration file exists") + ans = input("Do you want to continue and overwrite it? (y/n): ") + if ans != "y": sys.exit(0) + + prompt("Press any key to continue") + PLAYPAUSE_KEY = prompt("Press the PLAY/PAUSE key") + CONTINUE_KEY = prompt("Press the CONTINUE/NEXT key") + BACK_KEY = prompt("Press the BACK key") + REWIND_KEY = prompt("Press the REWIND key") + QUIT_KEY = prompt("Press the QUIT key") + + config_file = open("./manim-presentation.json", "w") + json.dump(dict( + PLAYPAUSE_KEY=PLAYPAUSE_KEY, + CONTINUE_KEY=CONTINUE_KEY, + BACK_KEY=BACK_KEY, + REWIND_KEY=REWIND_KEY, + QUIT_KEY=QUIT_KEY + ), config_file) + config_file.close() + + + \ No newline at end of file