Add on_scroll behavior and allow line to change width.

This commit is contained in:
Steven Silvester
2014-09-01 10:28:28 -05:00
parent 7864adbc0c
commit 1740392110
2 changed files with 7 additions and 0 deletions
+1
View File
@@ -75,6 +75,7 @@ class LineTool(CanvasToolBase):
self._line.set_data(np.transpose(pts))
self._handles.set_data(np.transpose(pts))
self._line.set_linewidth(self.linewidth)
self.set_visible(True)
self.redraw()
+6
View File
@@ -83,6 +83,7 @@ class EventManager(object):
self.connect_event('key_press_event', self.on_key_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.tools = []
self.active_tool = None
@@ -128,6 +129,11 @@ class EventManager(object):
if not tool is None:
tool.on_move(event)
def on_scroll(self, event):
tool = self._get_tool(event)
if not tool is None:
tool.on_scroll(event)
class ImageViewer(QtGui.QMainWindow):
"""Viewer for displaying images.