Source code for gavo.user.useless

"""
Useless observers.

Well, maybe they aren't useless, but at least they are not intended for
"normal" use.
"""

#c Copyright 2008-2023, the GAVO project <gavo@ari.uni-heidelberg.de>
#c
#c This program is free software, covered by the GNU GPL.  See the
#c COPYING file in the source distribution.


from gavo.base import ObserverBase

[docs]class DelugeUI(ObserverBase): """is an observer that just dumps all events. """ def __init__(self, dispatcher): ObserverBase.__init__(self, dispatcher) for eventType in dispatcher.eventTypes: dispatcher.subscribe(eventType, lambda arg, eventType=eventType: self.dumpStuff(arg, eventType))
[docs] def dumpStuff(self, stuff, eventType): print(eventType, stuff)
[docs]class NullUI(ObserverBase): """is an observer that reports no events at all. """ def __init__(self, dispatcher): pass