diff options
author | Lars Wirzenius <liw@liw.fi> | 2012-04-08 09:00:20 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2012-04-08 09:00:20 +0100 |
commit | d3f9679bf884b6b7de3243e1cb68e0036e4f40a9 (patch) | |
tree | e1f6fbdf50da288cc78580f071ec43f95328ba0f | |
parent | d01ca96d641a76fcf7808e1e5364db5474f81899 (diff) | |
download | python-ttystatus-d3f9679bf884b6b7de3243e1cb68e0036e4f40a9.tar.gz |
Format widgets completely at end
-rw-r--r-- | ttystatus/status.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/ttystatus/status.py b/ttystatus/status.py index 54c6049..25fd1c1 100644 --- a/ttystatus/status.py +++ b/ttystatus/status.py @@ -78,16 +78,15 @@ class TerminalStatus(object): '''Set value for key.''' self._values[key] = value if self._m.time_to_write(): - width = self._m.width - if width != self._latest_width: - widgets = self._widgets - self._latest_width = width - else: - widgets = self._interests.get(key, []) + self._wildcards - for w in widgets: - w.update(self, width) - width -= len(str(w)) - self._m.write(''.join(str(w) for w in self._widgets)) + self._format() + + def _format(self): + '''Format and output all widgets.''' + width = self._m.width + for w in self._widgets: + w.update(self, width) + width -= len(str(w)) + self._m.write(''.join(str(w) for w in self._widgets)) def increase(self, key, delta): '''Increase value for a key by a given amount.''' @@ -103,6 +102,7 @@ class TerminalStatus(object): def finish(self): '''Finish status display.''' + self._format() self._m.finish() def disable(self): |