to run macros from the command line type:
$ (i)python -i -m ncd.sardana.macro
>>> from ncd.sardana.macro.my_macro import my_macro
# ncd/sardana/macro/__main__.py | |
from .init import init_macro_module | |
init_macro_module(__name__) |
# ncd/sardana/macro/init.py | |
MACRO_SERVER = None | |
def init_macro_module(name): | |
global MACRO_SERVER | |
if name == '__main__' and MACRO_SERVER is None: | |
from sardana.macroserver.macroserver import MacroServer | |
MACRO_SERVER = MacroServer('ms/test/1', name='test') | |
return MACRO_SERVER |
# ncd/sardana/macro/my_macro.py | |
from .init import init_macro_module | |
init_macro_module(__name__) | |
from sardana.macroserver.macro import macro | |
@macro([['message', [['message_item', Type.String, None, | |
'message item to be reported']], None, | |
'message to be reported']]) | |
def my_macro(self, message): | |
self.output(message) |