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 | 207 | print "Zoom" |
208 | 208 | self.append_mode('ZOOM') |
209 | 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 | 212 | self.interactor.SetCursor(wx.CursorFromImage(ICON_IMAGE)) |
212 | 213 | |
213 | 214 | def __set_mode_pan(self, pubsub_evt): |
... | ... | @@ -217,7 +218,8 @@ class Viewer(wx.Panel): |
217 | 218 | |
218 | 219 | def __set_mode_zoom_select(self, pubsub_evt): |
219 | 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 | 223 | self.interactor.SetCursor(wx.CursorFromImage(ICON_IMAGE)) |
222 | 224 | |
223 | 225 | def __set_mode_window_level(self, pubsub_evt): | ... | ... |
invesalius/gui/frame.py
... | ... | @@ -18,6 +18,7 @@ |
18 | 18 | #-------------------------------------------------------------------- |
19 | 19 | |
20 | 20 | import math |
21 | +import os.path | |
21 | 22 | import sys |
22 | 23 | |
23 | 24 | import wx |
... | ... | @@ -54,7 +55,8 @@ class Frame(wx.Frame): |
54 | 55 | size=wx.Size(1024, 768), #size = wx.DisplaySize(), |
55 | 56 | style=wx.DEFAULT_FRAME_STYLE, title='InVesalius 3') |
56 | 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 | 61 | # Set menus, status and task bar |
60 | 62 | self.SetMenuBar(MenuBar(self)) |
... | ... | @@ -325,7 +327,8 @@ class TaskBarIcon(wx.TaskBarIcon): |
325 | 327 | wx.TaskBarIcon.__init__(self) |
326 | 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 | 332 | self.SetIcon(icon, "InVesalius") |
330 | 333 | self.imgidx = 1 |
331 | 334 | |
... | ... | @@ -353,38 +356,46 @@ class ProjectToolBar(wx.ToolBar): |
353 | 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 | 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 | 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 | 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 | 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 | 369 | wx.BITMAP_TYPE_PNG) |
366 | 370 | |
367 | 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 | 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 | 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 | 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 | 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 | 386 | wx.BITMAP_TYPE_PNG) |
378 | 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 | 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 | 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 | 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 | 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 | 399 | wx.BITMAP_TYPE_PNG) |
389 | 400 | |
390 | 401 | self.AddLabelTool(ID_FILE_IMPORT, |
... | ... | @@ -426,27 +437,36 @@ class ObjectToolBar(wx.ToolBar): |
426 | 437 | def __init_items(self): |
427 | 438 | |
428 | 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 | 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 | 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 | 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 | 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 | 454 | wx.BITMAP_TYPE_PNG) |
439 | 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 | 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 | 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 | 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 | 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 | 470 | wx.BITMAP_TYPE_PNG) |
451 | 471 | |
452 | 472 | self.AddLabelTool(ID_ZOOM, |
... | ... | @@ -524,13 +544,14 @@ class SliceToolBar(wx.ToolBar): |
524 | 544 | |
525 | 545 | def __init_items(self): |
526 | 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 | 549 | wx.BITMAP_TYPE_PNG) |
529 | 550 | else: |
530 | - BMP_SLICE = wx.Bitmap("../icons/slice.png", | |
551 | + BMP_SLICE = wx.Bitmap(os.path.join(const.ICON_DIR, "slice.png"), | |
531 | 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 | 555 | wx.BITMAP_TYPE_PNG) |
535 | 556 | |
536 | 557 | self.AddLabelTool(ID_SLICE_SCROLL, "Scroll slice", |
... | ... | @@ -595,15 +616,19 @@ class LayoutToolBar(wx.ToolBar): |
595 | 616 | |
596 | 617 | if sys.platform == 'darwin': |
597 | 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 | 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 | 624 | wx.BITMAP_TYPE_GIF) |
602 | 625 | |
603 | 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 | 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 | 632 | wx.BITMAP_TYPE_GIF) |
608 | 633 | |
609 | 634 | self.AddLabelTool(101, "Full layout", BMP_WITHOUT_MENU, kind = wx.ITEM_RADIO) | ... | ... |