Commit fd9af9765ad832e7ef49a8fa9acb206b3d310cbc
1 parent
2e98f651
Exists in
master
and in
6 other branches
ENC: Changed GUI related to raycasting set/not set and type
Showing
2 changed files
with
18 additions
and
5 deletions
Show diff stats
invesalius/constants.py
invesalius/gui/default_viewers.py
... | ... | @@ -188,6 +188,7 @@ ID_TO_BMP = {const.VOL_FRONT: ["Front", "../icons/view_front.png"], |
188 | 188 | } |
189 | 189 | |
190 | 190 | ID_TO_NAME = {} |
191 | +ID_TO_TOOL = {} | |
191 | 192 | |
192 | 193 | class VolumeViewerCover(wx.Panel): |
193 | 194 | def __init__(self, parent): |
... | ... | @@ -215,6 +216,15 @@ class VolumeToolPanel(wx.Panel): |
215 | 216 | if name == const.RAYCASTING_OFF_LABEL: |
216 | 217 | item.Check(1) |
217 | 218 | ID_TO_NAME[id] = name |
219 | + | |
220 | + menu.AppendSeparator() | |
221 | + submenu = wx.Menu() | |
222 | + for tool in const.RAYCASTING_TOOLS: | |
223 | + id = wx.NewId() | |
224 | + item = wx.MenuItem(submenu, id, name, kind=wx.ITEM_CHECK) | |
225 | + submenu.AppendItem(item) | |
226 | + ID_TO_TOOL[id] = name | |
227 | + | |
218 | 228 | self.menu_raycasting = menu |
219 | 229 | menu.Bind(wx.EVT_MENU, self.OnMenuRaycasting) |
220 | 230 | |
... | ... | @@ -262,11 +272,13 @@ class VolumeToolPanel(wx.Panel): |
262 | 272 | |
263 | 273 | def OnMenuRaycasting(self, evt): |
264 | 274 | """Events from raycasting menu.""" |
265 | - ps.Publisher().sendMessage('Load raycasting preset', | |
266 | - ID_TO_NAME[evt.GetId()]) | |
267 | - # ps.Publisher().sendMessage('Set raycasting preset', None) | |
268 | - # ps.Publisher().sendMessage('Render volume viewer') | |
269 | - | |
275 | + id = evt.GetId() | |
276 | + if id in ID_TO_NAME.keys(): | |
277 | + ps.Publisher().sendMessage('Load raycasting preset', | |
278 | + ID_TO_NAME[evt.GetId()]) | |
279 | + else: | |
280 | + ps.Publisher().sendMessage('Enable raycasting tool', | |
281 | + ID_TO_TOOL(evt.GetId()) | |
270 | 282 | |
271 | 283 | def OnMenuView(self, evt): |
272 | 284 | """Events from button menus.""" | ... | ... |