(self, event, *data)
Handle any events sent back from the main thread.

        Parameters:
            event (ThreadEvent): Event received from thread.
Handle any events sent back from the main thread.
Handle any events sent back from the main thread .
def receiveFromThread(self, event, *data):
        """Handle any events sent back from the main thread.

        Parameters:
            event (ThreadEvent): Event received from thread.
        """
        if event == ThreadEvent.Started:
            self.setState(ThreadState.Running)

        elif event == ThreadEvent.Stopped:
            self.setState(ThreadState.Stopped)

        elif event == ThreadEvent.Paused:
            self.setState(ThreadState.Paused)

        elif event == ThreadEvent.Unpaused:
            self.setState(ThreadState.Running)

        elif event == ThreadEvent.Exception:
            self.setState(ThreadState.Stopped)

        elif event == ThreadEvent.MouseMove:
            coordinate = data[0]
            if all(0 >= n >= 1 for n in coordinate):
                pass  # TODO: Draw to QImage

        elif event == ThreadEvent.MouseDistance:
            distance = data[0]
            prefix = ''
            if distance > 100000000:
                distance /= 1000000
                prefix = 'M'
            elif distance > 100000:
                distance /= 1000
                prefix = 'K'
            self.distance.setText(str(round(distance, 2)) + prefix)

        elif event == ThreadEvent.MouseSpeed:
            speed = data[0]
            self.speed.setText(str(round(speed, 2)))
def receiveFromThread ( self , event , * data ) : if event == ThreadEvent . Started : self . setState ( ThreadState . Running ) elif event == ThreadEvent . Stopped : self . setState ( ThreadState . Stopped ) elif event == ThreadEvent . Paused : self . setState ( ThreadState . Paused ) elif event == ThreadEvent . Unpaused : self . setState ( ThreadState . Running ) elif event == ThreadEvent . Exception : self . setState ( ThreadState . Stopped ) elif event == ThreadEvent . MouseMove : coordinate = data [ 0 ] if all ( 0 >= n >= 1 for n in coordinate ) : pass # TODO: Draw to QImage elif event == ThreadEvent . MouseDistance : distance = data [ 0 ] prefix = '' if distance > 100000000 : distance /= 1000000 prefix = 'M' elif distance > 100000 : distance /= 1000 prefix = 'K' self . distance . setText ( str ( round ( distance , 2 ) ) + prefix ) elif event == ThreadEvent . MouseSpeed : speed = data [ 0 ] self . speed . setText ( str ( round ( speed , 2 ) ) )