diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-03-06 13:36:39 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2012-03-06 13:36:39 +0100 |
commit | 4df2b77fdf42046fe19bd371be7c7255986b5980 (patch) | |
tree | 2a7227a0d22e03dc2c085514eaab36a7e5e612c4 /module/interaction/EventManager.py | |
parent | ssl fix (diff) | |
download | pyload-4df2b77fdf42046fe19bd371be7c7255986b5980.tar.xz |
renamed hooks to addons, new filemanager and database, many new api methods
you will loose ALL your LINKS, webinterface will NOT work
Diffstat (limited to 'module/interaction/EventManager.py')
-rw-r--r-- | module/interaction/EventManager.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/module/interaction/EventManager.py b/module/interaction/EventManager.py index 38faa3c46..02ecb82fb 100644 --- a/module/interaction/EventManager.py +++ b/module/interaction/EventManager.py @@ -1,14 +1,17 @@ # -*- coding: utf-8 -*- +from threading import Lock from traceback import print_exc from time import time +from module.utils import lock + class EventManager: """ Handles all Event related task, also stores an Event queue for clients, so they can retrieve them later. **Known Events:** - Most hook methods exists as events. These are some additional known events. + Most addon methods exists as events. These are some additional known events. ===================== ================ =========================================================== Name Arguments Description @@ -38,6 +41,8 @@ class EventManager: self.clients = {} self.events = {"metaEvent": []} + self.lock = Lock() + def getEvents(self, uuid): """ Get accumulated events for uuid since last call, this also registeres new client """ if uuid not in self.clients: @@ -80,6 +85,10 @@ class EventManager: if self.core.debug: print_exc() + self.updateClients(event, args) + + @lock + def updateClients(self, event, args): # append to client event queue if event in self.CLIENT_EVENTS: for uuid, client in self.clients.items(): @@ -88,7 +97,6 @@ class EventManager: else: client.append(event, args) - def removeFromEvents(self, func): """ Removes func from all known events """ for name, events in self.events.iteritems(): |