def run(self): """ Thread body. loops and notifies the listener of new messages """ while not self._stop_flag: # Wait for a new message cv = self.timeline._messages_cvs[self.topic] with cv: while (self.topic not in self.timeline._messages) or (self.bag_msg_data == self.timeline._messages[self.topic]): cv.wait() if self._stop_flag: return bag_msg_data = self.timeline._messages[self.topic] # View the message self.bag_msg_data = bag_msg_data try: event = ListenerEvent(bag_msg_data) QCoreApplication.postEvent(self.listener, event) except Exception, ex: qWarning('Error notifying listener %s: %s' % (type(self.listener), str(ex)))
def run(self): """ Thread body. loops and notifies the listener of new messages """ while not self._stop_flag: # Wait for a new message cv = self.timeline._messages_cvs[self.topic] with cv: while (self.topic not in self.timeline._messages) or (self.bag_msg_data == self.timeline._messages[self.topic]): cv.wait() if self._stop_flag: return bag_msg_data = self.timeline._messages[self.topic] # View the message self.bag_msg_data = bag_msg_data try: event = ListenerEvent(bag_msg_data) QCoreApplication.postEvent(self.listener, event) except Exception as ex: qWarning('Error notifying listener %s: %s' % (type(self.listener), str(ex)))