From 152050612e1b80849d1b2b6e99884cdc3eaab848 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Eertmans?= Date: Fri, 9 Dec 2022 11:08:26 +0100 Subject: [PATCH 1/2] feat(cli): prompt scenes from gui --- manim_slides/present.py | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/manim_slides/present.py b/manim_slides/present.py index e21aa807..9d4491be 100644 --- a/manim_slides/present.py +++ b/manim_slides/present.py @@ -11,7 +11,7 @@ from pydantic import ValidationError from PySide6.QtCore import Qt, QThread, Signal, Slot from PySide6.QtGui import QCloseEvent, QIcon, QImage, QKeyEvent, QPixmap, QResizeEvent -from PySide6.QtWidgets import QApplication, QGridLayout, QLabel, QWidget +from PySide6.QtWidgets import QApplication, QFileDialog, QGridLayout, QLabel, QWidget from tqdm import tqdm from .commons import config_path_option, verbosity_option @@ -817,6 +817,22 @@ def present( Use `manim-slide list-scenes` to list all available scenes in a given folder. """ + app = QApplication(sys.argv) + app.setApplicationName("Manim Slides") + dialog = QFileDialog() + dialog.setDirectory(FOLDER_PATH if os.path.exists(FOLDER_PATH) else "") + dialog.setFileMode(QFileDialog.ExistingFiles) + dialog.setNameFilters(["JSON (*.json)", "* (*.*)"]) + if dialog.exec(): + filenames = dialog.selectedFiles() + print(filenames) + + # TODO: + # - get files in selected order + # - kill dialog + # - add cli option (+ envvar) to prompt gui instead of cli + # - use scenes selected from gui + if skip_all: exit_after_last_slide = True @@ -841,8 +857,6 @@ def present( "Recording only support '.avi' extension. For other video formats, please convert the resulting '.avi' file afterwards." ) - app = QApplication(sys.argv) - app.setApplicationName("Manim Slides") a = App( presentations, config=config, From e62a3b05eda801dd14bae1e8017c315ee39ed968 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 9 Dec 2022 10:09:38 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- manim_slides/present.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manim_slides/present.py b/manim_slides/present.py index 9d4491be..e1fbfb0a 100644 --- a/manim_slides/present.py +++ b/manim_slides/present.py @@ -826,7 +826,7 @@ def present( if dialog.exec(): filenames = dialog.selectedFiles() print(filenames) - + # TODO: # - get files in selected order # - kill dialog