mirror of
https://github.com/3b1b/manim.git
synced 2025-08-21 05:44:04 +00:00
Include *args, **kwargs in embed shell event pre_cell and post_cell functions
This commit is contained in:
parent
4feb831a11
commit
a07ccf4aca
1 changed files with 5 additions and 4 deletions
|
@ -213,7 +213,8 @@ class Scene(object):
|
||||||
show_animation_progress: bool = False,
|
show_animation_progress: bool = False,
|
||||||
) -> None:
|
) -> None:
|
||||||
if not self.preview:
|
if not self.preview:
|
||||||
return # Embed is only relevant with a preview
|
# Embed is only relevant with a preview
|
||||||
|
return
|
||||||
self.stop_skipping()
|
self.stop_skipping()
|
||||||
self.update_frame()
|
self.update_frame()
|
||||||
self.save_state()
|
self.save_state()
|
||||||
|
@ -260,11 +261,11 @@ class Scene(object):
|
||||||
# namespace, since this is just a shell session anyway.
|
# namespace, since this is just a shell session anyway.
|
||||||
shell.events.register(
|
shell.events.register(
|
||||||
"pre_run_cell",
|
"pre_run_cell",
|
||||||
lambda: shell.user_global_ns.update(shell.user_ns)
|
lambda *args, **kwargs: shell.user_global_ns.update(shell.user_ns)
|
||||||
)
|
)
|
||||||
|
|
||||||
# Operation to run after each ipython command
|
# Operation to run after each ipython command
|
||||||
def post_cell_func():
|
def post_cell_func(*args, **kwargs):
|
||||||
if not self.is_window_closing():
|
if not self.is_window_closing():
|
||||||
self.update_frame(dt=0, ignore_skipping=True)
|
self.update_frame(dt=0, ignore_skipping=True)
|
||||||
self.save_state()
|
self.save_state()
|
||||||
|
@ -273,7 +274,7 @@ class Scene(object):
|
||||||
|
|
||||||
# Flash border, and potentially play sound, on exceptions
|
# Flash border, and potentially play sound, on exceptions
|
||||||
def custom_exc(shell, etype, evalue, tb, tb_offset=None):
|
def custom_exc(shell, etype, evalue, tb, tb_offset=None):
|
||||||
# still show the error don't just swallow it
|
# Show the error don't just swallow it
|
||||||
shell.showtraceback((etype, evalue, tb), tb_offset=tb_offset)
|
shell.showtraceback((etype, evalue, tb), tb_offset=tb_offset)
|
||||||
if self.embed_error_sound:
|
if self.embed_error_sound:
|
||||||
os.system("printf '\a'")
|
os.system("printf '\a'")
|
||||||
|
|
Loading…
Add table
Reference in a new issue