Commit 6d6bf3025d6d26cc7194b355a8e8ea7ba42dac7c
1 parent
8dd10d55
Exists in
master
and in
6 other branches
ENH: Close project (raycasting), still needs work
Showing
3 changed files
with
34 additions
and
4 deletions
Show diff stats
invesalius/control.py
| ... | ... | @@ -240,7 +240,6 @@ class Controller(): |
| 240 | 240 | |
| 241 | 241 | ps.Publisher().sendMessage('Hide content panel') |
| 242 | 242 | ps.Publisher().sendMessage('Close project data') |
| 243 | - | |
| 244 | 243 | session = ses.Session() |
| 245 | 244 | session.CloseProject() |
| 246 | 245 | |
| ... | ... | @@ -432,8 +431,12 @@ class Controller(): |
| 432 | 431 | ps.Publisher().sendMessage('Set threshold modes', |
| 433 | 432 | (thresh_modes,default_threshold)) |
| 434 | 433 | |
| 435 | - def LoadRaycastingPreset(self, pubsub_evt): | |
| 436 | - label = pubsub_evt.data | |
| 434 | + def LoadRaycastingPreset(self, pubsub_evt=None): | |
| 435 | + if pubsub_evt: | |
| 436 | + label = pubsub_evt.data | |
| 437 | + else: | |
| 438 | + return | |
| 439 | + | |
| 437 | 440 | if label != const.RAYCASTING_OFF_LABEL: |
| 438 | 441 | if label in const.RAYCASTING_FILES.keys(): |
| 439 | 442 | path = os.path.join(const.RAYCASTING_PRESETS_DIRECTORY, | ... | ... |
invesalius/data/viewer_volume.py
| ... | ... | @@ -72,6 +72,9 @@ class Viewer(wx.Panel): |
| 72 | 72 | self.text.SetValue("") |
| 73 | 73 | self.ren.AddActor(self.text.actor) |
| 74 | 74 | |
| 75 | + | |
| 76 | + self.slice_plane = None | |
| 77 | + | |
| 75 | 78 | self.view_angle = None |
| 76 | 79 | |
| 77 | 80 | self.__bind_events() |
| ... | ... | @@ -123,7 +126,16 @@ class Viewer(wx.Panel): |
| 123 | 126 | |
| 124 | 127 | ps.Publisher().subscribe(self.OnShowText, |
| 125 | 128 | 'Show text actors on viewers') |
| 129 | + ps.Publisher().subscribe(self.OnCloseProject, 'Close project data') | |
| 126 | 130 | |
| 131 | + def OnCloseProject(self, pubsub_evt): | |
| 132 | + if self.raycasting_volume: | |
| 133 | + self.raycasting_volume = False | |
| 134 | + if self.slice_plane: | |
| 135 | + self.Disable() | |
| 136 | + self.mouse_pressed = 0 | |
| 137 | + self.on_wl = False | |
| 138 | + | |
| 127 | 139 | |
| 128 | 140 | def OnHideText(self, pubsub_evt): |
| 129 | 141 | self.text.Hide() | ... | ... |
invesalius/data/volume.py
| ... | ... | @@ -81,7 +81,7 @@ class Volume(): |
| 81 | 81 | self.curve = 0 |
| 82 | 82 | self.plane = None |
| 83 | 83 | self.plane_on = False |
| 84 | - | |
| 84 | + self.volume = None | |
| 85 | 85 | self.__bind_events() |
| 86 | 86 | |
| 87 | 87 | def __bind_events(self): |
| ... | ... | @@ -99,6 +99,21 @@ class Volume(): |
| 99 | 99 | 'Set raycasting relative window and level') |
| 100 | 100 | ps.Publisher().subscribe(self.OnEnableTool, |
| 101 | 101 | 'Enable raycasting tool') |
| 102 | + ps.Publisher().subscribe(self.OnCloseProject, 'Close project data') | |
| 103 | + | |
| 104 | + def OnCloseProject(self, pubsub_evt): | |
| 105 | + self.CloseProject() | |
| 106 | + | |
| 107 | + | |
| 108 | + def CloseProject(self): | |
| 109 | + | |
| 110 | + if self.plane: | |
| 111 | + self.plane = None | |
| 112 | + ps.Publisher().sendMessage('Remove surface actor from viewer', self.plane_actor) | |
| 113 | + if self.exist: | |
| 114 | + self.exist = None | |
| 115 | + ps.Publisher().sendMessage('Remove surface actor from viewer', self.volume) | |
| 116 | + | |
| 102 | 117 | |
| 103 | 118 | def OnLoadVolume(self, pubsub_evt): |
| 104 | 119 | label = pubsub_evt.data | ... | ... |