The macro say is executed like this:
p09/door/haso107tk.01 [22]: say a message to the user say: a message to the user
The text is sent via a door to spock or SardanaMacroExecutor. This communication path has certain disadvantages: the message might get lost in the output stream generated during a scan and the user cannot enter 'say' while a scan is active. Therefore, consider to use SardanaChat.py, see 7.2.2.
#!/usr/bin/env python
from sardana.macroserver.macro import macro, Macro, Type
class say(Macro):
”'
say prints a message being sent via a door to spock or the MacroExecutor
”'
param_def = [ ["words", [[ 'word', Type.String, None, 'value']],
None, "a line to be printed"]]
def run(self, words):
self.output( "say: %s" % " ".join( words).strip())
# blue
self.info( "say (info): %s" % " ".join( words).strip())
# yellow
self.warning( "say (warn): %s" % " ".join( words).strip())
# read
self.error( "say (error): %s" % " ".join( words).strip())
return