[modules/gpmdp] quotes

This commit is contained in:
tobi-wan-kenobi 2020-04-19 10:14:56 +02:00
parent 2782b13dd2
commit 10a1bc18ad

View file

@ -14,43 +14,43 @@ import bumblebee.engine
class Module(bumblebee.engine.Module): class Module(bumblebee.engine.Module):
def __init__(self, engine, config): def __init__(self, engine, config):
widgets = [ widgets = [
bumblebee.output.Widget(name="gpmdp.prev"), bumblebee.output.Widget(name='gpmdp.prev'),
bumblebee.output.Widget(name="gpmdp.main", full_text=self.description), bumblebee.output.Widget(name='gpmdp.main', full_text=self.description),
bumblebee.output.Widget(name="gpmdp.next"), bumblebee.output.Widget(name='gpmdp.next'),
] ]
super(Module, self).__init__(engine, config, widgets) super(Module, self).__init__(engine, config, widgets)
engine.input.register_callback(widgets[0], button=bumblebee.input.LEFT_MOUSE, engine.input.register_callback(widgets[0], button=bumblebee.input.LEFT_MOUSE,
cmd="playerctl previous") cmd='playerctl previous')
engine.input.register_callback(widgets[1], button=bumblebee.input.LEFT_MOUSE, engine.input.register_callback(widgets[1], button=bumblebee.input.LEFT_MOUSE,
cmd="playerctl play-pause") cmd='playerctl play-pause')
engine.input.register_callback(widgets[2], button=bumblebee.input.LEFT_MOUSE, engine.input.register_callback(widgets[2], button=bumblebee.input.LEFT_MOUSE,
cmd="playerctl next") cmd='playerctl next')
self._status = None self._status = None
self._tags = None self._tags = None
def description(self, widget): def description(self, widget):
return self._tags if self._tags else "n/a" return self._tags if self._tags else 'n/a'
def update(self, widgets): def update(self, widgets):
self._load_song() self._load_song()
def state(self, widget): def state(self, widget):
if widget.name == "gpmdp.prev": if widget.name == 'gpmdp.prev':
return "prev" return 'prev'
if widget.name == "gpmdp.next": if widget.name == 'gpmdp.next':
return "next" return 'next'
return self._status return self._status
def _load_song(self): def _load_song(self):
info = "" info = ''
try: try:
info = bumblebee.util.execute("gpmdp-remote current") info = bumblebee.util.execute('gpmdp-remote current')
status = bumblebee.util.execute("gpmdp-remote status") status = bumblebee.util.execute('gpmdp-remote status')
except RuntimeError: except RuntimeError:
pass pass
self._status = status.split("\n")[0].lower() self._status = status.split('\n')[0].lower()
self._tags = info.split("\n")[0] self._tags = info.split('\n')[0]
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4