diff options
author | Lars Wirzenius <liw@liw.fi> | 2015-10-23 22:09:41 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2015-10-23 22:09:41 +0300 |
commit | 4c57a5cf4223b6c6085e3cfa60c8b1c908b98e48 (patch) | |
tree | 1fdaba56117f49ab86ee38b9ed94eebd8d3836a2 /ttystatus | |
parent | 4d3769889e4c23bf240154c78c41dee9042b4fe5 (diff) | |
download | python-ttystatus-4c57a5cf4223b6c6085e3cfa60c8b1c908b98e48.tar.gz |
Fix flushing
Diffstat (limited to 'ttystatus')
-rw-r--r-- | ttystatus/messager.py | 4 | ||||
-rw-r--r-- | ttystatus/status.py | 6 | ||||
-rw-r--r-- | ttystatus/status_tests.py | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/ttystatus/messager.py b/ttystatus/messager.py index 15f75fb..91206bb 100644 --- a/ttystatus/messager.py +++ b/ttystatus/messager.py @@ -76,14 +76,14 @@ class Messager(object): def get_max_line_length(self): return self._area.get_max_line_length() - def write(self, message): + def write(self, message, force=False): '''Write message to terminal. Message may be multiple lines. ''' - if self.enabled and self.time_to_write(): + if self.enabled and (force or self.time_to_write()): self.clear() num_lines = len(message.split('\n')) self._area.make_space(num_lines) diff --git a/ttystatus/status.py b/ttystatus/status.py index 1760f8a..debd576 100644 --- a/ttystatus/status.py +++ b/ttystatus/status.py @@ -122,7 +122,7 @@ class TerminalStatus(object): ''' - self._write() + self._write(force=True) def _render(self): '''Render current state of all widgets.''' @@ -154,9 +154,9 @@ class TerminalStatus(object): c if ord(c) >= ASCII_SPACE else '' for c in line.expandtabs()) - def _write(self): + def _write(self, force=False): '''Render and output current state of all widgets.''' - self._m.write(self._render()) + self._m.write(self._render(), force=force) def increase(self, key, delta): '''Increase value for a key by a given amount.''' diff --git a/ttystatus/status_tests.py b/ttystatus/status_tests.py index ecf91f9..92425ac 100644 --- a/ttystatus/status_tests.py +++ b/ttystatus/status_tests.py @@ -36,7 +36,7 @@ class DummyMessager(object): def time_to_write(self): return True - def write(self, string): + def write(self, string, force=False): self.written.write(string) def notify(self, string, f, force=False): |