diff --git a/README.md b/README.md index 20d16b02da9dc6347f9e2f1f47e693a5444e96de..4f7a5bccaf52579ec7c094c5044a897e90531827 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ pip install nidaqmx # Todo list -- Redesign the motor control panel +- Joystcick speed | jog speed - Mesurer plus vite (check NI) - Menu - Documentation diff --git a/src/classes/joystick.py b/src/classes/joystick.py index 20ebdadbe8f7f44072da8f6f98d4bc73530bce5e..4b785c65bc96ee0876d886a31e4eef3df4a75624 100644 --- a/src/classes/joystick.py +++ b/src/classes/joystick.py @@ -11,6 +11,7 @@ class Direction(Enum): class Joystick(QWidget): joystickMoved = pyqtSignal(Direction, float) + relax = pyqtSignal() THRESHOLD = 10.0 def __init__(self, parent=None): @@ -67,6 +68,7 @@ class Joystick(QWidget): def mouseReleaseEvent(self, event): self.grabCenter = False self.movingOffset = QPointF(0, 0) + self.relax.emit() self.update() def mouseMoveEvent(self, event): diff --git a/src/classes/stage.py b/src/classes/stage.py index d14d796407a3fec02d287d04c6b649318e863dac..3be76cc37018783f0faaadf616450eebc7d2c6d4 100644 --- a/src/classes/stage.py +++ b/src/classes/stage.py @@ -127,17 +127,14 @@ class Stage(): def jog_x(self, dir): if not self.motor_x.is_moving() and self.open: - sleep(0.1) self.motor_x.jog(dir) def jog_y(self, dir): if not self.motor_y.is_moving() and self.open: - sleep(0.1) self.motor_y.jog(dir) def jog_z(self, dir): if not self.motor_z.is_moving() and self.open: - sleep(0.1) self.motor_z.jog(dir) ################################################################# diff --git a/src/ui/controltab.py b/src/ui/controltab.py index ef03a94278376022f7e93823fde0202115cf8384..c7f1f137330ad6c568d1c24891763b0824e29795 100644 --- a/src/ui/controltab.py +++ b/src/ui/controltab.py @@ -1,4 +1,6 @@ from PyQt5 import QtWidgets +from PyQt5.QtGui import QFont +from PyQt5.QtCore import QThread, Qt from pymeasure.display.widgets import TabWidget from PyQt5.QtCore import Qt @@ -76,6 +78,9 @@ class ControlTab(TabWidget, QtWidgets.QWidget): super().__init__(parent) self.name = name + font = QFont() + font.setPointSize(16) + layout = QtWidgets.QGridLayout() layout.addWidget(QtWidgets.QLabel("Current Position", self), 0, 0, 1, 6) @@ -129,6 +134,21 @@ class ControlTab(TabWidget, QtWidgets.QWidget): layout.addWidget(label_arrows_X, 6, 0, 1, 3) layout.addWidget(label_arrows_Y, 7, 0, 1, 3) layout.addWidget(label_arrows_Z, 8, 0, 1, 3) + self.joystick_label_xy = QtWidgets.QLabel('(X, Y) Plane', self) + self.joystick_label_xy.setAlignment(Qt.AlignCenter) + self.joystick_label_xy.setFont(font) + + self.joystick_label_zy = QtWidgets.QLabel('(Z, Y) Plane', self) + self.joystick_label_zy.setAlignment(Qt.AlignCenter) + self.joystick_label_zy.setFont(font) + + self.joystick_xy = Joystick() + self.joystick_zy = Joystick() + + self.joystick_xy.joystickMoved.connect(self.move_stage_xy) + self.joystick_xy.relax.connect(self.stop_stage) + self.joystick_zy.joystickMoved.connect(self.move_stage_yz) + self.joystick_zy.relax.connect(self.stop_stage) group1 = ArrowButtonGroup(self, 'x') group2 = ArrowButtonGroup(self, 'y') diff --git a/src/ui/mainui.py b/src/ui/mainui.py index e715b22592f7ffbae0f84055b878dcaeb65d0965..3405529db0ce8b3ccd8142728214cc8fadf99478 100644 --- a/src/ui/mainui.py +++ b/src/ui/mainui.py @@ -356,6 +356,7 @@ class UIWindowBase(QtWidgets.QMainWindow): when it is called by the button and calls the `self.queue` method without any arguments. """ + self.widget_list[0].close_connections() # Not clean because works only for this really specific case for i in range(self.number_repetitions): self.queue()