Exemplo n.º 1
0
 def _getEventWait(self):
     if not hasattr(self, '_evt_wait'):
         # create an object that waits for attribute events.
         # each time we use it we have to connect and disconnect to an
         # attribute
         self._evt_wait = AttributeEventWait()
     return self._evt_wait
Exemplo n.º 2
0
    def release(self, synch=True):
        if not synch:
            try:
                self.command_inout("ReleaseMacro")
            except PyTango.DevFailed as df:
                # Macro already finished - no need to release
                if df.args[0].reason == "API_CommandNotAllowed":
                    pass
            return

        evt_wait = AttributeEventWait(self.getAttribute("state"))
        evt_wait.lock()
        try:
            time_stamp = time.time()
            try:
                self.command_inout("ReleaseMacro")
            except PyTango.DevFailed as df:
                # Macro already finished - no need to release
                if df.args[0].reason == "API_CommandNotAllowed":
                    return
            evt_wait.waitEvent(self.Running,
                               equal=False,
                               after=time_stamp,
                               timeout=self.InteractiveTimeout)
        finally:
            evt_wait.unlock()
            evt_wait.disconnect()
Exemplo n.º 3
0
    def stop(self, synch=True):
        if not synch:
            self.command_inout("StopMacro")
            return

        evt_wait = AttributeEventWait(self.getAttribute("state"))
        evt_wait.lock()
        try:
            time_stamp = time.time()
            self.command_inout("StopMacro")
            evt_wait.waitEvent(self.Running,
                               equal=False,
                               after=time_stamp,
                               timeout=self.InteractiveTimeout)
        finally:
            evt_wait.unlock()
            evt_wait.disconnect()