Package gavo :: Package user :: Module useless
[frames] | no frames]

Source Code for Module gavo.user.useless

 1  """ 
 2  Useless observers. 
 3   
 4  Well, maybe they aren't useless, but at least they are not intended for 
 5  "normal" use. 
 6  """ 
 7   
 8  #c Copyright 2008-2019, the GAVO project 
 9  #c 
10  #c This program is free software, covered by the GNU GPL.  See the 
11  #c COPYING file in the source distribution. 
12   
13   
14  from __future__ import print_function 
15   
16  from gavo.base import ObserverBase 
17   
18 -class DelugeUI(ObserverBase):
19 """is an observer that just dumps all events. 20 """
21 - def __init__(self, dispatcher):
22 ObserverBase.__init__(self, dispatcher) 23 for eventType in dispatcher.eventTypes: 24 dispatcher.subscribe(eventType, 25 lambda arg, eventType=eventType: self.dumpStuff(arg, eventType))
26
27 - def dumpStuff(self, stuff, eventType):
28 print(eventType, stuff)
29 30
31 -class NullUI(ObserverBase):
32 """is an observer that reports no events at all. 33 """
34 - def __init__(self, dispatcher):
35 pass
36