Skip to content

Commit

Permalink
Merge pull request #97 from mantidproject/84_close_plots_on_exit
Browse files Browse the repository at this point in the history
Close spawned plots on exit
  • Loading branch information
martyngigg committed Sep 22, 2017
2 parents 40e7e3b + f418f36 commit 7568b16
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions mantidimaging/gui/main_window/mw_view.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from __future__ import absolute_import, division, print_function

import matplotlib

from logging import getLogger
from PyQt5 import Qt, QtCore
from PyQt5 import Qt, QtCore, QtWidgets

from mantidimaging.core.algorithms import gui_compile_ui
Expand Down Expand Up @@ -51,7 +52,8 @@ def show_save_dialogue(self):
self.save_dialogue.show()

def stack_names(self):
# unpacks the tuple and only gives the correctly sorted human readable names
# unpacks the tuple and only gives the correctly sorted human readable
# names
return self.presenter.stack_names()

def stack_list(self):
Expand Down Expand Up @@ -84,12 +86,13 @@ def create_stack_window(self,
return dock_widget

def remove_stack(self, obj):
getLogger(__name__).debug("Removing stack with uuid {}".format(obj.uuid))
getLogger(__name__).debug("Removing stack with uuid %s", obj.uuid)
self.presenter.remove_stack(obj.uuid)

def algorithm_accepted(self, stack_uuid, algorithm_dialog):
"""
We forward the data onwards to the presenter and then the model, so that we can have a passive view.
We forward the data onwards to the presenter and then the model, so
that we can have a passive view.
:param stack_uuid: The unique ID of the stack
Expand All @@ -104,3 +107,12 @@ def show_error_dialog(self, msg=""):
:param msg: Error message string
"""
QtWidgets.QMessageBox.critical(self, "Error", msg)

def closeEvent(self, event):
"""
Close all matplotlib PyPlot windows when exiting.
:param event: Unused
"""
getLogger(__name__).debug("Closing all PyPlot windows")
matplotlib.pyplot.close("all")

0 comments on commit 7568b16

Please sign in to comment.