Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Add macro name and line to macro status 'start' event #1476

Merged
merged 2 commits into from
Jan 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/sardana/macroserver/macro.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,8 @@ def __init__(self, *args, **kwargs):
self._id = kwargs.get('id')
self._desc = "Macro '%s'" % self._macro_line
self._macro_status = {'id': self._id,
'name': self._name,
'macro_line': self._macro_line,
'range': (0.0, 100.0),
'state': 'start',
'step': 0.0}
Expand Down Expand Up @@ -2334,6 +2336,12 @@ def exec_(self):
# make sure a 0.0 progress is sent
yield macro_status

# Avoid repeating same information on subsequent events. If, in the
# future, clients that connect in the middle of macro execution need
# this information, just simply remove the lines below
del macro_status['name']
del macro_status['macro_line']

# allow any macro to be paused at the beginning of its execution
self.pausePoint()

Expand Down
1 change: 0 additions & 1 deletion src/sardana/macroserver/test/res/macros/testmacros.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ def run(self, *args):

params = (99, 1., 2.)
expected_params = (99, [1., 2.])
self.runMacro(macro)
macro, pars = self.createMacro('pt6_base', *params)
self.runMacro(macro)
result = macro.data
Expand Down