The following example shows how the on_stop() function of a derived class invodes the on_stop() function of the parent class.
#!/usr/bin/env python
#
from sardana.macroserver.macro import Macro, Type
import time
import PyTango
class parentClass(Macro):
def say( self):
self.output( "parentClass.say Hello ")
return
def on_stop( self):
self.output( "parentClass.on_stop")
class derivedClass( parentClass):
"""prints a string"""
param_def = [
[ "text", Type.String, None, "some text" ],
]
def on_stop( self):
self.output( "derivedClass.on_stop")
# parentClass.on_stop( self)
super( derivedClass, self).on_stop()
def run(self, text):
self.say()
timer = PyTango.DeviceProxy( "p21/dgg2/exp.01")
self.output( "waiting for ctrl-c")
timer.SampleTime = 0.5
for n in range(20):
self.output( "still waiting")
timer.StartAndWaitForTimer()