Commit c77c1073cb3d13435ab2f1c430f9c81bf57d390e
1 parent
401a3543
Exists in
master
and in
68 other branches
FIX: Using absolute path to set the icons
Showing
2 changed files
with
63 additions
and
36 deletions
Show diff stats
invesalius/data/viewer_slice.py
@@ -207,7 +207,8 @@ class Viewer(wx.Panel): | @@ -207,7 +207,8 @@ class Viewer(wx.Panel): | ||
207 | print "Zoom" | 207 | print "Zoom" |
208 | self.append_mode('ZOOM') | 208 | self.append_mode('ZOOM') |
209 | self.mouse_pressed = 0 | 209 | self.mouse_pressed = 0 |
210 | - ICON_IMAGE = wx.Image("../icons/tool_zoom.png",wx.BITMAP_TYPE_PNG) | 210 | + ICON_IMAGE = wx.Image(os.path.join(const.ICON_DIR, |
211 | + "tool_zoom.png"),wx.BITMAP_TYPE_PNG) | ||
211 | self.interactor.SetCursor(wx.CursorFromImage(ICON_IMAGE)) | 212 | self.interactor.SetCursor(wx.CursorFromImage(ICON_IMAGE)) |
212 | 213 | ||
213 | def __set_mode_pan(self, pubsub_evt): | 214 | def __set_mode_pan(self, pubsub_evt): |
@@ -217,7 +218,8 @@ class Viewer(wx.Panel): | @@ -217,7 +218,8 @@ class Viewer(wx.Panel): | ||
217 | 218 | ||
218 | def __set_mode_zoom_select(self, pubsub_evt): | 219 | def __set_mode_zoom_select(self, pubsub_evt): |
219 | self.append_mode('ZOOMSELECT') | 220 | self.append_mode('ZOOMSELECT') |
220 | - ICON_IMAGE = wx.Image("../icons/tool_zoom.png",wx.BITMAP_TYPE_PNG) | 221 | + ICON_IMAGE = wx.Image(os.path.join(const.ICON_DIR, |
222 | + "tool_zoom.png"),wx.BITMAP_TYPE_PNG) | ||
221 | self.interactor.SetCursor(wx.CursorFromImage(ICON_IMAGE)) | 223 | self.interactor.SetCursor(wx.CursorFromImage(ICON_IMAGE)) |
222 | 224 | ||
223 | def __set_mode_window_level(self, pubsub_evt): | 225 | def __set_mode_window_level(self, pubsub_evt): |
invesalius/gui/frame.py
@@ -18,6 +18,7 @@ | @@ -18,6 +18,7 @@ | ||
18 | #-------------------------------------------------------------------- | 18 | #-------------------------------------------------------------------- |
19 | 19 | ||
20 | import math | 20 | import math |
21 | +import os.path | ||
21 | import sys | 22 | import sys |
22 | 23 | ||
23 | import wx | 24 | import wx |
@@ -54,7 +55,8 @@ class Frame(wx.Frame): | @@ -54,7 +55,8 @@ class Frame(wx.Frame): | ||
54 | size=wx.Size(1024, 768), #size = wx.DisplaySize(), | 55 | size=wx.Size(1024, 768), #size = wx.DisplaySize(), |
55 | style=wx.DEFAULT_FRAME_STYLE, title='InVesalius 3') | 56 | style=wx.DEFAULT_FRAME_STYLE, title='InVesalius 3') |
56 | self.Center(wx.BOTH) | 57 | self.Center(wx.BOTH) |
57 | - self.SetIcon(wx.Icon("../icons/invesalius.ico", wx.BITMAP_TYPE_ICO)) | 58 | + self.SetIcon(wx.Icon(os.path.join(const.ICON_DIR, "invesalius.ico"), |
59 | + wx.BITMAP_TYPE_ICO)) | ||
58 | 60 | ||
59 | # Set menus, status and task bar | 61 | # Set menus, status and task bar |
60 | self.SetMenuBar(MenuBar(self)) | 62 | self.SetMenuBar(MenuBar(self)) |
@@ -325,7 +327,8 @@ class TaskBarIcon(wx.TaskBarIcon): | @@ -325,7 +327,8 @@ class TaskBarIcon(wx.TaskBarIcon): | ||
325 | wx.TaskBarIcon.__init__(self) | 327 | wx.TaskBarIcon.__init__(self) |
326 | self.frame = parent | 328 | self.frame = parent |
327 | 329 | ||
328 | - icon = wx.Icon("../icons/invesalius.ico", wx.BITMAP_TYPE_ICO) | 330 | + icon = wx.Icon(os.path.join(const.ICON_DIR, "invesalius.ico"), |
331 | + wx.BITMAP_TYPE_ICO) | ||
329 | self.SetIcon(icon, "InVesalius") | 332 | self.SetIcon(icon, "InVesalius") |
330 | self.imgidx = 1 | 333 | self.imgidx = 1 |
331 | 334 | ||
@@ -353,38 +356,46 @@ class ProjectToolBar(wx.ToolBar): | @@ -353,38 +356,46 @@ class ProjectToolBar(wx.ToolBar): | ||
353 | def __init_items(self): | 356 | def __init_items(self): |
354 | 357 | ||
355 | 358 | ||
356 | - BMP_IMPORT = wx.Bitmap("../icons/file_import.png", | 359 | + BMP_IMPORT = wx.Bitmap(os.path.join(const.ICON_DIR, "file_import.png"), |
357 | wx.BITMAP_TYPE_PNG) | 360 | wx.BITMAP_TYPE_PNG) |
358 | - BMP_NET = wx.Bitmap("../icons/file_from_internet.png", | 361 | + BMP_NET = wx.Bitmap(os.path.join(const.ICON_DIR, |
362 | + "file_from_internet.png"), | ||
359 | wx.BITMAP_TYPE_PNG) | 363 | wx.BITMAP_TYPE_PNG) |
360 | - BMP_SAVE = wx.Bitmap("../icons/file_save.png", | 364 | + BMP_SAVE = wx.Bitmap(os.path.join(const.ICON_DIR, "file_save.png"), |
361 | wx.BITMAP_TYPE_PNG) | 365 | wx.BITMAP_TYPE_PNG) |
362 | - BMP_PRINT = wx.Bitmap("../icons/print.png", | 366 | + BMP_PRINT = wx.Bitmap(os.path.join(const.ICON_DIR, "print.png"), |
363 | wx.BITMAP_TYPE_PNG) | 367 | wx.BITMAP_TYPE_PNG) |
364 | - BMP_PHOTO = wx.Bitmap("../icons/tool_photo.png", | 368 | + BMP_PHOTO = wx.Bitmap(os.path.join(const.ICON_DIR, "tool_photo.png"), |
365 | wx.BITMAP_TYPE_PNG) | 369 | wx.BITMAP_TYPE_PNG) |
366 | 370 | ||
367 | if sys.platform == 'darwin': | 371 | if sys.platform == 'darwin': |
368 | - BMP_IMPORT = wx.Bitmap("../icons/file_import_original.png", | 372 | + BMP_IMPORT = wx.Bitmap(os.path.join(const.ICON_DIR, |
373 | + "file_import_original.png"), | ||
369 | wx.BITMAP_TYPE_PNG) | 374 | wx.BITMAP_TYPE_PNG) |
370 | - BMP_NET = wx.Bitmap("../icons/file_from_internet_original.png", | 375 | + BMP_NET = wx.Bitmap(os.path.join(const.ICON_DIR, |
376 | + "file_from_internet_original.png"), | ||
371 | wx.BITMAP_TYPE_PNG) | 377 | wx.BITMAP_TYPE_PNG) |
372 | - BMP_SAVE = wx.Bitmap("../icons/file_save_original.png", | 378 | + BMP_SAVE = wx.Bitmap(os.path.join(const.ICON_DIR, |
379 | + "file_save_original.png"), | ||
373 | wx.BITMAP_TYPE_PNG) | 380 | wx.BITMAP_TYPE_PNG) |
374 | - BMP_PRINT = wx.Bitmap("../icons/print_original.png", | 381 | + BMP_PRINT = wx.Bitmap(os.path.join(const.ICON_DIR, |
382 | + "print_original.png"), | ||
375 | wx.BITMAP_TYPE_PNG) | 383 | wx.BITMAP_TYPE_PNG) |
376 | - BMP_PHOTO = wx.Bitmap("../icons/tool_photo_original.png", | 384 | + BMP_PHOTO = wx.Bitmap(os.path.join(const.ICON_DIR, |
385 | + "tool_photo_original.png"), | ||
377 | wx.BITMAP_TYPE_PNG) | 386 | wx.BITMAP_TYPE_PNG) |
378 | else: | 387 | else: |
379 | - BMP_IMPORT = wx.Bitmap("../icons/file_import.png", | 388 | + BMP_IMPORT = wx.Bitmap(os.path.join(const.ICON_DIR, |
389 | + "file_import.png"), | ||
380 | wx.BITMAP_TYPE_PNG) | 390 | wx.BITMAP_TYPE_PNG) |
381 | - BMP_NET = wx.Bitmap("../icons/file_from_internet.png", | 391 | + BMP_NET = wx.Bitmap(os.path.join(const.ICON_DIR, |
392 | + "file_from_internet.png"), | ||
382 | wx.BITMAP_TYPE_PNG) | 393 | wx.BITMAP_TYPE_PNG) |
383 | - BMP_SAVE = wx.Bitmap("../icons/file_save.png", | 394 | + BMP_SAVE = wx.Bitmap(os.path.join(const.ICON_DIR, "file_save.png"), |
384 | wx.BITMAP_TYPE_PNG) | 395 | wx.BITMAP_TYPE_PNG) |
385 | - BMP_PRINT = wx.Bitmap("../icons/print.png", | 396 | + BMP_PRINT = wx.Bitmap(os.path.join(const.ICON_DIR, "print.png"), |
386 | wx.BITMAP_TYPE_PNG) | 397 | wx.BITMAP_TYPE_PNG) |
387 | - BMP_PHOTO = wx.Bitmap("../icons/tool_photo.png", | 398 | + BMP_PHOTO = wx.Bitmap(os.path.join(const.ICON_DIR, "tool_photo.png"), |
388 | wx.BITMAP_TYPE_PNG) | 399 | wx.BITMAP_TYPE_PNG) |
389 | 400 | ||
390 | self.AddLabelTool(ID_FILE_IMPORT, | 401 | self.AddLabelTool(ID_FILE_IMPORT, |
@@ -426,27 +437,36 @@ class ObjectToolBar(wx.ToolBar): | @@ -426,27 +437,36 @@ class ObjectToolBar(wx.ToolBar): | ||
426 | def __init_items(self): | 437 | def __init_items(self): |
427 | 438 | ||
428 | if sys.platform == 'darwin': | 439 | if sys.platform == 'darwin': |
429 | - BMP_ROTATE = wx.Bitmap("../icons/tool_rotate_original.gif", | 440 | + BMP_ROTATE = wx.Bitmap(os.path.join(const.ICON_DIR, |
441 | + "tool_rotate_original.gif"), | ||
430 | wx.BITMAP_TYPE_GIF) | 442 | wx.BITMAP_TYPE_GIF) |
431 | - BMP_MOVE =wx.Bitmap("../icons/tool_translate_original.png", | 443 | + BMP_MOVE =wx.Bitmap(os.path.join(const.ICON_DIR, |
444 | + "tool_translate_original.png"), | ||
432 | wx.BITMAP_TYPE_PNG) | 445 | wx.BITMAP_TYPE_PNG) |
433 | - BMP_ZOOM = wx.Bitmap("../icons/tool_zoom_original.png", | 446 | + BMP_ZOOM = wx.Bitmap(os.path.join(const.ICON_DIR, |
447 | + "tool_zoom_original.png"), | ||
434 | wx.BITMAP_TYPE_PNG) | 448 | wx.BITMAP_TYPE_PNG) |
435 | - BMP_ZOOM_SELECT = wx.Bitmap("../icons/tool_zoom_select_original.png", | 449 | + BMP_ZOOM_SELECT = wx.Bitmap(os.path.join(const.ICON_DIR, |
450 | + "tool_zoom_select_original.png"), | ||
436 | wx.BITMAP_TYPE_PNG) | 451 | wx.BITMAP_TYPE_PNG) |
437 | - BMP_CONTRAST = wx.Bitmap("../icons/tool_contrast_original.png", | 452 | + BMP_CONTRAST = wx.Bitmap(os.path.join(const.ICON_DIR, |
453 | + "tool_contrast_original.png"), | ||
438 | wx.BITMAP_TYPE_PNG) | 454 | wx.BITMAP_TYPE_PNG) |
439 | else: | 455 | else: |
440 | 456 | ||
441 | - BMP_ROTATE = wx.Bitmap("../icons/tool_rotate.gif", | 457 | + BMP_ROTATE = wx.Bitmap(os.path.join(const.ICON_DIR, |
458 | + "tool_rotate.gif"), | ||
442 | wx.BITMAP_TYPE_GIF) | 459 | wx.BITMAP_TYPE_GIF) |
443 | - BMP_MOVE = wx.Bitmap("../icons/tool_translate.gif", | 460 | + BMP_MOVE = wx.Bitmap(os.path.join(const.ICON_DIR, |
461 | + "tool_translate.gif"), | ||
444 | wx.BITMAP_TYPE_GIF) | 462 | wx.BITMAP_TYPE_GIF) |
445 | - BMP_ZOOM = wx.Bitmap("../icons/tool_zoom.png", | 463 | + BMP_ZOOM = wx.Bitmap(os.path.join(const.ICON_DIR, "tool_zoom.png"), |
446 | wx.BITMAP_TYPE_PNG) | 464 | wx.BITMAP_TYPE_PNG) |
447 | - BMP_ZOOM_SELECT = wx.Bitmap("../icons/tool_zoom_select.png", | 465 | + BMP_ZOOM_SELECT = wx.Bitmap(os.path.join(const.ICON_DIR, |
466 | + "tool_zoom_select.png"), | ||
448 | wx.BITMAP_TYPE_PNG) | 467 | wx.BITMAP_TYPE_PNG) |
449 | - BMP_CONTRAST = wx.Bitmap("../icons/tool_contrast.png", | 468 | + BMP_CONTRAST = wx.Bitmap(os.path.join(const.ICON_DIR, |
469 | + "tool_contrast.png"), | ||
450 | wx.BITMAP_TYPE_PNG) | 470 | wx.BITMAP_TYPE_PNG) |
451 | 471 | ||
452 | self.AddLabelTool(ID_ZOOM, | 472 | self.AddLabelTool(ID_ZOOM, |
@@ -524,13 +544,14 @@ class SliceToolBar(wx.ToolBar): | @@ -524,13 +544,14 @@ class SliceToolBar(wx.ToolBar): | ||
524 | 544 | ||
525 | def __init_items(self): | 545 | def __init_items(self): |
526 | if sys.platform == 'darwin': | 546 | if sys.platform == 'darwin': |
527 | - BMP_SLICE = wx.Bitmap("../icons/slice_original.png", | 547 | + BMP_SLICE = wx.Bitmap(os.path.join(const.ICON_DIR, |
548 | + "slice_original.png"), | ||
528 | wx.BITMAP_TYPE_PNG) | 549 | wx.BITMAP_TYPE_PNG) |
529 | else: | 550 | else: |
530 | - BMP_SLICE = wx.Bitmap("../icons/slice.png", | 551 | + BMP_SLICE = wx.Bitmap(os.path.join(const.ICON_DIR, "slice.png"), |
531 | wx.BITMAP_TYPE_PNG) | 552 | wx.BITMAP_TYPE_PNG) |
532 | 553 | ||
533 | - BMP_CROSS = wx.Bitmap("../icons/cross.png", | 554 | + BMP_CROSS = wx.Bitmap(os.path.join(const.ICON_DIR, "cross.png"), |
534 | wx.BITMAP_TYPE_PNG) | 555 | wx.BITMAP_TYPE_PNG) |
535 | 556 | ||
536 | self.AddLabelTool(ID_SLICE_SCROLL, "Scroll slice", | 557 | self.AddLabelTool(ID_SLICE_SCROLL, "Scroll slice", |
@@ -595,15 +616,19 @@ class LayoutToolBar(wx.ToolBar): | @@ -595,15 +616,19 @@ class LayoutToolBar(wx.ToolBar): | ||
595 | 616 | ||
596 | if sys.platform == 'darwin': | 617 | if sys.platform == 'darwin': |
597 | BMP_WITHOUT_MENU =\ | 618 | BMP_WITHOUT_MENU =\ |
598 | - wx.Bitmap("../icons/layout_data_only_original.gif", | 619 | + wx.Bitmap(os.path.join(const.ICON_DIR, |
620 | + "layout_data_only_original.gif"), | ||
599 | wx.BITMAP_TYPE_GIF) | 621 | wx.BITMAP_TYPE_GIF) |
600 | - BMP_WITH_MENU = wx.Bitmap("../icons/layout_full_original.gif", | 622 | + BMP_WITH_MENU = wx.Bitmap(os.path.join(const.ICON_DIR, |
623 | + "layout_full_original.gif"), | ||
601 | wx.BITMAP_TYPE_GIF) | 624 | wx.BITMAP_TYPE_GIF) |
602 | 625 | ||
603 | else: | 626 | else: |
604 | - BMP_WITHOUT_MENU = wx.Bitmap("../icons/layout_data_only.gif", | 627 | + BMP_WITHOUT_MENU = wx.Bitmap(os.path.join(const.ICON_DIR, |
628 | + "layout_data_only.gif"), | ||
605 | wx.BITMAP_TYPE_GIF) | 629 | wx.BITMAP_TYPE_GIF) |
606 | - BMP_WITH_MENU = wx.Bitmap("../icons/layout_full.gif", | 630 | + BMP_WITH_MENU = wx.Bitmap(os.path.join(const.ICON_DIR, |
631 | + "layout_full.gif"), | ||
607 | wx.BITMAP_TYPE_GIF) | 632 | wx.BITMAP_TYPE_GIF) |
608 | 633 | ||
609 | self.AddLabelTool(101, "Full layout", BMP_WITHOUT_MENU, kind = wx.ITEM_RADIO) | 634 | self.AddLabelTool(101, "Full layout", BMP_WITHOUT_MENU, kind = wx.ITEM_RADIO) |