Commit 8c6b6414dd5ea8907ab22600aaf8794d0bf87929
1 parent
d8df5d57
Exists in
master
and in
68 other branches
ENH: Hidding the cursor when the user leave the interactor
Showing
1 changed file
with
8 additions
and
8 deletions
Show diff stats
invesalius/data/viewer_slice.py
| ... | ... | @@ -113,6 +113,7 @@ class Viewer(wx.Panel): |
| 113 | 113 | "MouseMoveEvent": self.OnBrushMove, |
| 114 | 114 | "LeftButtonPressEvent": self.OnBrushClick, |
| 115 | 115 | "LeftButtonReleaseEvent": self.OnMouseRelease, |
| 116 | + "LeaveEvent": self.OnLeaveInteractor | |
| 116 | 117 | } |
| 117 | 118 | } |
| 118 | 119 | |
| ... | ... | @@ -129,8 +130,10 @@ class Viewer(wx.Panel): |
| 129 | 130 | style.AddObserver(event, |
| 130 | 131 | action[mode][event]) |
| 131 | 132 | |
| 132 | - def OnEnter(self, obj, evt): | |
| 133 | - print "Entrei" | |
| 133 | + def OnLeaveInteractor(self, obj, evt): | |
| 134 | + for slice_data in self.slice_data_list: | |
| 135 | + slice_data.cursor.Show(0) | |
| 136 | + self.interactor.Render() | |
| 134 | 137 | |
| 135 | 138 | def ChangeBrushSize(self, pubsub_evt): |
| 136 | 139 | size = pubsub_evt.data |
| ... | ... | @@ -219,11 +222,7 @@ class Viewer(wx.Panel): |
| 219 | 222 | slice_data = self.get_slice_data(render) |
| 220 | 223 | |
| 221 | 224 | # TODO: Improve! |
| 222 | - for i in self.slice_data_list: | |
| 223 | - if i is slice_data: | |
| 224 | - i.cursor.Show() | |
| 225 | - else: | |
| 226 | - i.cursor.Show(0) | |
| 225 | + slice_data.cursor.Show() | |
| 227 | 226 | |
| 228 | 227 | self.pick.Pick(mouse_x, mouse_y, 0, render) |
| 229 | 228 | coord = self.get_coordinate_cursor() |
| ... | ... | @@ -247,6 +246,8 @@ class Viewer(wx.Panel): |
| 247 | 246 | else: |
| 248 | 247 | self.interactor.Render() |
| 249 | 248 | |
| 249 | + slice_data.cursor.Show(0) | |
| 250 | + | |
| 250 | 251 | def OnCrossMove(self, obj, evt_vtk): |
| 251 | 252 | coord = self.get_coordinate() |
| 252 | 253 | # Update position in other slices |
| ... | ... | @@ -489,7 +490,6 @@ class Viewer(wx.Panel): |
| 489 | 490 | slice_data = SliceData() |
| 490 | 491 | slice_data.renderer = renderer |
| 491 | 492 | slice_data.actor = actor |
| 492 | - renderer.AddObserver("EnterEvent", self.OnEnter) | |
| 493 | 493 | return slice_data |
| 494 | 494 | |
| 495 | 495 | def __update_camera(self, slice_data): | ... | ... |