Beispiel #1
0
 def _wait_for_data(self):
     next_poll = self._handle_data()
     socks = dict(self._poller.poll(timeout=self.poll_timeout))
     if self._handshake_socket in socks and \
             socks[self._handshake_socket] == zmq.POLLIN:
         self._handle_connection()
     GUI.invoke_after(next_poll, self._wait_for_data)
Beispiel #2
0
    def _play_func(self):
        '''
        Called while play button is selected
        :return:
        '''
        if self._play_thread:
            if self._last_clicked_direction is not None:
                self._last_clicked_direction()
            else:
                self.move_forward()

            GUI.invoke_after(1000, self._play_func)
Beispiel #3
0
 def _play_button_changed(self, play_pressed):
     '''
     Triggered when play button is selected
     :param play_pressed:
     :return:
     '''
     if play_pressed:
         if not self._play_thread:
             self._play_thread = True
             GUI.invoke_after(1, self._play_func)
     else:
         self._play_thread = False
Beispiel #4
0
    def _play_func(self):
        '''
        Called while play button is selected
        :return:
        '''
        if self._play_thread:
            if self._last_clicked_direction is not None:
                self._last_clicked_direction()
            else:
                self.move_forward()

            GUI.invoke_after(1000, self._play_func)
Beispiel #5
0
 def _play_button_changed(self, play_pressed):
     '''
     Triggered when play button is selected
     :param play_pressed:
     :return:
     '''
     if play_pressed:
         if not self._play_thread:
             self._play_thread = True
             GUI.invoke_after(1, self._play_func)
     else:
         self._play_thread = False
Beispiel #6
0
    def start(self):
        self._zmq_context = zmq.Context()
        self._poller = zmq.Poller()

        self._handshake_socket = self._zmq_context.socket(zmq.REP)
        self._handshake_socket.bind(self.handshake_string)
        self._data_socket = self._zmq_context.socket(zmq.SUB)
        self._data_socket.setsockopt(zmq.SUBSCRIBE, '')
        self._data_socket.connect(self.data_string)

        self._poller.register(self._handshake_socket, zmq.POLLIN)
        self._poller.register(self._data_socket, zmq.POLLIN)

        GUI.invoke_after(self.poll_period, self._wait_for_data)