diff --git a/invesalius/control.py b/invesalius/control.py index 1d3201d..a21b510 100755 --- a/invesalius/control.py +++ b/invesalius/control.py @@ -240,7 +240,6 @@ class Controller(): ps.Publisher().sendMessage('Hide content panel') ps.Publisher().sendMessage('Close project data') - session = ses.Session() session.CloseProject() @@ -432,8 +431,12 @@ class Controller(): ps.Publisher().sendMessage('Set threshold modes', (thresh_modes,default_threshold)) - def LoadRaycastingPreset(self, pubsub_evt): - label = pubsub_evt.data + def LoadRaycastingPreset(self, pubsub_evt=None): + if pubsub_evt: + label = pubsub_evt.data + else: + return + if label != const.RAYCASTING_OFF_LABEL: if label in const.RAYCASTING_FILES.keys(): path = os.path.join(const.RAYCASTING_PRESETS_DIRECTORY, diff --git a/invesalius/data/viewer_volume.py b/invesalius/data/viewer_volume.py index be84fa3..8718060 100755 --- a/invesalius/data/viewer_volume.py +++ b/invesalius/data/viewer_volume.py @@ -72,6 +72,9 @@ class Viewer(wx.Panel): self.text.SetValue("") self.ren.AddActor(self.text.actor) + + self.slice_plane = None + self.view_angle = None self.__bind_events() @@ -123,7 +126,16 @@ class Viewer(wx.Panel): ps.Publisher().subscribe(self.OnShowText, 'Show text actors on viewers') + ps.Publisher().subscribe(self.OnCloseProject, 'Close project data') + def OnCloseProject(self, pubsub_evt): + if self.raycasting_volume: + self.raycasting_volume = False + if self.slice_plane: + self.Disable() + self.mouse_pressed = 0 + self.on_wl = False + def OnHideText(self, pubsub_evt): self.text.Hide() diff --git a/invesalius/data/volume.py b/invesalius/data/volume.py index bf6b4d9..c664c6e 100755 --- a/invesalius/data/volume.py +++ b/invesalius/data/volume.py @@ -81,7 +81,7 @@ class Volume(): self.curve = 0 self.plane = None self.plane_on = False - + self.volume = None self.__bind_events() def __bind_events(self): @@ -99,6 +99,21 @@ class Volume(): 'Set raycasting relative window and level') ps.Publisher().subscribe(self.OnEnableTool, 'Enable raycasting tool') + ps.Publisher().subscribe(self.OnCloseProject, 'Close project data') + + def OnCloseProject(self, pubsub_evt): + self.CloseProject() + + + def CloseProject(self): + + if self.plane: + self.plane = None + ps.Publisher().sendMessage('Remove surface actor from viewer', self.plane_actor) + if self.exist: + self.exist = None + ps.Publisher().sendMessage('Remove surface actor from viewer', self.volume) + def OnLoadVolume(self, pubsub_evt): label = pubsub_evt.data -- libgit2 0.21.2