From 40b5c7c1c126f33e346514fd6616b8b24cb05c10 Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Mon, 9 Dec 2024 13:56:33 -0600 Subject: [PATCH] Slightly clean up interactive_scene_embed --- manimlib/scene/scene.py | 7 ++++++- manimlib/scene/scene_embed.py | 5 ----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/manimlib/scene/scene.py b/manimlib/scene/scene.py index df1a4a38..775772d6 100644 --- a/manimlib/scene/scene.py +++ b/manimlib/scene/scene.py @@ -204,6 +204,9 @@ class Scene(object): close_scene_on_exit: bool = True, show_animation_progress: bool = False, ) -> None: + if not self.window: + # Embed is only relevant for interactive development with a Window + return self.show_animation_progress = show_animation_progress interactive_scene_embed(self) @@ -887,7 +890,9 @@ class Scene(object): this means. """ reload_manager.set_new_start_at_line(start_at_line) - self.shell.run_line_magic("exit_raise", "") + shell = get_ipython() + if shell: + shell.run_line_magic("exit_raise", "") def focus(self) -> None: """ diff --git a/manimlib/scene/scene_embed.py b/manimlib/scene/scene_embed.py index 43f4be5f..60273011 100644 --- a/manimlib/scene/scene_embed.py +++ b/manimlib/scene/scene_embed.py @@ -13,15 +13,10 @@ from manimlib.module_loader import ModuleLoader def interactive_scene_embed(scene): - if not scene.window: - # Embed is only relevant for interactive development with a Window - return scene.stop_skipping() scene.update_frame(force_draw=True) - scene.save_state() shell = get_ipython_shell_for_embedded_scene(scene) - scene.shell = shell # It would be better not to add attributes to scene here enable_gui(shell, scene) ensure_frame_update_post_cell(shell, scene) ensure_flash_on_error(shell, scene)