Added a hidden method to hide mpd widget when no music is playing

This commit is contained in:
Kunal Shetye 2018-04-20 06:34:35 +02:00
parent fb6a9b1f7d
commit 9514f1fb01

View file

@ -55,6 +55,9 @@ class Module(bumblebee.engine.Module):
self._repeat = False
self._tags = defaultdict(lambda: '')
def hidden(self):
return self._status == None
@scrollable
def description(self, widget):
return string.Formatter().vformat(self._fmt, (), self._tags)
@ -80,6 +83,7 @@ class Module(bumblebee.engine.Module):
except RuntimeError:
pass
self._tags = defaultdict(lambda: '')
self._status = None
for line in info.split("\n"):
if line.startswith("[playing]"):
self._status = "playing"