Commit 6b0e0e69 authored by Jose Tiago Macara Coutinho's avatar Jose Tiago Macara Coutinho
Browse files

tango shutter: add human repr

parent 96e905b4
Pipeline #2980 passed with stages
in 13 minutes and 39 seconds
......@@ -5,7 +5,7 @@
# Copyright (c) 2016 Beamline Control Unit, ESRF
# Distributed under the GNU LGPLv3. See LICENSE for more info.
from bliss.common.tango import DeviceProxy
from bliss.common.tango import DeviceProxy, DevFailed
import time
class tango_shutter:
......@@ -85,3 +85,16 @@ class tango_shutter:
while stat is False or time.time() - tt < timeout:
time.sleep(1)
stat = self.__control.read_attribute(self._manual).value
def __repr__(self):
try:
return self.__control.status()
except DevFailed:
return 'Shutter {}: Communication error with {}' \
.format(self.name, self.__control.dev_name())
def __enter__(self):
self.open()
def __exit__(self, exc_type, exc_val, exc_tb):
self.close()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment