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

Allow reading Door Status when macros are stopping #1695

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions src/sardana/macroserver/macro.py
Original file line number Diff line number Diff line change
Expand Up @@ -2238,6 +2238,12 @@ def parent_macro(self):
internally by the *Executor*"""
return self._parent_macro

@property
def _command(self):
Copy link
Author

@HEnquist HEnquist Sep 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What should this be called? Just command feels dangerous, big risk of clashing with something in some macro. And the underscore doesn't match the rest of the unofficial api, whileget_command should be a function rather than a property.
A few other alternatives: command_string, macro_command, formatted_command...

"""**Unofficial Macro API**. Alternative to getCommand that does not
throw StopException in case of a Stop."""
return '%s %s' % (self._getName(), ' '.join([str(p) for p in self._in_pars]))

@property
def description(self):
"""**Unofficial Macro API**. Alternative to :meth:`getDescription` that
Expand Down
6 changes: 3 additions & 3 deletions src/sardana/tango/macroserver/Door.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,9 @@ def dev_status(self):
macro = self.getRunningMacro()
mstack = ''
while macro is not None:
mstate = macro.getMacroStatus()['state']
mstack = '\n -[%s]\t%s' % (mstate, macro.getCommand()) + mstack
macro = macro.getParentMacro()
mstate = macro._getMacroStatus()['state']
mstack = '\n -[%s]\t%s' % (mstate, macro._command) + mstack
macro = macro.parent_macro
self._status += mstack
return self._status

Expand Down