Commit def86810264ba212dac05d89e24a42446a6bdabd
1 parent
5fe4b34c
Exists in
master
and in
68 other branches
FIX: Create new project but / mask visibility related
Showing
3 changed files
with
9 additions
and
5 deletions
Show diff stats
invesalius/control.py
@@ -317,8 +317,6 @@ class Controller(): | @@ -317,8 +317,6 @@ class Controller(): | ||
317 | def LoadProject(self): | 317 | def LoadProject(self): |
318 | proj = prj.Project() | 318 | proj = prj.Project() |
319 | 319 | ||
320 | - mask_index = len(proj.mask_dict) -1 | ||
321 | - | ||
322 | const.THRESHOLD_OUTVALUE = proj.threshold_range[0] | 320 | const.THRESHOLD_OUTVALUE = proj.threshold_range[0] |
323 | const.THRESHOLD_INVALUE = proj.threshold_range[1] | 321 | const.THRESHOLD_INVALUE = proj.threshold_range[1] |
324 | const.WINDOW_LEVEL[_('Default')] = (proj.window, proj.level) | 322 | const.WINDOW_LEVEL[_('Default')] = (proj.window, proj.level) |
@@ -339,7 +337,9 @@ class Controller(): | @@ -339,7 +337,9 @@ class Controller(): | ||
339 | ps.Publisher().sendMessage('Show content panel') | 337 | ps.Publisher().sendMessage('Show content panel') |
340 | ps.Publisher().sendMessage('Update AUI') | 338 | ps.Publisher().sendMessage('Update AUI') |
341 | ps.Publisher().sendMessage('Load slice plane') | 339 | ps.Publisher().sendMessage('Load slice plane') |
342 | - ps.Publisher().sendMessage('Change mask selected', mask_index) | 340 | + if len(proj.mask_dict): |
341 | + mask_index = len(proj.mask_dict) -1 | ||
342 | + ps.Publisher().sendMessage('Show mask', (mask_index, True)) | ||
343 | ps.Publisher().sendMessage('End busy cursor') | 343 | ps.Publisher().sendMessage('End busy cursor') |
344 | 344 | ||
345 | def CreateAnalyzeProject(self, imagedata): | 345 | def CreateAnalyzeProject(self, imagedata): |
invesalius/data/slice_.py
@@ -338,7 +338,7 @@ class Slice(object): | @@ -338,7 +338,7 @@ class Slice(object): | ||
338 | # This condition is not necessary in Linux, only under mac and windows | 338 | # This condition is not necessary in Linux, only under mac and windows |
339 | # because combobox event is binded when the same item is selected again. | 339 | # because combobox event is binded when the same item is selected again. |
340 | #if index != self.current_mask.index: | 340 | #if index != self.current_mask.index: |
341 | - if self.current_mask and self.blend_filter: | 341 | + if self.current_mask and self.blend_filter and index > -1: |
342 | proj = Project() | 342 | proj = Project() |
343 | future_mask = proj.GetMask(index) | 343 | future_mask = proj.GetMask(index) |
344 | future_mask.is_shown = True | 344 | future_mask.is_shown = True |
invesalius/gui/data_notebook.py
@@ -96,7 +96,11 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | @@ -96,7 +96,11 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): | ||
96 | def OnChangeCurrentMask(self, pubsub_evt): | 96 | def OnChangeCurrentMask(self, pubsub_evt): |
97 | 97 | ||
98 | mask_index = pubsub_evt.data | 98 | mask_index = pubsub_evt.data |
99 | - self.SetItemImage(mask_index, 1) | 99 | + try: |
100 | + self.SetItemImage(mask_index, 1) | ||
101 | + except wx._core.PyAssertionError: | ||
102 | + #in SetItem(): invalid item index in SetItem | ||
103 | + pass | ||
100 | for key in self.mask_list_index.keys(): | 104 | for key in self.mask_list_index.keys(): |
101 | if key != mask_index: | 105 | if key != mask_index: |
102 | self.SetItemImage(key, 0) | 106 | self.SetItemImage(key, 0) |