From c44744fa50f18a69b1c4e73dea53ee292bcd407b Mon Sep 17 00:00:00 2001 From: Tobi-wan Kenobi Date: Thu, 8 Dec 2016 09:04:47 +0100 Subject: [PATCH] [core/output] Small refactoring --- bumblebee/output.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bumblebee/output.py b/bumblebee/output.py index 727d634..47289ce 100644 --- a/bumblebee/output.py +++ b/bumblebee/output.py @@ -30,15 +30,19 @@ class I3BarOutput(object): """Finish i3bar protocol""" sys.stdout.write("]\n") + def draw_widget(self, result, widget): + """Draw a single widget""" + result.append({ + u"full_text": widget.full_text() + }) + def draw(self, widgets, engine=None): """Draw a number of widgets""" if not isinstance(widgets, list): widgets = [widgets] result = [] for widget in widgets: - result.append({ - u"full_text": widget.full_text() - }) + self.draw_widget(result, widget) sys.stdout.write(json.dumps(result)) def flush(self):