class TrajectoryControllerThread(QtCore.QThread):
    def __init__(self, parent=None):
        super(TrajectoryControllerThread, self).__init__(parent)
        self.trajectoryController = TrajectoryController()
        self.args = None
        self.kwargs = None

    def prepare(self, *args, **kwargs):
        self.args = args
        self.kwargs = kwargs

    def run(self):
        self.trajectoryController.followTrajectory(*self.args, **self.kwargs)
        self.args = None
        self.kwargs = None

    def askToStop(self):
        self.trajectoryController.askToStop()
Exemple #2
0
class TrajectoryControllerThread(QtCore.QThread):
    def __init__(self, parent=None):
        super(TrajectoryControllerThread, self).__init__(parent)
        self.trajectoryController = TrajectoryController()
        self.args = None
        self.kwargs = None

    def prepare(self, *args, **kwargs):
        self.args = args
        self.kwargs = kwargs

    def run(self):
        self.trajectoryController.followTrajectory(*self.args, **self.kwargs)
        self.args = None
        self.kwargs = None

    def askToStop(self):
        self.trajectoryController.askToStop()
 def __init__(self, parent=None):
     super(TrajectoryControllerThread, self).__init__(parent)
     self.trajectoryController = TrajectoryController()
     self.args = None
     self.kwargs = None
Exemple #4
0
 def __init__(self, parent=None):
     super(TrajectoryControllerThread, self).__init__(parent)
     self.trajectoryController = TrajectoryController()
     self.args = None
     self.kwargs = None
Exemple #5
0
                    time.sleep(0.1)
                    i += 1
                    if self.trajectory_controller.isFinished():
                        print "Abort: Finished thread"
                        break
                else:
                    print "Terminating move thread"
                    self.trajectory_controller.terminate()

        super(TrajectoryWidget, self).abort()


if __name__ == '__main__':
    from TrajectoryController import TrajectoryController
    from CoreXY import CoreXY
    from SimpleMagnetToolhead import SimpleMagnetToolhead

    app = QtGui.QApplication(sys.argv)

    tj = TrajectoryController()
    cxy = CoreXY()
    tool = SimpleMagnetToolhead(4, 5)
    cxy.set_toolhead(tool)
    cxy.connect()
    cxy.home()
    cxy.toolhead.set_magnet(0, 'on')
    cxy.toolhead.set_magnet(1, 'on')
    gui = TrajectoryWidget(None, cxy)
    gui.start()
    sys.exit(app.exec_())