[modul pacman] - enable suming up all updates to save screen real estate

This commit is contained in:
Antonin Dach 2018-05-12 20:23:55 +02:00
parent 52b4bfac35
commit 8946322bd5

View file

@ -1,6 +1,9 @@
# pylint: disable=C0111,R0903 # pylint: disable=C0111,R0903
"""Displays update information per repository for pacman." """Displays update information per repository for pacman.
Parameters:
* pacman.sum: If you prefere displaying updates with a single digit (defaults to "False")
Requires the following executables: Requires the following executables:
* fakeroot * fakeroot
@ -45,8 +48,12 @@ class Module(bumblebee.engine.Module):
bumblebee.output.Widget(full_text=self.updates) bumblebee.output.Widget(full_text=self.updates)
) )
self._count = 0 self._count = 0
self._sum = True if self.parameter("sum") == "True" else False
def updates(self, widget): def updates(self, widget):
if (self._sum):
return str(sum(map(lambda x: widget.get(x, 0), repos)))
return '/'.join(map(lambda x: str(widget.get(x, 0)), repos)) return '/'.join(map(lambda x: str(widget.get(x, 0)), repos))
def update(self, widgets): def update(self, widgets):