Commit 076803898a6fd3f5475df23851f4d47f1b952ec8
1 parent
6caea613
Exists in
master
and in
6 other branches
Added method to remove actual style
Showing
3 changed files
with
18 additions
and
3 deletions
Show diff stats
invesalius/data/slice_.py
| ... | ... | @@ -184,6 +184,7 @@ class Slice(object): |
| 184 | 184 | |
| 185 | 185 | Publisher.subscribe(self.OnEnableStyle, 'Enable style') |
| 186 | 186 | Publisher.subscribe(self.OnDisableStyle, 'Disable style') |
| 187 | + Publisher.subscribe(self.OnDisableActualStyle, 'Disable actual style') | |
| 187 | 188 | |
| 188 | 189 | Publisher.subscribe(self.OnRemoveMasks, 'Remove masks') |
| 189 | 190 | Publisher.subscribe(self.OnDuplicateMasks, 'Duplicate masks') |
| ... | ... | @@ -263,6 +264,16 @@ class Slice(object): |
| 263 | 264 | Publisher.sendMessage('Set interactor default cursor') |
| 264 | 265 | self.state = new_state |
| 265 | 266 | |
| 267 | + def OnDisableActualStyle(self, pubsub_evt): | |
| 268 | + actual_state = self.interaction_style.GetActualState() | |
| 269 | + if actual_state != const.STATE_DEFAULT: | |
| 270 | + new_state = self.interaction_style.RemoveState(actual_state) | |
| 271 | + Publisher.sendMessage('Set slice interaction style', new_state) | |
| 272 | + | |
| 273 | + # if (actual_state == const.SLICE_STATE_EDITOR): | |
| 274 | + # Publisher.sendMessage('Set interactor default cursor') | |
| 275 | + self.state = new_state | |
| 276 | + | |
| 266 | 277 | def OnCloseProject(self, pubsub_evt): |
| 267 | 278 | self.CloseProject() |
| 268 | 279 | ... | ... |
invesalius/gui/frame.py
| ... | ... | @@ -451,15 +451,17 @@ class Frame(wx.Frame): |
| 451 | 451 | |
| 452 | 452 | elif id == const.ID_THRESHOLD_SEGMENTATION: |
| 453 | 453 | Publisher.sendMessage("Show panel", const.ID_THRESHOLD_SEGMENTATION) |
| 454 | + Publisher.sendMessage('Disable actual style') | |
| 454 | 455 | Publisher.sendMessage('Enable style', const.STATE_DEFAULT) |
| 455 | 456 | |
| 456 | 457 | elif id == const.ID_MANUAL_SEGMENTATION: |
| 457 | 458 | Publisher.sendMessage("Show panel", const.ID_MANUAL_SEGMENTATION) |
| 459 | + Publisher.sendMessage('Disable actual style') | |
| 458 | 460 | Publisher.sendMessage('Enable style', const.SLICE_STATE_EDITOR) |
| 459 | 461 | |
| 460 | 462 | elif id == const.ID_WATERSHED_SEGMENTATION: |
| 461 | 463 | Publisher.sendMessage("Show panel", const.ID_WATERSHED_SEGMENTATION) |
| 462 | - # Publisher.sendMessage('Disable actual style') | |
| 464 | + Publisher.sendMessage('Disable actual style') | |
| 463 | 465 | Publisher.sendMessage('Enable style', const.SLICE_STATE_WATERSHED) |
| 464 | 466 | |
| 465 | 467 | elif id == const.ID_FLOODFILL_MASK: | ... | ... |
invesalius/style.py
| ... | ... | @@ -110,6 +110,8 @@ class StyleStateManager(object): |
| 110 | 110 | max_level = max(self.stack.keys()) |
| 111 | 111 | return self.stack[max_level] |
| 112 | 112 | |
| 113 | - def RemoveActualState(self): | |
| 113 | + def GetActualState(self): | |
| 114 | + print self.stack.keys() | |
| 114 | 115 | max_level = max(self.stack.keys()) |
| 115 | - return self.stack.pop(max_level) | |
| 116 | + state = self.stack[max_level] | |
| 117 | + return state | ... | ... |