Skip to content

Commit

Permalink
Add a read-only property for the current scene
Browse files Browse the repository at this point in the history
A getter for the current scene has been added to the screen object. This
is required for handling screen resizes when the main loop is run
manually by clients using draw_next_frame.
  • Loading branch information
ianadeem authored and peterbrittain committed Apr 16, 2018
1 parent 1cfabf9 commit d580f64
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions asciimatics/screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -1489,6 +1489,14 @@ def draw_next_frame(self, repeat=True):
if scene.clear:
self.clear()

@property
def current_scene(self):
"""
:return: The scene currently being rendered. To be used in conjunction
with :py:meth:`.draw_next_frame`.
"""
return self._scenes[self._scene_index]

def force_update(self):
"""
Force the Screen to redraw the current Scene on the next call to
Expand Down

0 comments on commit d580f64

Please sign in to comment.