From b157aa9fb5c21e305b168bfa101259d92b9b29cd Mon Sep 17 00:00:00 2001 From: Tobias Witek Date: Sun, 9 Feb 2020 13:30:40 +0100 Subject: [PATCH] [core/output] Minor refactoring - widget assembly --- core/output.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/core/output.py b/core/output.py index 925456d..98a00e0 100644 --- a/core/output.py +++ b/core/output.py @@ -31,16 +31,20 @@ class i3(object): def stop(self): return { 'suffix': '\n]' } + def widgets(self, module): + widgets = [] + for widget in module.widgets(): + widgets.append({ + 'full_text': widget.full_text(), + 'instance': widget.id(), + 'name': module.id(), + }) + return widgets + def update(self, affected_modules=None): for module in self._modules: module.update() - self._status[module] = [] - for widget in module.widgets(): - self._status[module].append({ - 'full_text': widget.full_text(), - 'instance': widget.id(), - 'name': module.id(), - }) + self._status[module] = self.widgets(module) def statusline(self): widgets = []