BUG: reset image when plugin is closed.

This commit is contained in:
Tony S Yu
2012-08-03 22:21:59 -04:00
parent 4ab583ba31
commit 398b320477
2 changed files with 5 additions and 1 deletions
+1
View File
@@ -200,6 +200,7 @@ class Plugin(QtGui.QDialog):
self.disconnect_image_events()
self.remove_image_artists()
self.image_viewer.plugins.remove(self)
self.image_viewer.reset_image()
self.image_viewer.redraw()
self.close()
+4 -1
View File
@@ -76,7 +76,7 @@ class ImageViewer(QtGui.QMainWindow):
self._image_plot = self.ax.images[0]
self.original_image = image
self.image = image
self.image = image.copy()
self.plugins = []
# List of axes artists to check for removal.
@@ -141,6 +141,9 @@ class ImageViewer(QtGui.QMainWindow):
self._image_plot.set_array(image)
self.redraw()
def reset_image(self):
self.image = self.original_image.copy()
def connect_event(self, event, callback):
"""Connect callback function to matplotlib event and return id."""
cid = self.canvas.mpl_connect(event, callback)