mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-28 12:14:49 +00:00
Add way to get a list of DelugeEvent classes
This commit is contained in:
parent
1a1ab4e780
commit
ad04b2a137
@ -41,6 +41,16 @@ and subsequently emitted to the clients.
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
event_list = []
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
class DelugeEvent(object):
|
class DelugeEvent(object):
|
||||||
"""
|
"""
|
||||||
The base class for all events.
|
The base class for all events.
|
||||||
@ -49,6 +59,8 @@ class DelugeEvent(object):
|
|||||||
:prop args: a list of the attribute values
|
:prop args: a list of the attribute values
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
__metaclass__ = DelugeEventMetaClass
|
||||||
|
|
||||||
def _get_name(self):
|
def _get_name(self):
|
||||||
return self.__class__.__name__
|
return self.__class__.__name__
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user