mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-07 00:48:41 +00:00
Add way to get a list of DelugeEvent classes
This commit is contained in:
parent
1a1ab4e780
commit
ad04b2a137
1 changed files with 12 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue