Commit 99b12b20d1a1c30def7b5ad2eb98d0d77d94c258

Authored by Paulo Henrique Junqueira Amorim
1 parent c800a6db

FIX: Image plane turned off to open a new project

invesalius/data/viewer_volume.py
... ... @@ -127,13 +127,17 @@ class Viewer(wx.Panel):
127 127 ps.Publisher().subscribe(self.OnShowText,
128 128 'Show text actors on viewers')
129 129 ps.Publisher().subscribe(self.OnCloseProject, 'Close project data')
130   -
  130 +
  131 +
131 132 def OnCloseProject(self, pubsub_evt):
132 133 if self.raycasting_volume:
133 134 self.raycasting_volume = False
134 135 if self.slice_plane:
135 136 self.slice_plane.Disable()
136   - #slice_plane_...SetInteractor(self.interactor._Iren)
  137 + self.slice_plane.DeletePlanes()
  138 + del self.slice_plane
  139 + ps.Publisher().sendMessage('Uncheck image plane menu')
  140 +
137 141 self.mouse_pressed = 0
138 142 self.on_wl = False
139 143  
... ... @@ -715,6 +719,11 @@ class SlicePlane:
715 719 self.plane_z.SetPlaneOrientationToZAxes()
716 720 self.plane_z.SetSliceIndex(number)
717 721  
  722 + def DeletePlanes(self):
  723 + del self.plane_x
  724 + del self.plane_y
  725 + del self.plane_z
  726 +
718 727 def PointId(self, evt, obj):
719 728 #TODO: add in the code
720 729 # picker = vtk.vtkPointPicker()
... ... @@ -723,4 +732,3 @@ class SlicePlane:
723 732 x,y = evt.GetLastEventPosition()
724 733 self.picker.Pick(x, y, 0, self.ren1)
725 734 point_id = self.picker.GetPointId()
726   -
... ...
invesalius/gui/default_viewers.py
... ... @@ -391,7 +391,8 @@ class VolumeToolPanel(wx.Panel):
391 391 ps.Publisher().subscribe(self.ChangeButtonColour,
392 392 'Change volume viewer gui colour')
393 393 ps.Publisher().subscribe(self.DisablePreset, 'Close project data')
394   -
  394 + ps.Publisher().subscribe(self.Uncheck, 'Uncheck image plane menu')
  395 +
395 396 def DisablePreset(self, pubsub_evt):
396 397 self.off_item.Check(1)
397 398  
... ... @@ -499,7 +500,11 @@ class VolumeToolPanel(wx.Panel):
499 500 else:
500 501 ps.Publisher().sendMessage('Enable plane', label)
501 502  
502   -
  503 + def Uncheck(self, pubsub_evt):
  504 + for item in self.slice_plane_menu.GetMenuItems():
  505 + if (item.IsChecked()):
  506 + item.Check(0)
  507 +
503 508 def ChangeButtonColour(self, pubsub_evt):
504 509 colour = [i*255 for i in pubsub_evt.data]
505 510 self.button_colour.SetColour(colour)
... ...