diff options
-rwxr-xr-x | speed-test | 1 | ||||
-rw-r--r-- | ttystatus/messager.py | 4 | ||||
-rw-r--r-- | ttystatus/status.py | 2 | ||||
-rw-r--r-- | ttystatus/status_tests.py | 3 |
4 files changed, 9 insertions, 1 deletions
@@ -53,6 +53,7 @@ ts.format( '%ElapsedTime() %Counter(current-file) files found; ' '%ByteSize(uploaded-bytes) uploaded %Pathname(current-dir)') ts['uploaded-bytes'] = 0 +ts.disable() num_updates = 1000*1000 diff --git a/ttystatus/messager.py b/ttystatus/messager.py index 8743561..00b05d1 100644 --- a/ttystatus/messager.py +++ b/ttystatus/messager.py @@ -60,6 +60,10 @@ class Messager(object): '''Enable output to happen.''' self._enabled = True + def is_enabled(self): + '''Is output enabled?''' + return self._enabled + def time_to_write(self): '''Is it time to write now?''' return self._now() - self._previous_write_at >= self._period diff --git a/ttystatus/status.py b/ttystatus/status.py index b4232d2..46e291f 100644 --- a/ttystatus/status.py +++ b/ttystatus/status.py @@ -92,7 +92,7 @@ class TerminalStatus(object): for row in self._widget_rows: for w in row: w.update(self) - if self._m.time_to_write(): + if self._m.is_enabled() and self._m.time_to_write(): self._write() def flush(self): diff --git a/ttystatus/status_tests.py b/ttystatus/status_tests.py index ecf91f9..0a96917 100644 --- a/ttystatus/status_tests.py +++ b/ttystatus/status_tests.py @@ -51,6 +51,9 @@ class DummyMessager(object): def disable(self): self.enabled = False + def is_enabled(self): + return self.enabled + class TerminalStatusTests(unittest.TestCase): |