From ec9fc6940758127acdca70a8da8917bb5d310957 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Mon, 21 May 2012 11:03:33 +0300 Subject: Allow Messager.write to be forced --- ttystatus/messager.py | 4 ++-- 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.''' -- cgit v1.2.1