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