From 8be98c9bb6af941a69c593c62d5c52339d2262bc Mon Sep 17 00:00:00 2001 From: wyzula-jan <133381102+wyzula-jan@users.noreply.github.com> Date: Wed, 23 Aug 2023 13:17:35 +0200 Subject: [PATCH] feat: going to absolute coordinates saves coordinate in the table for later use with tag --- .../examples/motor_movement/motor_example.py | 19 ++++++++++++------- .../examples/plotting/crosshair_example.py | 2 -- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/bec_widgets/examples/motor_movement/motor_example.py b/bec_widgets/examples/motor_movement/motor_example.py index a946e8bd..a8dcc571 100644 --- a/bec_widgets/examples/motor_movement/motor_example.py +++ b/bec_widgets/examples/motor_movement/motor_example.py @@ -27,6 +27,7 @@ class MotorApp(QWidget): # UI self.init_ui() + self.tag_N = 1 # position label for saved coordinates # Initialize current coordinates with the provided initial coordinates self.motor_thread.retrieve_motor_limits(dev.samx, dev.samy) @@ -104,6 +105,7 @@ class MotorApp(QWidget): self.spinBox_absolute_x.value(), self.spinBox_absolute_y.value() ) ) + self.pushButton_go_absolute.clicked.connect(self.save_absolute_coordinates) # SpinBoxes - Motor Limits #TODO make spinboxes own limits updated, currently is [-1000, 1000] @@ -181,13 +183,6 @@ class MotorApp(QWidget): # Update the display self.image_map.updateImage(self.image_map_data, levels=(0, 255)) - # def get_motor_limits(self, motor): - # """Get the limits of a motor""" - # high_limit = motor.high_limit - # low_limit = motor.low_limit - # - # return low_limit, high_limit - def update_all_motor_limits( self, x_limit: list = None, y_limit: list = None ) -> None: # TODO will be moved to thread @@ -239,6 +234,16 @@ class MotorApp(QWidget): ) table.resizeColumnsToContents() + def save_absolute_coordinates(self): + self.generate_table_coordinate( + self.tableWidget_coordinates, + (self.spinBox_absolute_x.value(), self.spinBox_absolute_y.value()), + tag=f"Pos {self.tag_N}", + precision=0, + ) + + self.tag_N += 1 + @staticmethod def param_changed(ui_element): ui_element.setStyleSheet("background-color: #FFA700;") diff --git a/bec_widgets/examples/plotting/crosshair_example.py b/bec_widgets/examples/plotting/crosshair_example.py index 5aed65aa..f573ad69 100644 --- a/bec_widgets/examples/plotting/crosshair_example.py +++ b/bec_widgets/examples/plotting/crosshair_example.py @@ -15,10 +15,8 @@ from pyqtgraph.Qt import QtCore from bec_widgets.qt_utils import Crosshair - class ExampleApp(QWidget): def __init__(self): - """Example application for using the Crosshair class""" super().__init__() # Layout