示例#1
0
    def cleanUp(self):
        self.trace("[TangoDevice] cleanUp")
        self._descr = None

        if not self._deviceStateObj is None:
            self._deviceStateObj.removeListener(self)
        self._deviceStateObj = None
        self._deviceObj = None
        TaurusDevice.cleanUp(self)
示例#2
0
    def cleanUp(self):
        self.trace("[TangoDevice] cleanUp")
        self._descr = None

        if not self._deviceStateObj is None:
            self._deviceStateObj.removeListener(self)
        self._deviceStateObj = None
        self._deviceObj = None
        TaurusDevice.cleanUp(self)
示例#3
0
 def addListener(self, listener):
     weWereListening = self.hasListeners()
     ret = TaurusDevice.addListener(self, listener)
     if not ret:
         return ret
     # We are only listening to State if someone is listening to us
     if weWereListening:
         # We were listening already, so we must fake an event to the new
         # subscribed listener with the current value
         evt_value = self.__decode(self.stateObj.read())
         listeners = hasattr(listener, '__iter__') and listener or [
             listener]
         self.fireEvent(TaurusEventType.Change, evt_value, listeners)
     else:
         # We were not listening to events, but now we have to
         self.stateObj.addListener(self)
     return ret
示例#4
0
 def addListener(self, listener):
     weWereListening = self.hasListeners()
     ret = TaurusDevice.addListener(self, listener)
     if not ret:
         return ret
     # We are only listening to State if someone is listening to us
     if weWereListening:
         # We were listening already, so we must fake an event to the new
         # subscribed listener with the current value
         evt_value = self.__decode(self.stateObj.read())
         listeners = hasattr(listener, '__iter__') and listener or [
             listener
         ]
         self.fireEvent(TaurusEventType.Change, evt_value, listeners)
     else:
         # We were not listening to events, but now we have to
         self.stateObj.addListener(self)
     return ret
示例#5
0
 def removeListener(self, listener):
     ret = TaurusDevice.removeListener(self, listener)
     if not ret or self.hasListeners():
         return ret  # False, None or True
     return self.stateObj.removeListener(self)
示例#6
0
 def removeListener(self, listener):
     ret = TaurusDevice.removeListener(self, listener)
     if not ret or self.hasListeners():
         return ret  # False, None or True
     return self.stateObj.removeListener(self)