frontends (QuickApp), tools (TriggerManager): frontends can also use triggers + add those for sending and receiving a message

This commit is contained in:
souliane 2015-03-03 15:05:10 +01:00
commit 5d1681de93

View file

@ -20,7 +20,6 @@
"""Misc usefull classes"""
from sat.core.i18n import _
import sys
from sat.core.log import getLogger
log = getLogger(__name__)
@ -39,8 +38,13 @@ class TriggerManager(object):
"""This class manage triggers: code which interact to change the behaviour
of SàT"""
MIN_PRIORITY = float('-inf')
MAX_PRIORITY = float('+inf')
try: # FIXME: to be removed when a better solution is found
MIN_PRIORITY = float('-inf')
MAX_PRIORITY = float('+inf')
except: # XXX: Pyjamas will bug if you specify ValueError here
# Pyjamas uses the JS Float class
MIN_PRIORITY = Number.NEGATIVE_INFINITY
MAX_PRIORITY = Number.POSITIVE_INFINITY
def __init__(self):
self.__triggers = {}
@ -81,7 +85,7 @@ class TriggerManager(object):
if point_name not in self.__triggers:
return True
for priority,trigger in self.__triggers[point_name]:
for priority, trigger in self.__triggers[point_name]:
try:
if not trigger(*args, **kwargs):
return False