diff options
-rw-r--r-- | ttystatus/status.py | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/ttystatus/status.py b/ttystatus/status.py index 24f369b..54c6049 100644 --- a/ttystatus/status.py +++ b/ttystatus/status.py @@ -77,16 +77,17 @@ class TerminalStatus(object): def __setitem__(self, key, value): '''Set value for key.''' self._values[key] = value - 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)) + 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)) def increase(self, key, delta): '''Increase value for a key by a given amount.''' |