diff --git a/invesalius/control.py b/invesalius/control.py index a7cbf5c..e5aab88 100755 --- a/invesalius/control.py +++ b/invesalius/control.py @@ -317,8 +317,6 @@ class Controller(): def LoadProject(self): proj = prj.Project() - mask_index = len(proj.mask_dict) -1 - const.THRESHOLD_OUTVALUE = proj.threshold_range[0] const.THRESHOLD_INVALUE = proj.threshold_range[1] const.WINDOW_LEVEL[_('Default')] = (proj.window, proj.level) @@ -339,7 +337,9 @@ class Controller(): ps.Publisher().sendMessage('Show content panel') ps.Publisher().sendMessage('Update AUI') ps.Publisher().sendMessage('Load slice plane') - ps.Publisher().sendMessage('Change mask selected', mask_index) + if len(proj.mask_dict): + mask_index = len(proj.mask_dict) -1 + ps.Publisher().sendMessage('Show mask', (mask_index, True)) ps.Publisher().sendMessage('End busy cursor') def CreateAnalyzeProject(self, imagedata): diff --git a/invesalius/data/slice_.py b/invesalius/data/slice_.py index 7921f50..7b24943 100644 --- a/invesalius/data/slice_.py +++ b/invesalius/data/slice_.py @@ -338,7 +338,7 @@ class Slice(object): # This condition is not necessary in Linux, only under mac and windows # because combobox event is binded when the same item is selected again. #if index != self.current_mask.index: - if self.current_mask and self.blend_filter: + if self.current_mask and self.blend_filter and index > -1: proj = Project() future_mask = proj.GetMask(index) future_mask.is_shown = True diff --git a/invesalius/gui/data_notebook.py b/invesalius/gui/data_notebook.py index 82a8d4c..4090445 100644 --- a/invesalius/gui/data_notebook.py +++ b/invesalius/gui/data_notebook.py @@ -96,7 +96,11 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): def OnChangeCurrentMask(self, pubsub_evt): mask_index = pubsub_evt.data - self.SetItemImage(mask_index, 1) + try: + self.SetItemImage(mask_index, 1) + except wx._core.PyAssertionError: + #in SetItem(): invalid item index in SetItem + pass for key in self.mask_list_index.keys(): if key != mask_index: self.SetItemImage(key, 0) -- libgit2 0.21.2