[Christine-commits] SF.net SVN: christine:[845] trunk/christine/libchristine/Plugins
Status: Beta
Brought to you by:
thesystems
From: <the...@us...> - 2010-06-01 17:04:52
|
Revision: 845 http://christine.svn.sourceforge.net/christine/?rev=845&view=rev Author: thesystems Date: 2010-06-01 17:04:44 +0000 (Tue, 01 Jun 2010) Log Message: ----------- M libchristine/Plugins/gnomeDBus/__init__.py * Improve the notification of play/next/stop M libchristine/Plugins/christinePyNotify/__init__.py * The plugin is a singleton and everybody will be able to use it. Modified Paths: -------------- trunk/christine/libchristine/Plugins/christinePyNotify/__init__.py trunk/christine/libchristine/Plugins/gnomeDBus/__init__.py Modified: trunk/christine/libchristine/Plugins/christinePyNotify/__init__.py =================================================================== --- trunk/christine/libchristine/Plugins/christinePyNotify/__init__.py 2010-06-01 16:51:33 UTC (rev 844) +++ trunk/christine/libchristine/Plugins/christinePyNotify/__init__.py 2010-06-01 17:04:44 UTC (rev 845) @@ -24,7 +24,7 @@ from libchristine.globalvars import PROGRAMNAME from libchristine.Events import christineEvents from libchristine.Translator import translate - +from libchristine.pattern.Singleton import Singleton logger = LoggerManager().getLogger('PyNotify') try: @@ -48,11 +48,12 @@ def _christinePyNotify(*args): - result = pynotify.Notification(*args) + c =christinePyNotify() + result = c.Notification(*args) return result -class christinePyNotify(plugin_base): +class christinePyNotify(plugin_base, Singleton): ''' This plugins shows notify bubbles using python-notify ''' @@ -80,14 +81,21 @@ notify_text += " by <big>%s</big>\n" % tags['artist'] if tags['album']: notify_text += " from <big>%s</big>" % tags['album'] - - if not getattr(self, 'Notify', False): - pixmap = self.__Share.getImage('logo') - self.Notify = _christinePyNotify('christine', '',pixmap) - if getattr(self.interface, 'TrayIcon', False): - self.Notify.attach_to_status_icon(self.interface.TrayIcon.TrayIcon) - self.Notify.set_property('body', notify_text) - self.Notify.show() + self.Notification(notify_text) + + def get_notification_obj(self): + if not getattr(self, 'Notify', False): + pixmap = self.__Share.getImage('logo') + self.Notify = pynotify.Notification('christine', '',pixmap) + return self.Notify + + def Notification(self,text): + n = self.get_notification_obj() + if getattr(self.interface, 'TrayIcon', False): + n.attach_to_status_icon(self.interface.TrayIcon.TrayIcon) + n.set_property('body', text) + n.show() + return True def get_active(self): return self.christineConf.getBool('pynotify/enabled') Modified: trunk/christine/libchristine/Plugins/gnomeDBus/__init__.py =================================================================== --- trunk/christine/libchristine/Plugins/gnomeDBus/__init__.py 2010-06-01 16:51:33 UTC (rev 844) +++ trunk/christine/libchristine/Plugins/gnomeDBus/__init__.py 2010-06-01 17:04:44 UTC (rev 845) @@ -99,12 +99,7 @@ self.iface.coreClass.goPrev() if getattr(self, 'Notify', False): self.Notify.close() - pixmap = self.__Share.getImage('trayicon') - self.Notify = _christinePyNotify('christine', '',pixmap) - if getattr(self.interface, 'TrayIcon', False): - self.Notify.attach_to_status_icon(self.interface.TrayIcon.TrayIcon) - self.Notify.set_property('body', key) - self.Notify.show() + Notify = _christinePyNotify(key) def get_active(self): return self.christineConf.getBool('dbus/gnome_media') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |