[output] Allow modules to pass back a single widget
Since "single widget" is the 99% use-case, make it easier for a module to return a single widget.
This commit is contained in:
parent
2cfb0997a0
commit
286aff2aa0
5 changed files with 9 additions and 14 deletions
|
@ -21,11 +21,7 @@ class Module(bumblebee.module.Module):
|
|||
|
||||
def widgets(self):
|
||||
self._perc = psutil.cpu_percent(percpu=False)
|
||||
return [
|
||||
bumblebee.output.Widget(self,
|
||||
"{:05.02f}%".format(self._perc)
|
||||
)
|
||||
]
|
||||
return bumblebee.output.Widget(self, "{:05.02f}%".format(self._perc))
|
||||
|
||||
def warning(self):
|
||||
return self._perc > self._config.parameter("cpu.warning", 70)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue