frontends (QuickApp), tools (TriggerManager): frontends can also use triggers + add those for sending and receiving a message
This commit is contained in:
parent
8b15911077
commit
5d1681de93
1 changed files with 21 additions and 5 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue