[core/output] Add widget drawing
Add basic drawing of widgets. Each module instance returns a list of widgets using the widgets() method which is then forwarded to the draw() method of the configured output. see #23
This commit is contained in:
parent
6f52825ef0
commit
712d958e18
5 changed files with 41 additions and 1 deletions
|
@ -18,4 +18,15 @@ class I3BarOutput(object):
|
|||
"""Finish i3bar protocol"""
|
||||
sys.stdout.write("]\n")
|
||||
|
||||
def draw(self, widgets):
|
||||
"""Draw a number of widgets"""
|
||||
if not isinstance(widgets, list):
|
||||
widgets = [widgets]
|
||||
result = []
|
||||
for widget in widgets:
|
||||
result.append({
|
||||
u"full_text": widget.text()
|
||||
})
|
||||
sys.stdout.write(json.dumps(result))
|
||||
|
||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue