Skip to content

Commit

Permalink
Have presenter mode hold before first play call
Browse files Browse the repository at this point in the history
  • Loading branch information
3b1b committed May 3, 2022
1 parent 22c5e79 commit a9a151d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions manimlib/scene/scene.py
Expand Up @@ -145,9 +145,6 @@ def tear_down(self) -> None:
if self.window:
self.window.destroy()
self.window = None
if self.inside_embed:
self.embed_shell.enable_gui(None)
self.embed_shell.exiter()

def interact(self) -> None:
# If there is a window, enter a loop
Expand Down Expand Up @@ -522,6 +519,8 @@ def handle_play_like_call(func):
def wrapper(self, *args, **kwargs):
if self.inside_embed:
self.save_state()
if self.presenter_mode and self.num_plays == 0:
self.hold_loop()

self.update_skipping_status()
should_write = not self.skip_animations
Expand Down Expand Up @@ -601,9 +600,7 @@ def wait(
if self.presenter_mode and not self.skip_animations and not ignore_presenter_mode:
if note:
log.info(note)
while self.hold_on_wait:
self.update_frame(dt=1 / self.camera.frame_rate)
self.hold_on_wait = True
self.hold_loop()
else:
time_progression = self.get_wait_time_progression(duration, stop_condition)
last_t = 0
Expand All @@ -617,6 +614,11 @@ def wait(
self.refresh_static_mobjects()
return self

def hold_loop(self):
while self.hold_on_wait:
self.update_frame(dt=1 / self.camera.frame_rate)
self.hold_on_wait = True

def wait_until(
self,
stop_condition: Callable[[], bool],
Expand Down

0 comments on commit a9a151d

Please sign in to comment.