コード例 #1
0
ファイル: cli.py プロジェクト: Blacksens/enigma2-plugins
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 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)
コード例 #3
0
ファイル: Message.py プロジェクト: kfdm-archive/social-growl
	def __init__(self,appname,iconname=None):
		_icon = None
		if iconname:
			_icon = open(iconname).read()
		_Notifier.__init__(
			self,
			applicationName = appname,
			notifications = GROWL_NOTIFICATIONS,
			defaultNotifications = GROWL_NOTIFICATIONS,
			applicationIcon = _icon
		)
コード例 #4
0
class ConfigTests(GNTPTestCase):
	def setUp(self):
		if os.path.exists(ORIGINAL_CONFIG):
			os.rename(ORIGINAL_CONFIG, BACKUP_CONFIG)
		self.growl = GrowlNotifier('GNTP unittest', ['Testing'])
		self.growl.register()

	def test_missing_config(self):
		self.assertTrue(self._notify(description='No config file test'))

	def tearDown(self):
		if os.path.exists(BACKUP_CONFIG):
			os.rename(BACKUP_CONFIG, ORIGINAL_CONFIG)
コード例 #5
0
ファイル: test_config.py プロジェクト: squizzeak/gntp
class ConfigTests(GNTPTestCase):
    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()

    def test_missing_config(self):
        self.assertIsTrue(self._notify(description='No config file test'))

    def tearDown(self):
        if os.path.exists(BACKUP_CONFIG):
            os.rename(BACKUP_CONFIG, ORIGINAL_CONFIG)
コード例 #6
0
ファイル: __init__.py プロジェクト: AtoomLAN/arista-growler
class GNTPTestCase(unittest.TestCase):
	notification = {
		'noteType': 'Testing',
		'title': 'Unittest Title',
		'description': 'Unittest Description',
	}

	def setUp(self):
		self.growl = GrowlNotifier('GNTP unittest', ['Testing'])
		self.growl.register()

	def _notify(self, **kargs):
		for k in self.notification:
			if not k in kargs:
				kargs[k] = self.notification[k]

		return self.growl.notify(**kargs)
コード例 #7
0
class GNTPTestCase(unittest.TestCase):
    application = 'GNTP unittest'
    notification_name = 'Testing'

    notification = {
        'noteType': notification_name,
        'title': 'Unittest Title',
        'description': 'Unittest Description',
    }

    def setUp(self):
        self.growl = GrowlNotifier(self.application, [self.notification_name])
        self.growl.register()

    def _notify(self, **kargs):
        for k in self.notification:
            if not k in kargs:
                kargs[k] = self.notification[k]

        return self.growl.notify(**kargs)

    def assertIsTrue(self, result):
        """Python 2.5 safe way to assert that the result is true"""
        return self.assertEqual(result, True)
コード例 #8
0
ファイル: __init__.py プロジェクト: Thraxis/gntp
class GNTPTestCase(unittest.TestCase):
	application = 'GNTP unittest'
	notification_name = 'Testing'

	notification = {
		'noteType': notification_name,
		'title': 'Unittest Title',
		'description': 'Unittest Description',
	}

	def setUp(self):
		self.growl = GrowlNotifier(self.application, [self.notification_name])
		self.growl.register()

	def _notify(self, **kargs):
		for k in self.notification:
			if not k in kargs:
				kargs[k] = self.notification[k]

		return self.growl.notify(**kargs)

	def assertIsTrue(self, result):
		"""Python 2.5 safe way to assert that the result is true"""
		return self.assertEqual(result, True)
コード例 #9
0
	def setUp(self):
		if os.path.exists(ORIGINAL_CONFIG):
			os.rename(ORIGINAL_CONFIG, BACKUP_CONFIG)
		self.growl = GrowlNotifier('GNTP unittest', ['Testing'])
		self.growl.register()
コード例 #10
0
 def setUp(self):
     self.growl = GrowlNotifier(self.application, [self.notification_name])
     self.growl.register()
コード例 #11
0
ファイル: __init__.py プロジェクト: kfdm-archive/nose-gntp
 def __init__(self):
     GrowlNotifier.__init__(self,
         applicationName='Nose',
         notifications=['Nose', 'Success', 'Failure']
     )
コード例 #12
0
ファイル: test_config.py プロジェクト: Thraxis/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()
コード例 #13
0
ファイル: __init__.py プロジェクト: Thraxis/gntp
	def setUp(self):
		self.growl = GrowlNotifier(self.application, [self.notification_name])
		self.growl.register()
コード例 #14
0
ファイル: __init__.py プロジェクト: AtoomLAN/arista-growler
	def setUp(self):
		self.growl = GrowlNotifier('GNTP unittest', ['Testing'])
		self.growl.register()
コード例 #15
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()
コード例 #16
0
ファイル: views.py プロジェクト: kfdm/django-growl
 def post(self, request):
     growl = GrowlNotifier(notifications=['Test'])
     growl.register()
     growl.notify('Test', 'Test', 'Test')
     return HttpResponse('result')