GUI: Adjustments to be able to load images for a completed grid
Build and Publish / build (push) Successful in 23s
Build and Publish / build (push) Successful in 23s
This commit is contained in:
@@ -159,6 +159,7 @@ class MainWindow(QMainWindow):
|
||||
self.camera_image.update_beam_mark.connect(self.daq.beam_mark_add)
|
||||
self.beamline.beam_center.beam_center.connect(self.daq.beam_center)
|
||||
self.beamline.beam_size.beam_size.connect(self.daq.beam_size_mm)
|
||||
self.camera_image.load_image.connect(self.raster.load_image)
|
||||
|
||||
if zmq_addr is not None:
|
||||
self.camera_thread = SampleCameraThread(zmq_url=zmq_addr)
|
||||
|
||||
@@ -79,6 +79,9 @@ class RasterGridManager(QObject):
|
||||
|
||||
self.__metric = RasterGridMetric.BKG
|
||||
|
||||
self.__loaded_image_prefix = None
|
||||
self.__loaded_image_index = None
|
||||
|
||||
self.__start_point : QPointF = QPointF(0, 0)
|
||||
self.__active_grid : RasterGridRequest = RasterGridRequest(
|
||||
n_x= 0,
|
||||
@@ -185,6 +188,7 @@ class RasterGridManager(QObject):
|
||||
|
||||
return cell_x, cell_y
|
||||
|
||||
@Slot(QPointF)
|
||||
def load_image(self, point: QPointF):
|
||||
for grid in self.__completed_grids:
|
||||
if self._is_grid_visible(grid.request):
|
||||
@@ -195,7 +199,11 @@ class RasterGridManager(QObject):
|
||||
|
||||
if 0 <= cell_x < n_x and 0 <= cell_y < n_y:
|
||||
cell = cell_y * n_x + cell_x
|
||||
print(f"Load {grid.result.file_prefix} {grid.result.images[cell].number}")
|
||||
|
||||
if self.__loaded_image_prefix != grid.result.file_prefix or self.__loaded_image_index != grid.result.images[cell].number:
|
||||
self.__loaded_image_prefix = grid.result.file_prefix
|
||||
self.__loaded_image_index = grid.result.images[cell].number
|
||||
print(f"Load {grid.result.file_prefix} {grid.result.images[cell].number}")
|
||||
|
||||
def is_part_of_active_grid(self, point: QPointF) -> bool:
|
||||
if not self._is_grid_visible(self.__active_grid):
|
||||
|
||||
@@ -42,6 +42,7 @@ class SampleCameraImageLabel(QGraphicsView):
|
||||
evaluate_grid = Signal()
|
||||
clear_grid = Signal()
|
||||
clear_evaluated_grids = Signal()
|
||||
load_image = Signal(QPointF)
|
||||
|
||||
zoom_change = Signal(int)
|
||||
set_omega = Signal(float)
|
||||
@@ -144,14 +145,20 @@ class SampleCameraImageLabel(QGraphicsView):
|
||||
|
||||
def mouseMoveEvent(self, event):
|
||||
mouse_pos = self.mapToScene(event.pos())
|
||||
txt = self.__raster_mgr.is_part_of_completed_grid(mouse_pos)
|
||||
if txt != "":
|
||||
QToolTip.showText(self.mapToGlobal(event.pos()), txt, self)
|
||||
elif self.__show_coords:
|
||||
x, y = mouse_pos.x(), mouse_pos.y()
|
||||
QToolTip.showText(
|
||||
self.mapToGlobal(event.pos()), f"{x:.0f}, {y:.0f} pxl", self
|
||||
)
|
||||
|
||||
if self.__state == SampleCameraImageState.IDLE:
|
||||
if event.modifiers() & Qt.KeyboardModifier.ShiftModifier:
|
||||
self.load_image.emit(mouse_pos)
|
||||
else:
|
||||
txt = self.__raster_mgr.is_part_of_completed_grid(mouse_pos)
|
||||
if txt != "":
|
||||
QToolTip.showText(self.mapToGlobal(event.pos()), txt, self)
|
||||
elif self.__show_coords:
|
||||
x, y = mouse_pos.x(), mouse_pos.y()
|
||||
QToolTip.showText(
|
||||
self.mapToGlobal(event.pos()), f"{x:.0f}, {y:.0f} pxl", self
|
||||
)
|
||||
|
||||
self.end_point = mouse_pos
|
||||
|
||||
if not self.click_timer.isActive():
|
||||
|
||||
Reference in New Issue
Block a user