Slightly clean up interactive_scene_embed

This commit is contained in:
Grant Sanderson 2024-12-09 13:56:33 -06:00
parent 636fb3a45b
commit 40b5c7c1c1
2 changed files with 6 additions and 6 deletions

View file

@ -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:
"""

View file

@ -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)