avoid importing pynotify more than once
authorGeoffrey Thomas <geofft@mit.edu>
Sun, 1 Mar 2009 08:23:58 +0000 (03:23 -0500)
committerGeoffrey Thomas <geofft@mit.edu>
Sun, 1 Mar 2009 08:23:58 +0000 (03:23 -0500)
barn-growl/barn-growl.py

index 546cd694863cc1a776a9de49de8781ee2518ddc7..799ea33680a2f4921445aed690f51313e200e3c8 100755 (executable)
@@ -21,6 +21,7 @@ class Notifier(AbstractConsumer):
             import pynotify
             pynotify.init("Zephyr")
             self.pings = {}
+            self.pynotify = pynotify
         self.useprint = useprint
         return
     def feed(self, s):
@@ -52,10 +53,9 @@ class Notifier(AbstractConsumer):
                 g.stdin.write(message)
                 g.stdin.close()
             if self.usenotify:
-                import pynotify
                 if id in self.pings:
                     self.pings[id].close()
-                self.pings[id] = pynotify.Notification(header, message)
+                self.pings[id] = self.pynotify.Notification(header, message)
                 self.pings[id].show()
     def close(self):
         return