Commit fff5ce91f82c861b62d06440f6468a91237fd7da

Authored by tfmoraes
1 parent 51a15bf1

FIX: Using absolute path to indicate the icons on raycasting toolbar

invesalius/constants.py
@@ -164,6 +164,16 @@ WINDOW_LEVEL = {"Abdomen":(350,50), @@ -164,6 +164,16 @@ WINDOW_LEVEL = {"Abdomen":(350,50),
164 REDUCE_IMAGEDATA_QUALITY = 1 164 REDUCE_IMAGEDATA_QUALITY = 1
165 165
166 166
  167 +ICON_DIR = os.path.abspath(os.path.join('..', 'icons'))
  168 +ID_TO_BMP = {VOL_FRONT: ["Front", os.path.join(ICON_DIR, "view_front.png")],
  169 + VOL_BACK: ["Back", os.path.join(ICON_DIR, "view_back.png")],
  170 + VOL_TOP: ["Top", os.path.join(ICON_DIR, "view_top.png")],
  171 + VOL_BOTTOM: ["Bottom", os.path.join(ICON_DIR, "view_bottom.png")],
  172 + VOL_RIGHT: ["Right", os.path.join(ICON_DIR, "view_right.png")],
  173 + VOL_LEFT: ["Left", os.path.join(ICON_DIR, "view_left.png")],
  174 + VOL_ISO:["Isometric", os.path.join(ICON_DIR,"view_isometric.png")]
  175 + }
  176 +
167 # if 1, use vtkVolumeRaycastMapper, if 0, use vtkFixedPointVolumeRayCastMapper 177 # if 1, use vtkVolumeRaycastMapper, if 0, use vtkFixedPointVolumeRayCastMapper
168 TYPE_RAYCASTING_MAPPER = 0 178 TYPE_RAYCASTING_MAPPER = 0
169 179
invesalius/gui/default_viewers.py
@@ -31,6 +31,8 @@ from gui.widgets.clut_raycasting import CLUTRaycastingWidget, \ @@ -31,6 +31,8 @@ from gui.widgets.clut_raycasting import CLUTRaycastingWidget, \
31 EVT_CLUT_POINT_RELEASE, EVT_CLUT_CURVE_SELECT, \ 31 EVT_CLUT_POINT_RELEASE, EVT_CLUT_CURVE_SELECT, \
32 EVT_CLUT_CURVE_WL_CHANGE 32 EVT_CLUT_CURVE_WL_CHANGE
33 33
  34 +from constants import ID_TO_BMP
  35 +
34 class Panel(wx.Panel): 36 class Panel(wx.Panel):
35 def __init__(self, parent): 37 def __init__(self, parent):
36 wx.Panel.__init__(self, parent, pos=wx.Point(0, 50), 38 wx.Panel.__init__(self, parent, pos=wx.Point(0, 50),
@@ -304,15 +306,6 @@ import constants as const @@ -304,15 +306,6 @@ import constants as const
304 [BUTTON_RAYCASTING, BUTTON_VIEW, BUTTON_SLICE_PLANE] = [wx.NewId() for num in xrange(3)] 306 [BUTTON_RAYCASTING, BUTTON_VIEW, BUTTON_SLICE_PLANE] = [wx.NewId() for num in xrange(3)]
305 RAYCASTING_TOOLS = wx.NewId() 307 RAYCASTING_TOOLS = wx.NewId()
306 308
307 -ID_TO_BMP = {const.VOL_FRONT: ["Front", "../icons/view_front.png"],  
308 - const.VOL_BACK: ["Back", "../icons/view_back.png"],  
309 - const.VOL_TOP: ["Top", "../icons/view_top.png"],  
310 - const.VOL_BOTTOM: ["Bottom", "../icons/view_bottom.png"],  
311 - const.VOL_RIGHT: ["Right", "../icons/view_right.png"],  
312 - const.VOL_LEFT: ["Left", "../icons/view_left.png"],  
313 - const.VOL_ISO:["Isometric","../icons/view_isometric.png"]  
314 - }  
315 -  
316 ID_TO_NAME = {} 309 ID_TO_NAME = {}
317 ID_TO_TOOL = {} 310 ID_TO_TOOL = {}
318 ID_TO_TOOL_ITEM = {} 311 ID_TO_TOOL_ITEM = {}
@@ -379,12 +372,16 @@ class VolumeToolPanel(wx.Panel): @@ -379,12 +372,16 @@ class VolumeToolPanel(wx.Panel):
379 button_colour.Bind(csel.EVT_COLOURSELECT, self.OnSelectColour) 372 button_colour.Bind(csel.EVT_COLOURSELECT, self.OnSelectColour)
380 self.button_colour = button_colour 373 self.button_colour = button_colour
381 374
  375 + save_preset = wx.Button(self, -1, "S", size=size)
  376 + self.save_preset = save_preset
  377 +
382 # SIZER TO ORGANIZE ALL 378 # SIZER TO ORGANIZE ALL
383 sizer = wx.BoxSizer(wx.VERTICAL) 379 sizer = wx.BoxSizer(wx.VERTICAL)
384 sizer.Add(button_colour, 0, wx.ALL, sp) 380 sizer.Add(button_colour, 0, wx.ALL, sp)
385 sizer.Add(button_raycasting, 0, wx.TOP|wx.BOTTOM, 1) 381 sizer.Add(button_raycasting, 0, wx.TOP|wx.BOTTOM, 1)
386 sizer.Add(button_view, 0, wx.TOP|wx.BOTTOM, 1) 382 sizer.Add(button_view, 0, wx.TOP|wx.BOTTOM, 1)
387 sizer.Add(button_slice_plane, 0, wx.TOP|wx.BOTTOM, 1) 383 sizer.Add(button_slice_plane, 0, wx.TOP|wx.BOTTOM, 1)
  384 + sizer.Add(save_preset, 0, wx.TOP|wx.BOTTOM, 1)
388 385
389 sizer.Fit(self) 386 sizer.Fit(self)
390 387
@@ -395,11 +392,14 @@ class VolumeToolPanel(wx.Panel): @@ -395,11 +392,14 @@ class VolumeToolPanel(wx.Panel):
395 392
396 self.__init_menus() 393 self.__init_menus()
397 self.__bind_events() 394 self.__bind_events()
  395 + self.__bind_events_wx()
398 396
399 def __bind_events(self): 397 def __bind_events(self):
400 ps.Publisher().subscribe(self.ChangeButtonColour, 398 ps.Publisher().subscribe(self.ChangeButtonColour,
401 'Change volume viewer gui colour') 399 'Change volume viewer gui colour')
402 400
  401 + def __bind_events_wx(self):
  402 + self.save_preset.Bind(wx.EVT_BUTTON, self.OnSavePreset)
403 403
404 def OnButtonRaycasting(self, evt): 404 def OnButtonRaycasting(self, evt):
405 # MENU RELATED TO RAYCASTING TYPES 405 # MENU RELATED TO RAYCASTING TYPES
@@ -411,6 +411,13 @@ class VolumeToolPanel(wx.Panel): @@ -411,6 +411,13 @@ class VolumeToolPanel(wx.Panel):
411 def OnButtonSlicePlane(self, evt): 411 def OnButtonSlicePlane(self, evt):
412 self.button_slice_plane.PopupMenu(self.slice_plane_menu) 412 self.button_slice_plane.PopupMenu(self.slice_plane_menu)
413 413
  414 + def OnSavePreset(self, evt):
  415 + d = wx.TextEntryDialog(self, "Preset name")
  416 + if d.ShowModal() == wx.ID_OK:
  417 + preset_name = d.GetValue()
  418 + ps.Publisher().sendMessage('Save raycasting preset',
  419 + preset_name)
  420 +
414 def __init_menus(self, pubsub_evt=None): 421 def __init_menus(self, pubsub_evt=None):
415 # MENU RELATED TO RAYCASTING TYPES 422 # MENU RELATED TO RAYCASTING TYPES
416 menu = wx.Menu() 423 menu = wx.Menu()