1. Boris FELD
  2. PyDispatcher

Commits

Boris FELD  committed a8b12d4

Add first version of EventDispatcher

  • Participants
  • Parent commits 4e1d695
  • Branches default

Comments (0)

Files changed (4)

File lib/__init__.py

View file
  • Ignore whitespace
+__author__="lothiraldan"
+__date__ ="$23 juin 2010 11:17:43$"

File lib/core/EventDispacther.py

View file
  • Ignore whitespace
+class EventDispatcher:
+
+    self.events = {}
+
+    def attach(self, name, callback):
+        if not name in self.events.keys():
+            return False
+        self.events[name].append(callback)
+        return True
+
+    def detach(self, name, callback):
+        if not callback in self.events[name]:
+            return False
+        self.events[name].remove(callback)
+        return True
+
+    def declare(self, name):
+        if name in self.keys():
+            return False
+        self.events[name] = []

File lib/core/__init__.py

View file
  • Ignore whitespace
+__author__="lothiraldan"
+__date__ ="$23 juin 2010 11:17:51$"

File pyevent.py

View file
  • Ignore whitespace
+# To change this template, choose Tools | Templates
+# and open the template in the editor.
+
+__author__="lothiraldan"
+__date__ ="$23 juin 2010 11:14:51$"
+
+if __name__ == "__main__":
+    print "Hello World"