Skip to content

Commit

Permalink
simplify closeEvent of LV windows and LV in MainWindow
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeSullivan7 committed Nov 18, 2024
1 parent 49c4cb4 commit 5a699ba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 2 additions & 5 deletions mantidimaging/gui/windows/live_viewer/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,8 @@ def set_image_index(self, index: int) -> None:

def closeEvent(self, e) -> None:
"""Close the window and remove it from the main window list"""
for live_viewer in self.main_window.live_viewer_list:
if live_viewer.path == self.path:
if live_viewer.presenter:
live_viewer.presenter.close()
live_viewer.close()
self.main_window.live_viewer_list.remove(self)
self.presenter.close()
self.live_viewer.handle_deleted()
super().closeEvent(e)
self.presenter = None # type: ignore # View instance to be destroyed -type can be inconsistent
Expand Down
7 changes: 4 additions & 3 deletions mantidimaging/gui/windows/main/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,8 @@ def live_view_choose_directory(self) -> None:
def show_live_viewer(self, live_data_path: Path) -> None:
live_viewer = LiveViewerWindowView(self, live_data_path)
self.live_viewer_list.append(live_viewer)
self.live_viewer_list[-1].activateWindow()
self.live_viewer_list[-1].raise_()
# self.live_viewer_list[-1].activateWindow()
# self.live_viewer_list[-1].raise_()
self.live_viewer_list[-1].show()

@property
Expand Down Expand Up @@ -562,7 +562,8 @@ def closeEvent(self, event) -> None:
if self.recon:
self.recon.close()
if self.live_viewer_list:
[live_viewer.close() for live_viewer in self.live_viewer_list]
while self.live_viewer_list:
self.live_viewer_list[-1].close()
if self.spectrum_viewer:
self.spectrum_viewer.close()
if self.filters:
Expand Down

0 comments on commit 5a699ba

Please sign in to comment.