[modules/nvidiagpu] Hide if not found

This commit is contained in:
tobi-wan-kenobi 2020-04-28 20:15:25 +02:00
parent f1341772e5
commit 65faf73e8d

View file

@ -13,6 +13,7 @@ import core.module
import core.widget import core.widget
import util.cli import util.cli
import util.format
class Module(core.module.Module): class Module(core.module.Module):
def __init__(self, config, theme): def __init__(self, config, theme):
@ -23,6 +24,11 @@ class Module(core.module.Module):
def utilization(self, widget): def utilization(self, widget):
return self.__utilization return self.__utilization
def hidden(self):
if "not found" in self._utilization.startswith("not found"):
return True
return False
def update(self): def update(self):
sp = util.cli.execute('nvidia-smi -q', ignore_errors=True) sp = util.cli.execute('nvidia-smi -q', ignore_errors=True)