Commit def86810264ba212dac05d89e24a42446a6bdabd

Authored by tatiana
1 parent 5fe4b34c

FIX: Create new project but / mask visibility related

invesalius/control.py
... ... @@ -317,8 +317,6 @@ class Controller():
317 317 def LoadProject(self):
318 318 proj = prj.Project()
319 319  
320   - mask_index = len(proj.mask_dict) -1
321   -
322 320 const.THRESHOLD_OUTVALUE = proj.threshold_range[0]
323 321 const.THRESHOLD_INVALUE = proj.threshold_range[1]
324 322 const.WINDOW_LEVEL[_('Default')] = (proj.window, proj.level)
... ... @@ -339,7 +337,9 @@ class Controller():
339 337 ps.Publisher().sendMessage('Show content panel')
340 338 ps.Publisher().sendMessage('Update AUI')
341 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 343 ps.Publisher().sendMessage('End busy cursor')
344 344  
345 345 def CreateAnalyzeProject(self, imagedata):
... ...
invesalius/data/slice_.py
... ... @@ -338,7 +338,7 @@ class Slice(object):
338 338 # This condition is not necessary in Linux, only under mac and windows
339 339 # because combobox event is binded when the same item is selected again.
340 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 342 proj = Project()
343 343 future_mask = proj.GetMask(index)
344 344 future_mask.is_shown = True
... ...
invesalius/gui/data_notebook.py
... ... @@ -96,7 +96,11 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin):
96 96 def OnChangeCurrentMask(self, pubsub_evt):
97 97  
98 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 104 for key in self.mask_list_index.keys():
101 105 if key != mask_index:
102 106 self.SetItemImage(key, 0)
... ...