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