From 835727e33e23f5d9b55187316e3023a9cb5f7706 Mon Sep 17 00:00:00 2001 From: Leo Fang Date: Mon, 5 Aug 2019 13:34:15 -0400 Subject: [PATCH] ensure ROI window is closed during batch processing --- nsls2ptycho/ptycho_gui.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nsls2ptycho/ptycho_gui.py b/nsls2ptycho/ptycho_gui.py index f708f1f..b04f6dc 100644 --- a/nsls2ptycho/ptycho_gui.py +++ b/nsls2ptycho/ptycho_gui.py @@ -1022,9 +1022,10 @@ def _batch_crop(self): eventloop.exec() # then invoke the h5 worker in RoiWindow - if self.roiWindow is None: - img = self._viewDataFrameBroker(0) - self.roiWindow = RoiWindow(image=img, main_window=self) + if self.roiWindow is not None: + self.roiWindow.close() + img = self._viewDataFrameBroker(0) + self.roiWindow = RoiWindow(image=img, main_window=self) #self.roiWindow.roi_changed.connect(self._get_roi_slot) self.roiWindow.canvas._eventHandler.set_curr_roi(self.roiWindow.canvas.ax, (self.sp_batch_x0.value(), self.sp_batch_y0.value()),