Make spotify scrollable and support unicode in all python versions
This commit is contained in:
parent
00c1209f73
commit
9b6fdbe9ac
1 changed files with 13 additions and 3 deletions
|
@ -13,6 +13,8 @@ Parameters:
|
||||||
LEFT_CLICK, RIGHT_CLICK, MIDDLE_CLICK, SCROLL_UP, SCROLL_DOWN
|
LEFT_CLICK, RIGHT_CLICK, MIDDLE_CLICK, SCROLL_UP, SCROLL_DOWN
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
import bumblebee.input
|
import bumblebee.input
|
||||||
import bumblebee.output
|
import bumblebee.output
|
||||||
import bumblebee.engine
|
import bumblebee.engine
|
||||||
|
@ -52,12 +54,12 @@ class Module(bumblebee.engine.Module):
|
||||||
engine.input.register_callback(self, button=buttons[pause_button],
|
engine.input.register_callback(self, button=buttons[pause_button],
|
||||||
cmd=cmd + "PlayPause")
|
cmd=cmd + "PlayPause")
|
||||||
|
|
||||||
## @scrollable
|
@scrollable
|
||||||
def spotify(self, widget):
|
def spotify(self, widget):
|
||||||
return str(self._song)
|
return self.string_song
|
||||||
|
|
||||||
def hidden(self):
|
def hidden(self):
|
||||||
return str(self._song) == ""
|
return self.string_song == ""
|
||||||
|
|
||||||
def update(self, widgets):
|
def update(self, widgets):
|
||||||
try:
|
try:
|
||||||
|
@ -71,7 +73,15 @@ class Module(bumblebee.engine.Module):
|
||||||
artist=','.join(props.get('xesam:artist')),
|
artist=','.join(props.get('xesam:artist')),
|
||||||
trackNumber=str(props.get('xesam:trackNumber')),
|
trackNumber=str(props.get('xesam:trackNumber')),
|
||||||
playbackStatus=u"\u25B6" if playback_status=="Playing" else u"\u258D\u258D" if playback_status=="Paused" else "",)
|
playbackStatus=u"\u25B6" if playback_status=="Playing" else u"\u258D\u258D" if playback_status=="Paused" else "",)
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
self._song = ""
|
self._song = ""
|
||||||
|
|
||||||
|
@property
|
||||||
|
def string_song(self):
|
||||||
|
if sys.version_info.major < 3:
|
||||||
|
return unicode(self._song)
|
||||||
|
return str(self._song)
|
||||||
|
|
||||||
|
|
||||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
||||||
|
|
Loading…
Reference in a new issue