From df20e16f56b6a65cecccf233ba154cb9196d8076 Mon Sep 17 00:00:00 2001 From: Rukiyye Date: Tue, 6 Aug 2024 13:00:16 +0200 Subject: [PATCH] set movable to false and overrode hoverEvent --- cellpose/gui/guiparts.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cellpose/gui/guiparts.py b/cellpose/gui/guiparts.py index cbcfa532..daf96e79 100644 --- a/cellpose/gui/guiparts.py +++ b/cellpose/gui/guiparts.py @@ -453,7 +453,8 @@ def __init__(self, parent=None): # Create and add a highlight rectangle to the minimap with initial position [0, 0] and size [100, 100], outlined # in white with a 3-pixel width. - self.highlight_area = pg.RectROI([0, 0], [100, 100], pen=pg.mkPen('w', width=3), resizable=False) + self.highlight_area = pg.RectROI([0, 0], [100, 100], pen=pg.mkPen('w', width=3), resizable=False, movable=False) + self.highlight_area.hoverEvent = lambda event: None # Remove all resize handles after initialization QtCore.QTimer.singleShot(0, lambda: [self.highlight_area.removeHandle(handle) for handle in self.highlight_area.getHandles()]) @@ -636,6 +637,7 @@ def mousePressEvent(self, event): # Change the view in the main window to the clicked position self.parent().center_view_on_position(normalized_x, normalized_y) + class ViewBoxNoRightDrag(pg.ViewBox): def __init__(self, parent=None, border=None, lockAspect=False, enableMouse=True,