From 716f0f9c20e618464f9bc021ac38761cb4caf829 Mon Sep 17 00:00:00 2001 From: Darren Ranalli Date: Thu, 25 Nov 2004 04:10:04 +0000 Subject: [PATCH] added post-announce events --- direct/src/showbase/BulletinBoard.py | 36 +++++++++++++++------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/direct/src/showbase/BulletinBoard.py b/direct/src/showbase/BulletinBoard.py index ee522bd661..8beed77341 100755 --- a/direct/src/showbase/BulletinBoard.py +++ b/direct/src/showbase/BulletinBoard.py @@ -14,27 +14,31 @@ class BulletinBoard: def __init__(self): self._dict = {} - def get(self, name): - return self._dict.get(name) + def get(self, postName): + return self._dict.get(postName) - def has(self, name): - return name in self._dict + def has(self, postName): + return postName in self._dict - def post(self, name, value=None): - if name in self._dict: + def getEventName(self, postName): + return 'bboard-%s' % postName + + def post(self, postName, value=None): + if postName in self._dict: BulletinBoard.notify.warning('changing %s from %s to %s' % ( - name, self._dict[name], value)) - self.update(name, value) + postName, self._dict[postName], value)) + self.update(postName, value) - def update(self, name, value): + def update(self, postName, value): """can use this to set value the first time""" - if name in self._dict: - BulletinBoard.notify.info('update: posting %s' % (name)) - self._dict[name] = value - - def remove(self, name): - if name in self._dict: - del self._dict[name] + if postName in self._dict: + BulletinBoard.notify.info('update: posting %s' % (postName)) + self._dict[postName] = value + messenger.send(self.getEventName(postName)) + def remove(self, postName): + if postName in self._dict: + del self._dict[postName] + def __repr__(self): return str(self._dict)