diff options
author | Lars Wirzenius <liw@liw.fi> | 2015-09-27 12:18:22 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2015-09-27 12:18:22 +0300 |
commit | ab009314c2acd9e520f2d23a085a41556d424df5 (patch) | |
tree | f02c9b542e50c61e8e1a78dead494bf5a0999e9c /ttystatus/status.py | |
parent | d629ca9326f4693440b39f5fa73d62834279edbc (diff) | |
download | python-ttystatus-ab009314c2acd9e520f2d23a085a41556d424df5.tar.gz |
Fix tests for multiline TerminalStatus support
Diffstat (limited to 'ttystatus/status.py')
-rw-r--r-- | ttystatus/status.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/ttystatus/status.py b/ttystatus/status.py index 61adcbe..0f57f74 100644 --- a/ttystatus/status.py +++ b/ttystatus/status.py @@ -40,7 +40,7 @@ class TerminalStatus(object): '''Add a new widget to the status display.''' self._widget_rows[-1].append(widget) - def start_new_line(self): + def start_new_line(self): # pragma: no cover '''Start a new line of widgets.''' self._widget_rows.append([]) @@ -55,11 +55,18 @@ class TerminalStatus(object): ''' for i, line in enumerate(format_string.split('\n')): - if i > 0: + if i > 0: # pragma: no cover self.start_new_line() for widget in ttystatus.parse(line): self.add(widget) + @property + def widgets(self): + result = [] + for row in self._widget_rows: + result += row + return result + def clear(self): '''Remove all widgets.''' self._widget_rows = [[]] |