Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close spawned plots on exit #97

Merged
merged 2 commits into from
Sep 22, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")