| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """ | 6 """ |
| 7 Package that implements a stream wrapper that has 'meters' as well as | 7 Package that implements a stream wrapper that has 'meters' as well as |
| 8 regular output. A 'meter' is a single line of text that can be erased | 8 regular output. A 'meter' is a single line of text that can be erased |
| 9 and rewritten repeatedly, without producing multiple lines of output. It | 9 and rewritten repeatedly, without producing multiple lines of output. It |
| 10 can be used to produce effects like progress bars. | 10 can be used to produce effects like progress bars. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 # Print the necessary number of backspaces to erase the previous | 64 # Print the necessary number of backspaces to erase the previous |
| 65 # message. | 65 # message. |
| 66 self._stream.write("\b" * len(self._last_update)) | 66 self._stream.write("\b" * len(self._last_update)) |
| 67 self._stream.write(str) | 67 self._stream.write(str) |
| 68 num_remaining = len(self._last_update) - len(str) | 68 num_remaining = len(self._last_update) - len(str) |
| 69 if num_remaining > 0: | 69 if num_remaining > 0: |
| 70 self._stream.write(" " * num_remaining + "\b" * num_remaining) | 70 self._stream.write(" " * num_remaining + "\b" * num_remaining) |
| 71 self._last_update = str | 71 self._last_update = str |
| 72 self._dirty = True | 72 self._dirty = True |
| OLD | NEW |