Commit c9bb810eba773c125253acce69f77310b63342e5

Authored by ruppert
1 parent 7d9ae5de

FIX: disable brush when mask is invisible

Showing 1 changed file with 11 additions and 0 deletions   Show diff stats
invesalius/data/viewer_slice.py
@@ -463,6 +463,8 @@ class Viewer(wx.Panel): @@ -463,6 +463,8 @@ class Viewer(wx.Panel):
463 evt.StartSpin() 463 evt.StartSpin()
464 464
465 def OnEnterInteractor(self, evt, obj): 465 def OnEnterInteractor(self, evt, obj):
  466 + if (self.slice_.buffer_slices[self.orientation].mask is None):
  467 + return
466 self.slice_data.cursor.Show() 468 self.slice_data.cursor.Show()
467 self.interactor.SetCursor(wx.StockCursor(wx.CURSOR_BLANK)) 469 self.interactor.SetCursor(wx.StockCursor(wx.CURSOR_BLANK))
468 470
@@ -713,6 +715,9 @@ class Viewer(wx.Panel): @@ -713,6 +715,9 @@ class Viewer(wx.Panel):
713 self.interactor.Render() 715 self.interactor.Render()
714 716
715 def OnBrushClick(self, evt, obj): 717 def OnBrushClick(self, evt, obj):
  718 + if (self.slice_.buffer_slices[self.orientation].mask is None):
  719 + return
  720 +
716 self.__set_editor_cursor_visibility(1) 721 self.__set_editor_cursor_visibility(1)
717 722
718 mouse_x, mouse_y = self.interactor.GetEventPosition() 723 mouse_x, mouse_y = self.interactor.GetEventPosition()
@@ -747,6 +752,9 @@ class Viewer(wx.Panel): @@ -747,6 +752,9 @@ class Viewer(wx.Panel):
747 self.OnScrollBar() 752 self.OnScrollBar()
748 753
749 def OnBrushMove(self, evt, obj): 754 def OnBrushMove(self, evt, obj):
  755 + if (self.slice_.buffer_slices[self.orientation].mask is None):
  756 + return
  757 +
750 self.__set_editor_cursor_visibility(1) 758 self.__set_editor_cursor_visibility(1)
751 759
752 mouse_x, mouse_y = self.interactor.GetEventPosition() 760 mouse_x, mouse_y = self.interactor.GetEventPosition()
@@ -792,6 +800,8 @@ class Viewer(wx.Panel): @@ -792,6 +800,8 @@ class Viewer(wx.Panel):
792 self.interactor.Render() 800 self.interactor.Render()
793 801
794 def OnBrushRelease(self, evt, obj): 802 def OnBrushRelease(self, evt, obj):
  803 + if (self.slice_.buffer_slices[self.orientation].mask is None):
  804 + return
795 self.slice_.apply_slice_buffer_to_mask(self.orientation) 805 self.slice_.apply_slice_buffer_to_mask(self.orientation)
796 self._flush_buffer = False 806 self._flush_buffer = False
797 807
@@ -1179,6 +1189,7 @@ class Viewer(wx.Panel): @@ -1179,6 +1189,7 @@ class Viewer(wx.Panel):
1179 self.slice_data.SetCursor(self.__create_cursor()) 1189 self.slice_data.SetCursor(self.__create_cursor())
1180 self.cam = self.slice_data.renderer.GetActiveCamera() 1190 self.cam = self.slice_data.renderer.GetActiveCamera()
1181 self.__build_cross_lines(imagedata) 1191 self.__build_cross_lines(imagedata)
  1192 + #self.set_slice_number(0)
1182 self.set_slice_number(0) 1193 self.set_slice_number(0)
1183 self.__update_camera() 1194 self.__update_camera()
1184 self.slice_data.renderer.ResetCamera() 1195 self.slice_data.renderer.ResetCamera()