diff options
Diffstat (limited to 'nephilim/plugins/Systray.py')
-rw-r--r-- | nephilim/plugins/Systray.py | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/nephilim/plugins/Systray.py b/nephilim/plugins/Systray.py index 744f16b..5a8212c 100644 --- a/nephilim/plugins/Systray.py +++ b/nephilim/plugins/Systray.py @@ -12,8 +12,6 @@ class Systray(Plugin): appIcon = None pixmap = None DEFAULTS = {'format': '$track - $title by $artist on $album ($length)'} - LISTENERS = {'onSongChange' : 'update', 'onReady' : 'update', 'onConnect' : 'update', - 'onDisconnect' : 'update', 'onTimeChange' : 'update'} def _load(self): self.appIcon = QtGui.QIcon(appIcon) @@ -35,17 +33,28 @@ class Systray(Plugin): self.o.installEventFilter(self.eventObj) self.parent().connect(self.o, QtCore.SIGNAL('activated (QSystemTrayIcon::ActivationReason)') , self.onSysTrayClick) - self.o.show() + self.connect(self.mpclient(), QtCore.SIGNAL('song_changed'), self.update) + self.connect(self.mpclient(), QtCore.SIGNAL('ready'), self.update) + self.connect(self.mpclient(), QtCore.SIGNAL('connected'), self.update) + self.connect(self.mpclient(), QtCore.SIGNAL('disconnected'), self.update) + self.connect(self.mpclient(), QtCore.SIGNAL('time_changed'), self.update) + + self.o.show() def _unload(self): + self.disconnect(self.mpclient(), QtCore.SIGNAL('song_changed'), self.update) + self.disconnect(self.mpclient(), QtCore.SIGNAL('ready'), self.update) + self.disconnect(self.mpclient(), QtCore.SIGNAL('connected'), self.update) + self.disconnect(self.mpclient(), QtCore.SIGNAL('disconnected'), self.update) + self.disconnect(self.mpclient(), QtCore.SIGNAL('time_changed'), self.update) self.o.hide() self.o.setIcon(QtGui.QIcon(None)) - self.o=None - self.parent()._wheelEvent=None + self.o = None + self.parent()._wheelEvent = None def getInfo(self): return "Display the mpclientpc icon in the systray." - def update(self, params): + def update(self): status = self.mpclient().status() if not status: return |