Change the event_list to be a dictionary of known_events and their docstrings

This commit is contained in:
Andrew Resch 2009-11-16 00:39:15 +00:00
parent ad04b2a137
commit 2b3bd4f1f3
1 changed files with 10 additions and 5 deletions

View File

@ -41,15 +41,20 @@ and subsequently emitted to the clients.
"""
event_list = []
known_events = {}
class DelugeEventMetaClass(type):
"""
This metaclass simply keeps a list of all events classes created.
"""
def __init__(cls, name, bases, dct):
event_list.append(name)
super(DelugeEventMetaClass, cls).__init__(name, bases, dct)
if name != "DelugeEvent":
classdoc = cls.__doc__.splitlines()
if classdoc[0].strip():
known_events[name] = classdoc[0].strip()
else:
known_events[name] = classdoc[1].strip()
class DelugeEvent(object):
"""