From 5841d410afa29fc5c79f10fdc1464850567237c5 Mon Sep 17 00:00:00 2001 From: Manuel Mendez Date: Wed, 10 Jun 2015 14:52:25 -0400 Subject: pomodoro: fix display_bar in python3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- py3status/modules/pomodoro.py | 6 +++--- 1 file 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) -- cgit v1.3