Commit c4e8bbe6ee5fbf54526d1f9b72b3b3092f9a1f4f

Authored by tatiana
1 parent 144225c5

FIX: Icon reference on Win and Linux

Showing 1 changed file with 35 additions and 15 deletions   Show diff stats
invesalius/gui/frame.py
... ... @@ -25,6 +25,7 @@ import math
25 25  
26 26 import default_tasks as tasks
27 27 import default_viewers as viewers
  28 +import import_panel as imp
28 29  
29 30  
30 31 [ID_FILE_IMPORT, ID_FILE_LOAD_INTERNET, ID_FILE_SAVE, ID_FILE_PRINT] = [wx.NewId() for number in range(4)]
... ... @@ -53,10 +54,14 @@ class Frame(wx.Frame):
53 54  
54 55 # Initialize bind to pubsub events
55 56 self.__bind_events()
  57 + self.__bind_events_wx()
56 58  
57 59  
58 60 def __bind_events(self):
59 61 ps.Publisher().subscribe(self.ShowContentPanel, 'Show content panel')
  62 + ps.Publisher().subscribe(self.ShowImportPanel, "Show import panel")
  63 +
  64 + def __bind_events_wx(self):
60 65 self.Bind(wx.EVT_SIZE, self.OnSize)
61 66  
62 67 def __init_aui(self):
... ... @@ -81,16 +86,22 @@ class Frame(wx.Frame):
81 86 Hide().Layer(1).MaximizeButton(True).Name("Data").
82 87 Position(1))
83 88  
  89 +
  90 + aui_manager.AddPane(imp.Panel(self), wx.aui.AuiPaneInfo().
  91 + Name("Import").Centre().Hide().
  92 + Caption("Preview medical data to be reconstructed").
  93 + CaptionVisible(True))
  94 +
84 95  
85 96 # Add toolbars to manager
86 97  
87 98 if sys.platform == 'win32':
88 99 t1 = ProjectToolBar(self)
89   - t2 = LayoutToolBar(self)
  100 + #t2 = LayoutToolBar(self)
90 101 t3 = ObjectToolBar(self)
91 102 else:
92 103 t3 = ProjectToolBar(self)
93   - t2 = LayoutToolBar(self)
  104 + #t2 = LayoutToolBar(self)
94 105 t1 = ObjectToolBar(self)
95 106  
96 107 aui_manager.AddPane(t1, wx.aui.AuiPaneInfo().
... ... @@ -98,10 +109,10 @@ class Frame(wx.Frame):
98 109 ToolbarPane().Top().Floatable(False).
99 110 LeftDockable(False).RightDockable(False))
100 111  
101   - aui_manager.AddPane(t2, wx.aui.AuiPaneInfo().
102   - Name("Layout Toolbar").
103   - ToolbarPane().Top().Floatable(False).
104   - LeftDockable(False).RightDockable(False))
  112 + #aui_manager.AddPane(t2, wx.aui.AuiPaneInfo().
  113 + # Name("Layout Toolbar").
  114 + # ToolbarPane().Top().Floatable(False).
  115 + # LeftDockable(False).RightDockable(False))
105 116  
106 117 aui_manager.AddPane(t3, wx.aui.AuiPaneInfo().
107 118 Name("Project Toolbar").
... ... @@ -115,6 +126,16 @@ class Frame(wx.Frame):
115 126  
116 127 self.aui_manager = aui_manager
117 128  
  129 + def ShowImportPanel(self, evt_pubsub):
  130 + path = evt_pubsub.data
  131 + ps.Publisher().sendMessage("Load data to import panel", path)
  132 +
  133 + aui_manager = self.aui_manager
  134 + aui_manager.GetPane("Import").Show(1)
  135 + aui_manager.GetPane("Data").Show(0)
  136 + aui_manager.GetPane("Tasks").Show(0)
  137 + aui_manager.Update()
  138 +
118 139  
119 140 def ShowContentPanel(self, evt_pubsub):
120 141 aui_manager = self.aui_manager
... ... @@ -297,6 +318,7 @@ class ProjectToolBar(wx.ToolBar):
297 318 self.AddLabelTool(101, "Take photo of screen", BMP_PHOTO)
298 319 self.AddLabelTool(ID_FILE_PRINT, "Print medical image...", BMP_PRINT)
299 320  
  321 +
300 322 self.Realize()
301 323  
302 324 def __bind_events(self):
... ... @@ -322,6 +344,13 @@ class ObjectToolBar(wx.ToolBar):
322 344 BMP_ZOOM_IN = wx.Bitmap("../icons/tool_zoom_in_original.png", wx.BITMAP_TYPE_PNG)
323 345 BMP_ZOOM_OUT = wx.Bitmap("../icons/tool_zoom_out_original.png", wx.BITMAP_TYPE_PNG)
324 346 BMP_CONTRAST = wx.Bitmap("../icons/tool_contrast.png", wx.BITMAP_TYPE_PNG)
  347 + else:
  348 + BMP_ROTATE = wx.Bitmap("../icons/tool_rotate.gif", wx.BITMAP_TYPE_GIF)
  349 + BMP_TRANSLATE = wx.Bitmap("../icons/tool_translate.png", wx.BITMAP_TYPE_PNG)
  350 + BMP_ZOOM_IN = wx.Bitmap("../icons/tool_zoom_in.png", wx.BITMAP_TYPE_PNG)
  351 + BMP_ZOOM_OUT = wx.Bitmap("../icons/tool_zoom_out.png", wx.BITMAP_TYPE_PNG)
  352 + BMP_CONTRAST = wx.Bitmap("../icons/tool_contrast.png", wx.BITMAP_TYPE_PNG)
  353 +
325 354  
326 355 self.AddLabelTool(101, "Zoom in image", BMP_ZOOM_IN)
327 356 self.AddLabelTool(101, "Zoom out image", BMP_ZOOM_OUT)
... ... @@ -346,20 +375,11 @@ class LayoutToolBar(wx.ToolBar):
346 375 self.__bind_events()
347 376  
348 377 def __init_items(self):
349   -
350 378 BMP_ROTATE = wx.Bitmap("../icons/layout_data_only_original.gif", wx.BITMAP_TYPE_GIF)
351 379 BMP_TRANSLATE = wx.Bitmap("../icons/layout_full_original.gif", wx.BITMAP_TYPE_GIF)
352 380  
353   -
354   - #BMP_ZOOM = wx.Bitmap("../icons/tool_zoom.png", wx.BITMAP_TYPE_PNG)
355   - #BMP_PHOTO = wx.Bitmap("../icons/tool_photo.png", wx.BITMAP_TYPE_PNG)
356   - #BMP_PRINT = wx.Bitmap("../icons/tool_print.png", wx.BITMAP_TYPE_PNG)
357   -
358 381 self.AddLabelTool(101, "Rotate image", BMP_ROTATE)
359 382 self.AddLabelTool(101, "Translate image", BMP_TRANSLATE)
360   - #self.AddLabelTool(101, "Zoom image", BMP_ZOOM)
361   - #self.AddLabelTool(101, "Take photo of screen", BMP_PHOTO)
362   - #self.AddLabelTool(101, "Print screen", BMP_PRINT)
363 383  
364 384 self.Realize()
365 385  
... ...