Merge pull request #251 from kunalshetye/issue-250

Added a hidden method to hide mpd widget when no music is playing
This commit is contained in:
tobi-wan-kenobi 2018-04-20 16:24:52 +02:00 committed by GitHub
commit fa9ad10549
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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"