0
0
mirror of https://github.com/bec-project/bec_widgets.git synced 2025-07-13 19:21:50 +02:00

feat: going to absolute coordinates saves coordinate in the table for later use with tag

This commit is contained in:
wyzula-jan
2023-08-23 13:17:35 +02:00
parent 95ead7117e
commit 8be98c9bb6
2 changed files with 12 additions and 9 deletions

View File

@ -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;")

View File

@ -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