in ebcli/bundled/asciimatics/screen.py [0:0]
def draw_next_frame(self, repeat=True):
"""
Draw the next frame in the currently configured Scenes. You must call
:py:meth:`.set_scenes` before using this for the first time.
:param repeat: Whether to repeat the Scenes once it has reached the end.
Defaults to True.
:raises StopApplication: if the application should be terminated.
"""
scene = self._scenes[self._scene_index]
try:
# Check for an event now and remember for refresh reasons.
event = self.get_event()
got_event = event is not None
# Now process all the input events
while event is not None:
event = scene.process_event(event)
if event is not None and self._unhandled_input is not None:
self._unhandled_input(event)
event = self.get_event()
# Only bother with a refresh if there was an event to process or
# we have to refresh due to the refresh limit required for an
# Effect.
self._frame += 1
self._idle_frame_count -= 1
if got_event or self._idle_frame_count <= 0 or self._forced_update:
self._forced_update = False
self._idle_frame_count = 1000000
for effect in scene.effects:
# Update the effect and delete if needed.
effect.update(self._frame)
if effect.delete_count is not None:
effect.delete_count -= 1
if effect.delete_count <= 0:
scene.remove_effect(effect)
# Sort out when we next _need_ to do a refresh.
if effect.frame_update_count > 0:
self._idle_frame_count = min(self._idle_frame_count,
effect.frame_update_count)
self.refresh()
if 0 < scene.duration <= self._frame:
raise NextScene()
except NextScene as e:
# Tidy up the current scene.
scene.exit()
# Find the specified next Scene
if e.name is None:
# Just allow next iteration of loop
self._scene_index += 1
if self._scene_index >= len(self._scenes):
if repeat:
self._scene_index = 0
else:
raise StopApplication("Repeat disabled")
else:
# Find the required scene.
for i, scene in enumerate(self._scenes):
if scene.name == e.name:
self._scene_index = i
break
else:
raise RuntimeError(
"Could not find Scene: '{}'".format(e.name))
# Reset the screen if needed.
scene = self._scenes[self._scene_index]
scene.reset()
self._frame = 0
self._idle_frame_count = 0
if scene.clear:
self.clear()