diff options
author | Lars Wirzenius <liw@liw.fi> | 2012-05-21 11:03:33 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2012-05-21 11:03:33 +0300 |
commit | ec9fc6940758127acdca70a8da8917bb5d310957 (patch) | |
tree | e96d163b91a4828e79da153049ea7a9075d2f9dd | |
parent | 396be80da12390a5127939662c903350112df8ea (diff) | |
download | ttystatus-ec9fc6940758127acdca70a8da8917bb5d310957.tar.gz |
Allow Messager.write to be forced
-rw-r--r-- | ttystatus/messager.py | 4 | ||||
-rw-r--r-- | ttystatus/status.py | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/ttystatus/messager.py b/ttystatus/messager.py index 43a04cf..0ae18df 100644 --- a/ttystatus/messager.py +++ b/ttystatus/messager.py @@ -104,10 +104,10 @@ class Messager(object): '''Is it time to write now?''' return self._now() - self._last_time >= self._period - def write(self, string): + def write(self, string, force=False): '''Write raw data, but only once per period.''' string = string[:self.width] - if self.time_to_write(): + if force or self.time_to_write(): self._overwrite(string) self._last_time = self._now() self._cached_msg = string diff --git a/ttystatus/status.py b/ttystatus/status.py index 82457b2..a52793d 100644 --- a/ttystatus/status.py +++ b/ttystatus/status.py @@ -104,7 +104,7 @@ class TerminalStatus(object): def _write(self): '''Render and output current state of all widgets.''' - self._m.write(self._render()) + self._m.write(self._render(), force=True) def increase(self, key, delta): '''Increase value for a key by a given amount.''' |