diff options
| author | Manuel Mendez <mmendez534@gmail.com> | 2015-06-10 14:52:25 -0400 |
|---|---|---|
| committer | Manuel Mendez <mmendez534@gmail.com> | 2015-06-10 14:52:25 -0400 |
| commit | 5841d410afa29fc5c79f10fdc1464850567237c5 (patch) | |
| tree | 89ed345e8668d6bdacb69f437d675d39f6038605 | |
| parent | df16bcbfacafa1b3f4d3f4cbde45262b72d61751 (diff) | |
pomodoro: fix display_bar in python3
In python3 calling `encode` on a string will yield a `bytes` obj which
then leads to a status bar with escaped hex chars instead of the bars, i.e.
`Pomodoro [b'\xe2\x96\x89\xe2\x96\x89\xe2\x96\x8d ']` vs `Pomodoro [b'▉▉▍ ']`.
The fix in python2 is to call format on a `unicode` object vs a `str` (ansii)
object. This will work fine in python3 > 3.3 where the `u` prefix was brought
into python3.
| -rw-r--r-- | py3status/modules/pomodoro.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/py3status/modules/pomodoro.py b/py3status/modules/pomodoro.py index 25149a7..02b0be3 100644 --- a/py3status/modules/pomodoro.py +++ b/py3status/modules/pomodoro.py @@ -106,14 +106,14 @@ class Py3status: bar += PROGRESS_BAR_ITEMS[selector] bar_val -= 1 - bar = bar.ljust(self.num_progress_bars).encode('utf_8') + bar = bar.ljust(self.num_progress_bars) else: bar = self.timer if self.run: - text = '{} [{}]'.format(self.prefix, bar) + text = u'{} [{}]'.format(self.prefix, bar) else: - text = '{} ({})'.format(self.prefix, bar) + text = u'{} ({})'.format(self.prefix, bar) return dict(full_text=text) |
