Commit 82dc48551faa7341883ec43c4d564452630fee10

Authored by Thiago Franco de Moraes
1 parent b18061d2

When user shows the mask the projection normal is selected in the context menu

invesalius/data/slice_.py
... ... @@ -846,6 +846,8 @@ class Slice(object):
846 846 for buffer_ in self.buffer_slices.values():
847 847 buffer_.discard_buffer()
848 848  
  849 + Publisher.sendMessage('Check projection menu', tprojection)
  850 +
849 851 def SetInput(self, imagedata, mask_dict):
850 852 print "SETINPUT!"
851 853 self.imagedata = imagedata
... ...
invesalius/gui/widgets/slice_menu.py
... ... @@ -123,6 +123,7 @@ class SliceMenu(wx.Menu):
123 123 self.pseudo_color_items[new_id] = color_item
124 124  
125 125 # --------------- Sub menu of the projection type ---------------------
  126 + self.projection_items = {}
126 127 submenu_projection = wx.Menu()
127 128 for name in PROJECTIONS_ID:
128 129 new_id = wx.NewId()
... ... @@ -130,6 +131,7 @@ class SliceMenu(wx.Menu):
130 131 kind=wx.ITEM_RADIO)
131 132 submenu_projection.AppendItem(projection_item)
132 133 self.ID_TO_TOOL_ITEM[new_id] = projection_item
  134 + self.projection_items[PROJECTIONS_ID[name]] = projection_item
133 135  
134 136 flag_tiling = False
135 137 #------------ Sub menu of the image tiling ---------------
... ... @@ -167,6 +169,8 @@ class SliceMenu(wx.Menu):
167 169 Publisher.subscribe(self.CheckWindowLevelOther, 'Check window and level other')
168 170 Publisher.subscribe(self.FirstItemSelect, 'Select first item from slice menu')
169 171 Publisher.subscribe(self._close, 'Close project data')
  172 +
  173 + Publisher.subscribe(self._check_projection_menu, 'Check projection menu')
170 174  
171 175 def FirstItemSelect(self, pusub_evt):
172 176 item = self.ID_TO_TOOL_ITEM[self.id_wl_first]
... ... @@ -186,6 +190,11 @@ class SliceMenu(wx.Menu):
186 190 item = self.ID_TO_TOOL_ITEM[self.other_wl_id]
187 191 item.Check()
188 192  
  193 + def _check_projection_menu(self, pubsub_evt):
  194 + p_id = pubsub_evt.data
  195 + item = self.projection_items[p_id]
  196 + item.Check()
  197 +
189 198 def OnPopup(self, evt):
190 199 id = evt.GetId()
191 200 item = self.ID_TO_TOOL_ITEM[evt.GetId()]
... ...