0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-14 03:31:50 +02:00

feat: user can choose if to save coordinates when moving to absolute coordinates

This commit is contained in:
wyzula-jan
2023-09-05 15:13:56 +02:00
parent b7a1b8bca1
commit 6324199299
2 changed files with 85 additions and 7 deletions

View File

@ -92,17 +92,36 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_same_xy">
<property name="text">
<string>Step [X] = Step [Y]</string>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<item row="1" column="0">
<widget class="QLabel" name="label_step_x">
<property name="minimumSize">
<size>
<width>108</width>
<height>19</height>
</size>
</property>
<property name="text">
<string>Decimal</string>
<string>Step [X]</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="spinBox_precision">
<property name="minimumSize">
<size>
<width>107</width>
<height>19</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
@ -114,15 +133,65 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="minimumSize">
<size>
<width>108</width>
<height>19</height>
</size>
</property>
<property name="text">
<string>Step</string>
<string>Decimal</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="spinBox_step">
<property name="minimumSize">
<size>
<width>107</width>
<height>19</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>99.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_step_y">
<property name="minimumSize">
<size>
<width>108</width>
<height>19</height>
</size>
</property>
<property name="text">
<string>Step [Y]</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QDoubleSpinBox" name="spinBox_step_y">
<property name="minimumSize">
<size>
<width>107</width>
<height>19</height>
</size>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
@ -287,6 +356,13 @@
<string>Move Absolute</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QCheckBox" name="checkBox_save_with_go">
<property name="text">
<string>Save position with Go</string>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="1">

View File

@ -197,6 +197,8 @@ class MotorApp(QWidget):
self.enable_motor_controls(False)
target_coordinates = (x, y)
self.motor_thread.move_to_coordinates(target_coordinates)
if self.checkBox_save_with_go.isChecked():
self.save_absolute_coordinates()
def move_motor_relative(self, motor, value: float) -> None:
self.enable_motor_controls(False)
@ -291,7 +293,7 @@ class MotorApp(QWidget):
)
# Go absolute button
self.pushButton_go_absolute.clicked.connect(self.save_absolute_coordinates)
# self.pushButton_go_absolute.clicked.connect(self.save_absolute_coordinates)
self.pushButton_go_absolute.setShortcut("Ctrl+G")
self.pushButton_go_absolute.setToolTip("Ctrl+G")