Commit fff5ce91f82c861b62d06440f6468a91237fd7da
1 parent
51a15bf1
Exists in
master
and in
68 other branches
FIX: Using absolute path to indicate the icons on raycasting toolbar
Showing
2 changed files
with
26 additions
and
9 deletions
Show diff stats
invesalius/constants.py
... | ... | @@ -164,6 +164,16 @@ WINDOW_LEVEL = {"Abdomen":(350,50), |
164 | 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 | 177 | # if 1, use vtkVolumeRaycastMapper, if 0, use vtkFixedPointVolumeRayCastMapper |
168 | 178 | TYPE_RAYCASTING_MAPPER = 0 |
169 | 179 | ... | ... |
invesalius/gui/default_viewers.py
... | ... | @@ -31,6 +31,8 @@ from gui.widgets.clut_raycasting import CLUTRaycastingWidget, \ |
31 | 31 | EVT_CLUT_POINT_RELEASE, EVT_CLUT_CURVE_SELECT, \ |
32 | 32 | EVT_CLUT_CURVE_WL_CHANGE |
33 | 33 | |
34 | +from constants import ID_TO_BMP | |
35 | + | |
34 | 36 | class Panel(wx.Panel): |
35 | 37 | def __init__(self, parent): |
36 | 38 | wx.Panel.__init__(self, parent, pos=wx.Point(0, 50), |
... | ... | @@ -304,15 +306,6 @@ import constants as const |
304 | 306 | [BUTTON_RAYCASTING, BUTTON_VIEW, BUTTON_SLICE_PLANE] = [wx.NewId() for num in xrange(3)] |
305 | 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 | 309 | ID_TO_NAME = {} |
317 | 310 | ID_TO_TOOL = {} |
318 | 311 | ID_TO_TOOL_ITEM = {} |
... | ... | @@ -379,12 +372,16 @@ class VolumeToolPanel(wx.Panel): |
379 | 372 | button_colour.Bind(csel.EVT_COLOURSELECT, self.OnSelectColour) |
380 | 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 | 378 | # SIZER TO ORGANIZE ALL |
383 | 379 | sizer = wx.BoxSizer(wx.VERTICAL) |
384 | 380 | sizer.Add(button_colour, 0, wx.ALL, sp) |
385 | 381 | sizer.Add(button_raycasting, 0, wx.TOP|wx.BOTTOM, 1) |
386 | 382 | sizer.Add(button_view, 0, wx.TOP|wx.BOTTOM, 1) |
387 | 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 | 386 | sizer.Fit(self) |
390 | 387 | |
... | ... | @@ -395,11 +392,14 @@ class VolumeToolPanel(wx.Panel): |
395 | 392 | |
396 | 393 | self.__init_menus() |
397 | 394 | self.__bind_events() |
395 | + self.__bind_events_wx() | |
398 | 396 | |
399 | 397 | def __bind_events(self): |
400 | 398 | ps.Publisher().subscribe(self.ChangeButtonColour, |
401 | 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 | 404 | def OnButtonRaycasting(self, evt): |
405 | 405 | # MENU RELATED TO RAYCASTING TYPES |
... | ... | @@ -411,6 +411,13 @@ class VolumeToolPanel(wx.Panel): |
411 | 411 | def OnButtonSlicePlane(self, evt): |
412 | 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 | 421 | def __init_menus(self, pubsub_evt=None): |
415 | 422 | # MENU RELATED TO RAYCASTING TYPES |
416 | 423 | menu = wx.Menu() | ... | ... |