def notify(self, result): if self.gn: if result == PASS: self.gn.notify(noteType=PASS, title="%s: Tests Passed" % self.name.upper(), description="All tests passed!", icon=Image.imageFromPath(os.path.join(os.path.dirname(__file__), "images", "pass.png"))) elif result == FAIL: self.gn.notify(noteType=FAIL, title="%s: Tests Failed" % self.name.upper(), description="FAIL!!!", icon=Image.imageFromPath(os.path.join(os.path.dirname(__file__), "images", "fail.png"))) else: self.gn.notify(noteType=PASS, title="%s: Running Tests" % self.name.upper(), description="Running tests...", icon=Image.imageFromPath(os.path.join(os.path.dirname(__file__), "images", "pending.png")))
def __notify(self, title, message, icon_path=None): ''' Sends a Growl notification with the given parameters. ''' if icon_path is not None: icon = Image.imageFromPath(icon_path) else: icon = None self.notifier.notify( GROWL_NOTIFICATIONS_DEFAULT[0], title, message, icon=icon )
def __init__(self): '''Registers a Growl notifier.''' super(Sneazr, self).__init__() # Store resource path to icons in dict. self.icon_paths = {} for status in ['pass', 'error', 'fail']: self.icon_paths[status] = resource_filename( 'resources', 'logo_%s.png' % status ) app_icon = Image.imageFromPath( resource_filename('resources', 'logo.png') ) self.notifier = GrowlNotifier( applicationName='Sneazr', notifications=GROWL_NOTIFICATIONS_DEFAULT, applicationIcon=app_icon ) self.notifier.register()
from repeattimer import RepeatTimer from pyvoice import GoogleVoice from Growl import GrowlNotifier from Growl import Image as GrowlImage def notify(): unread_messages = gv.get_unread_messages() for msg in unread_messages: growlifier.notify(noteType="update", title="New GV Message!", description=("%s- %s" % (msg.elapsedTimeSincePlaced, msg.phoneNumber))) icon_path = "txt.icon.png" if (__name__ == "__main__"): growl_icon = GrowlImage.imageFromPath(icon_path) growlifier = GrowlNotifier(applicationName="Google Voice", notifications=['update'], applicationIcon=growl_icon) growlifier.register() gv = GoogleVoice("*****@*****.**", "laner8") #check for new messages, and update with new Growl alert every 10 minutes timer = RepeatTimer(interval=600, function=notify) timer.run()
return 1 if 'y combinator' in text: return 1 if 'amazon' in text: return 1 if 'twitter' in text: return 1 if 'android' in text: return 1 if 'chrome' in text: return 1 if 'foursquare' in text: return 1 sticky = True icon = Image.imageFromPath('rss.png') feeds = { "Aaron Swartz": ("http://www.aaronsw.com/weblog/index.xml", None, sticky), "A VC": ("http://feeds.feedburner.com/AVc", None, sticky), "catonmat": ("http://feeds.feedburner.com/catonmat", None, sticky), "Heroku": ("http://feeds.feedburner.com/heroku", None, sticky), "Jason Cohen": ("http://feeds2.feedburner.com/blogspot/smartbear", None, sticky), "John Gruber": ("http://daringfireball.net/feeds/articles", None, sticky), "John Resig": ("http://feeds.feedburner.com/JohnResig", None, sticky), # "Marco": ("http://www.marco.org/rss", None, sticky), # "Patrick": ("http://www.kalzumeus.com/feed/", None, sticky), "Paul Buchheit": ("http://paulbuchheit.blogspot.com/feeds/posts/default", None, sticky), "Paul Graham": ("http://www.aaronsw.com/2002/feeds/pgessays.rss", None, sticky), "Sivers": ("http://sivers.org/en.atom", None, sticky), "Steve Blank": ("http://steveblank.com/feed/", None, sticky),
def notify(header,body): gi = Image.imageFromPath('static/images/arduino_logo.png') gn = GrowlNotifier(applicationName="Notify!",notifications=['alert','notification'],applicationIcon=gi) gn.register() gn.notify(noteType='notification',title=header,description=body,icon=gi)