Commits

David Schneider  committed 3ee00e4

Add icons for nofitications

  • Participants
  • Parent commits 132d225

Comments (0)

Files changed (4)

File images/green.png

Added
New image

File images/red.png

Added
New image

File images/yellow.png

Added
New image

File notifiers/growl.py

+from os import path
 import Growl
+
 class Notifier(object):
     def __init__(self, config):
         self._setup_growl()
+        base = path.join(path.dirname(__file__), '..', 'images')
+        self.red = Growl.Image.imageFromPath(path.join(base, 'red.png'))
+        self.green = Growl.Image.imageFromPath(path.join(base, 'green.png'))
+        self.yellow = Growl.Image.imageFromPath(path.join(base, 'yellow.png'))
 
     def _setup_growl(self):
         self.growl = Growl.GrowlNotifier('py.test', ['info', 'red', 'green', 'yellow'])
         self.growl.register()
-    
+
     def notify(self, message, title=None, kind='info'):
         if title is None:
             title = 'py.test info'
-        self.growl.notify(kind, title, message)
+        icon = self._select_icon(kind)
+        self.growl.notify(kind, title, message, icon=icon)
+
+    def _select_icon(self, kind):
+        if kind in self.__dict__:
+            return getattr(self, kind)