コード例 #1
0
def main():
    (options, message) = ClientParser().parse_args()
    logging.basicConfig(level=options.verbose)

    growl = GrowlNotifier(
        applicationName=options.app,
        notifications=[options.name],
        defaultNotifications=[options.name],
        hostname=options.host,
        password=options.password,
        port=options.port,
    )
    result = growl.register()
    if result is not True:
        exit(result)

    # This would likely be better placed within the growl notifier
    # class but until I make _checkIcon smarter this is "easier"
    if options.icon is not None and not options.icon.startswith('http'):
        logging.info('Loading image %s', options.icon)
        f = open(options.icon)
        options.icon = f.read()
        f.close()

    result = growl.notify(
        noteType=options.name,
        title=options.title,
        description=message,
        icon=options.icon,
        sticky=options.sticky,
        priority=options.priority,
        callback=options.callback,
    )
    if result is not True:
        exit(result)
コード例 #2
0
 def setUp(self):
     self.growl = GrowlNotifier(self.application, [self.notification_name])
     self.growl.register()
コード例 #3
0
ファイル: test_config.py プロジェクト: squizzeak/gntp
 def setUp(self):
     if os.path.exists(ORIGINAL_CONFIG):
         os.rename(ORIGINAL_CONFIG, BACKUP_CONFIG)
     self.growl = GrowlNotifier(self.application, [self.notification_name])
     self.growl.register()