mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-19 11:27:45 +08:00
BUG: reset image when plugin is closed.
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user