From 36b0fbd84e86c6bca62ce435d4c87906ca93b721 Mon Sep 17 00:00:00 2001 From: Tony S Yu Date: Mon, 23 Jul 2012 01:22:05 -0400 Subject: [PATCH] Rename (dis)connect_event to (dis)connect_image_events. This clarifies action since these events are on the image viewer, not the plugin. --- skimage/viewer/plugins/base.py | 14 +++++++------- skimage/viewer/plugins/lineprofile.py | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/skimage/viewer/plugins/base.py b/skimage/viewer/plugins/base.py index 5a626480..fd7cb005 100644 --- a/skimage/viewer/plugins/base.py +++ b/skimage/viewer/plugins/base.py @@ -69,7 +69,7 @@ class Plugin(QtGui.QDialog): self.arguments.append(self.image_viewer.original_image) if self.draws_on_image: - self.connect_event('draw_event', self.on_draw) + self.connect_image_event('draw_event', self.on_draw) def on_draw(self, event): """Save image background when blitting. @@ -108,17 +108,17 @@ class Plugin(QtGui.QDialog): def closeEvent(self, event): """Disconnect all artists and events from ImageViewer. - Note that events must be connected using `self.connect_event` and + Note that events must be connected using `self.connect_image_event` and artists must be appended to `self.artists`. """ self.disconnect_image_events() - self.remove_artists() + self.remove_image_artists() self.image_viewer.plugins.remove(self) self.image_viewer.redraw() self.close() - def connect_event(self, event, callback): - """Connect callback with an event. + def connect_image_event(self, event, callback): + """Connect callback with an event in the image viewer. This should be used in lieu of `figure.canvas.mpl_connect` since this function stores call back ids for later clean up. @@ -138,7 +138,7 @@ class Plugin(QtGui.QDialog): for c in self.cids: self.image_viewer.disconnect_event(c) - def remove_artists(self): - """Disconnect artists that are connected to the *image plot*.""" + def remove_image_artists(self): + """Disconnect artists that are connected to the image viewer.""" for a in self.artists: self.image_viewer.remove_artist(a) diff --git a/skimage/viewer/plugins/lineprofile.py b/skimage/viewer/plugins/lineprofile.py index 7b2e1c10..5afe78f4 100644 --- a/skimage/viewer/plugins/lineprofile.py +++ b/skimage/viewer/plugins/lineprofile.py @@ -72,11 +72,11 @@ class LineProfile(PlotPlugin): self.profile = self.ax.plot(scan_data, 'k-')[0] self._autoscale_view() - self.connect_event('key_press_event', self.on_key_press) - self.connect_event('button_press_event', self.on_mouse_press) - self.connect_event('button_release_event', self.on_mouse_release) - self.connect_event('motion_notify_event', self.on_move) - self.connect_event('scroll_event', self.on_scroll) + self.connect_image_event('key_press_event', self.on_key_press) + self.connect_image_event('button_press_event', self.on_mouse_press) + self.connect_image_event('button_release_event', self.on_mouse_release) + self.connect_image_event('motion_notify_event', self.on_move) + self.connect_image_event('scroll_event', self.on_scroll) self.image_viewer.redraw()