parent
b3e4c7503b
commit
e7eef7f028
1 changed files with 6 additions and 3 deletions
|
@ -22,14 +22,17 @@ class Module(core.module.Module):
|
||||||
return self.parameter("format", "Update Arch: {}")
|
return self.parameter("format", "Update Arch: {}")
|
||||||
|
|
||||||
def utilization(self, widget):
|
def utilization(self, widget):
|
||||||
return self.__format.format(self.__packages)
|
return self.__format.format(self.__packages if self.__packages >= 0 else "n/a")
|
||||||
|
|
||||||
def hidden(self):
|
def hidden(self):
|
||||||
return self.__packages == 0
|
return self.__packages == 0
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
|
try:
|
||||||
result = util.cli.execute("checkupdates")
|
result = util.cli.execute("checkupdates")
|
||||||
self.__packages = len(result.split("\n")) - 1
|
self.__packages = len(result.split("\n")) - 1
|
||||||
|
except:
|
||||||
|
self.__packages = -1
|
||||||
|
|
||||||
def state(self, widget):
|
def state(self, widget):
|
||||||
return self.threshold_state(self.__packages, 1, 100)
|
return self.threshold_state(self.__packages, 1, 100)
|
||||||
|
|
Loading…
Reference in a new issue