From 523174cd750832c457cd24becc7346d619dc0f49 Mon Sep 17 00:00:00 2001 From: tatiana Date: Mon, 22 Jun 2009 04:26:56 +0000 Subject: [PATCH] ADD: Surface data and GUI integration --- invesalius/data/surface.py | 33 +++++++++++++++++++++++++++------ invesalius/data/viewer_volume.py | 7 ++++--- invesalius/gui/data_notebook.py | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------- invesalius/gui/frame.py | 128 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------- invesalius/gui/task_importer.py | 10 +++++----- invesalius/gui/task_slice.py | 1 + invesalius/gui/task_surface.py | 18 +++++++++++------- 7 files changed, 166 insertions(+), 121 deletions(-) diff --git a/invesalius/data/surface.py b/invesalius/data/surface.py index 8d258b5..4df6d19 100644 --- a/invesalius/data/surface.py +++ b/invesalius/data/surface.py @@ -18,6 +18,7 @@ class Surface(): self.polydata = None self.colour = None self.transparency = const.SURFACE_TRANSPARENCY + self.volume = 0 self.is_shown = 1 self.name = const.SURFACE_NAME_PATTERN %(Surface.general_index+1) @@ -45,6 +46,9 @@ class SurfaceManager(): ps.Publisher().subscribe(self.SetActorColour, 'Set surface colour') + ps.Publisher().subscribe(self.OnChangeSurfaceName, 'Change surface name') + ps.Publisher().subscribe(self.OnShowSurface, 'Show surface') + def AddNewActor(self, pubsub_evt): """ Create surface actor, save into project and send it to viewer. @@ -144,13 +148,10 @@ class SurfaceManager(): filled_polydata.SetInput(polydata) filled_polydata.SetHoleSize(500) filled_polydata.AddObserver("ProgressEvent", lambda obj, evt: - UpdateProgress(filled_polydata, - "Filling polydata...")) + UpdateProgress(filled_polydata, + "Filling polydata...")) polydata = filled_polydata.GetOutput() - print "Area: %f mm2" % pu.CalculateSurfaceArea(polydata) - print "Volume: %f mm3" % pu.CalculateSurfaceVolume(polydata) - # Orient normals from inside to outside normals = vtk.vtkPolyDataNormals() normals.SetInput(polydata) @@ -183,6 +184,7 @@ class SurfaceManager(): surface = Surface() surface.colour = colour surface.polydata = polydata + # Set actor colour and transparency actor.GetProperty().SetColor(colour) @@ -201,9 +203,17 @@ class SurfaceManager(): ps.Publisher().sendMessage('Update status text in GUI', "Surface created.") + # The following lines have to be here, otherwise all volumes disappear + measured_polydata = vtk.vtkMassProperties() + measured_polydata.SetInput(polydata) + volume = measured_polydata.GetVolume() + surface.volume = volume + ps.Publisher().sendMessage('Update surface info in GUI', (surface.index, surface.name, - surface.colour, surface.transparency)) + surface.colour, surface.volume, + surface.transparency)) + def RemoveActor(self, index): """ @@ -216,6 +226,16 @@ class SurfaceManager(): proj.surface_dict.pop(index) + def OnChangeSurfaceName(self, pubsub_evt): + index, name = pubsub_evt.data + proj = Project() + proj.surface_dict[index].name = name + + def OnShowSurface(self, pubsub_evt): + index, value = pubsub_evt.data + print "OnShowSurface", index, value + self.ShowActor(index, value) + def ShowActor(self, index, value): """ Show or hide actor, according to given actor index and value. @@ -224,6 +244,7 @@ class SurfaceManager(): # Update value in project's surface_dict proj = Project() proj.surface_dict[index].is_shown = value + ps.Publisher().sendMessage('Render volume viewer') def SetActorTransparency(self, pubsub_evt): """ diff --git a/invesalius/data/viewer_volume.py b/invesalius/data/viewer_volume.py index b57ad2d..0388c6b 100755 --- a/invesalius/data/viewer_volume.py +++ b/invesalius/data/viewer_volume.py @@ -81,15 +81,16 @@ class Viewer(wx.Panel): self.UpdateRender() def LoadActor(self, pubsub_evt): + print "****** Load actor" actor = pubsub_evt.data ren = self.ren ren.AddActor(actor) ren.ResetCamera() - ren.GetActiveCamera().Elevation(90) - ren.GetActiveCamera().SetViewUp(0, 0, 1) + #ren.GetActiveCamera().Elevation(90) + #ren.GetActiveCamera().SetViewUp(0, 0, 1) - ren.GetActiveCamera().Dolly(1.5) + #ren.GetActiveCamera().Dolly(1.5) ren.ResetCameraClippingRange() self.iren.Render() diff --git a/invesalius/gui/data_notebook.py b/invesalius/gui/data_notebook.py index 8f29beb..f89d7f6 100644 --- a/invesalius/gui/data_notebook.py +++ b/invesalius/gui/data_notebook.py @@ -120,7 +120,6 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): self.image_gray = Image.open("../icons/object_colour.jpg") def OnEditLabel(self, evt): - print "Editing label", evt.GetIndex(), evt.GetLabel() ps.Publisher().sendMessage('Change mask name', (evt.GetIndex(), evt.GetLabel())) evt.Skip() @@ -128,7 +127,6 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): self.ToggleItem(evt.m_itemIndex) def OnCheckItem(self, index, flag): - if flag: for key in self.mask_list_index.keys(): if key != index: @@ -183,13 +181,6 @@ class MasksListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): self.imagelist.Replace(image_index, image) self.Refresh() - def Populate(self): - dict = ((0,"Mask 1", "(1000,4500)"), - (1,"Mask 2", "(2000, 4500)"), - (2,"Background","(0,4500)")) - for data in dict: - self.InsertNewItem(data[0], data[1], data[2]) - class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): def __init__(self, parent, ID=-1, pos=wx.DefaultPosition, @@ -205,65 +196,87 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): self.__init_columns() self.__init_image_list() self.__init_evt() - + self.__bind_events_wx() self.surface_list_index = {} self.surface_bmp_idx_to_name = {} def __init_evt(self): - self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated) ps.Publisher().subscribe(self.AddSurface, 'Update surface info in GUI') + ps.Publisher().subscribe(self.EditSurfaceTransparency, + 'Set surface transparency') + ps.Publisher().subscribe(self.EditSurfaceColour, + 'Set surface colour') + + def __bind_events_wx(self): + self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.OnItemActivated) + self.Bind(wx.EVT_LIST_END_LABEL_EDIT, self.OnEditLabel) def __init_columns(self): self.InsertColumn(0, "", wx.LIST_FORMAT_CENTER) self.InsertColumn(1, "Name") - self.InsertColumn(2, "Transparency", wx.LIST_FORMAT_RIGHT) + self.InsertColumn(2, "Volume (mm3)") + self.InsertColumn(3, "Transparency", wx.LIST_FORMAT_RIGHT) self.SetColumnWidth(0, 20) - self.SetColumnWidth(1, 120) - self.SetColumnWidth(2, 90) + self.SetColumnWidth(1, 85) + self.SetColumnWidth(2, 85) + self.SetColumnWidth(3, 80) def __init_image_list(self): self.imagelist = wx.ImageList(16, 16) - image = wx.Image("../icons//object_visible.jpg") + image = wx.Image("../icons/object_invisible.jpg") bitmap = wx.BitmapFromImage(image.Scale(16, 16)) bitmap.SetWidth(16) bitmap.SetHeight(16) - img_check = self.imagelist.Add(bitmap) - - image = wx.Image("../icons/object_invisible.jpg") + img_null = self.imagelist.Add(bitmap) + + image = wx.Image("../icons//object_visible.jpg") bitmap = wx.BitmapFromImage(image.Scale(16, 16)) bitmap.SetWidth(16) bitmap.SetHeight(16) - img_null = self.imagelist.Add(bitmap) + img_check = self.imagelist.Add(bitmap) self.SetImageList(self.imagelist, wx.IMAGE_LIST_SMALL) self.image_gray = Image.open("../icons/object_colour.jpg") + + def OnEditLabel(self, evt): + ps.Publisher().sendMessage('Change surface name', (evt.GetIndex(), evt.GetLabel())) + evt.Skip() + + def OnItemActivated(self, evt): + self.ToggleItem(evt.m_itemIndex) + #ps.Publisher().sendMessage('Change surface selected',index) + + def OnCheckItem(self, index, flag): + ps.Publisher().sendMessage('Show surface', (index, flag)) + def AddSurface(self, pubsub_evt): index = pubsub_evt.data[0] name = pubsub_evt.data[1] colour = pubsub_evt.data[2] - transparency = "%d%%"%(int(100*pubsub_evt.data[3])) + volume = "%d"%(int(pubsub_evt.data[3])) + transparency = "%d%%"%(int(100*pubsub_evt.data[4])) image = self.CreateColourBitmap(colour) image_index = self.imagelist.Add(image) self.surface_list_index[index] = image_index - self.InsertNewItem(index, name, str(transparency), colour) + self.InsertNewItem(index, name, volume, transparency, colour) - def InsertNewItem(self, index=0, label="Surface 1", - transparency="(1000, 4500)", colour=None): + def InsertNewItem(self, index=0, label="Surface 1", volume="0 mm3", + transparency="0%%", colour=None): self.InsertStringItem(index, "") self.SetStringItem(index, 1, label, imageId = self.surface_list_index[index]) - self.SetStringItem(index, 2, transparency) + self.SetStringItem(index, 2, volume) + self.SetStringItem(index, 3, transparency) + self.SetItemImage(index, 1) - - def CreateColourBitmap(self, colour): """ Create a wx Image with a mask colour. @@ -280,16 +293,27 @@ class SurfacesListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): wx_image = wx.EmptyImage(new_image.size[0], new_image.size[1]) wx_image.SetData(new_image.tostring()) - return wx.BitmapFromImage(wx_image.Scale(16, 16)) - - def OnItemActivated(self, evt): - self.ToggleItem(evt.m_itemIndex) + return wx.BitmapFromImage(wx_image.Scale(16, 16)) + + def EditSurfaceTransparency(self, pubsub_evt): + """ + Set actor transparency (oposite to opacity) according to given actor + index and value. + """ + index, value = pubsub_evt.data + print "EditSurfaceTransparency", index, value + self.SetStringItem(index, 3, "%d%%"%(int(value*100))) - def OnCheckItem(self, index, flag): - ps.Publisher().sendMessage('Show surface', (index, not flag)) + def EditSurfaceColour(self, pubsub_evt): + """ + """ + index, colour = pubsub_evt.data + image = self.CreateColourBitmap(colour) + image_index = self.surface_list_index[index] + self.imagelist.Replace(image_index, image) + self.Refresh() - class MeasuresListCtrlPanel(wx.ListCtrl, listmix.TextEditMixin): # TODO: Change edimixin to affect third column also def __init__(self, parent, ID=-1, pos=wx.DefaultPosition, diff --git a/invesalius/gui/frame.py b/invesalius/gui/frame.py index a93191c..51f6fdf 100755 --- a/invesalius/gui/frame.py +++ b/invesalius/gui/frame.py @@ -27,14 +27,15 @@ import default_tasks as tasks import default_viewers as viewers -[ID_NEW, ID_OPEN, ID_FULLSCREEN] = [wx.NewId() for number in range(3)] + +[ID_FILE_IMPORT, ID_FILE_LOAD_INTERNET, ID_FILE_SAVE, ID_FILE_PRINT] = [wx.NewId() for number in range(4)] class Frame(wx.Frame): def __init__(self, prnt): wx.Frame.__init__(self, id=-1, name='', parent=prnt, pos=wx.Point(0, 0), size=wx.Size(1024, 768), #size = wx.DisplaySize(), - style=wx.DEFAULT_FRAME_STYLE, title='InVesalius 3.0') + style=wx.DEFAULT_FRAME_STYLE, title='InVesalius 3') self.Center(wx.BOTH) self.SetIcon(wx.Icon("../icons/invesalius.ico", wx.BITMAP_TYPE_ICO)) @@ -84,17 +85,26 @@ class Frame(wx.Frame): # Add toolbars to manager - aui_manager.AddPane(ObjectToolBar(self), wx.aui.AuiPaneInfo(). + if sys.platform == 'win32': + t1 = ProjectToolBar(self) + t2 = LayoutToolBar(self) + t3 = ObjectToolBar(self) + else: + t3 = ProjectToolBar(self) + t2 = LayoutToolBar(self) + t1 = ObjectToolBar(self) + + aui_manager.AddPane(t1, wx.aui.AuiPaneInfo(). Name("General Features Toolbar"). ToolbarPane().Top().Floatable(False). LeftDockable(False).RightDockable(False)) - #aui_manager.AddPane(LayoutToolBar(self), wx.aui.AuiPaneInfo(). - # Name("Layout Toolbar"). - # ToolbarPane().Top().Floatable(False). - # LeftDockable(False).RightDockable(False)) + aui_manager.AddPane(t2, wx.aui.AuiPaneInfo(). + Name("Layout Toolbar"). + ToolbarPane().Top().Floatable(False). + LeftDockable(False).RightDockable(False)) - aui_manager.AddPane(ProjectToolBar(self), wx.aui.AuiPaneInfo(). + aui_manager.AddPane(t3, wx.aui.AuiPaneInfo(). Name("Project Toolbar"). ToolbarPane().Top().Floatable(False). LeftDockable(False).RightDockable(False)) @@ -137,12 +147,11 @@ class MenuBar(wx.MenuBar): def __init_items(self): file_menu = wx.Menu() - file_menu.Append(ID_NEW, "New") - file_menu.Append(ID_OPEN, "Open") - file_menu.Append(wx.ID_EXIT, "Exit") + file_menu.Append(ID_FILE_IMPORT, "Import...") + file_menu.Append(101, "Exit") view_menu = wx.Menu() - view_menu.Append(ID_FULLSCREEN, "Fullscreen") + view_menu.Append(101, "Fullscreen") tools_menu = wx.Menu() @@ -169,8 +178,9 @@ class MenuBar(wx.MenuBar): # events should be binded directly from wx.Menu / wx.MenuBar # message "Binding events of wx.MenuBar" on [wxpython-users] # mail list in Oct 20 2008 - self.parent.Bind(wx.EVT_MENU, self.OnNew, id=ID_NEW) - self.parent.Bind(wx.EVT_MENU, self.OnOpen, id=ID_OPEN) + #self.parent.Bind(wx.EVT_MENU, self.OnNew, id=ID_NEW) + #self.parent.Bind(wx.EVT_MENU, self.OnOpen, id=ID_OPEN) + pass def OnNew(self, event): print "New" @@ -215,7 +225,7 @@ class StatusBar(wx.StatusBar): self.SetFieldsCount(3) self.SetStatusWidths([-2,-2,-1]) self.SetStatusText("Ready", 0) - self.SetStatusText("Welcome to InVesalius 3.0", 1) + self.SetStatusText("", 1) self.SetStatusText("", 2) self.progress_bar = ProgressBar(self) @@ -257,35 +267,36 @@ class TaskBarIcon(wx.TaskBarIcon): # ------------------------------------------------------------------------------ class ProjectToolBar(wx.ToolBar): - # TODO: what will appear in menubar? def __init__(self, parent): - wx.ToolBar.__init__(self, parent, -1, wx.DefaultPosition, wx.DefaultSize, wx.TB_FLAT|wx.TB_NODIVIDER) + wx.ToolBar.__init__(self, parent, -1, wx.DefaultPosition, + wx.DefaultSize, wx.TB_FLAT|wx.TB_NODIVIDER) if sys.platform == 'darwin': - self._size = 25 - else: - self._size = 16 - self.SetToolBitmapSize(wx.Size(self._size,self._size)) + self.SetToolBitmapSize(wx.Size(32,32)) self.parent = parent self.__init_items() self.__bind_events() def __init_items(self): - BMP_IMPORT = wx.Bitmap("../icons/file_import.png", wx.BITMAP_TYPE_PNG) - BMP_EXPORT = wx.Bitmap("../icons/file_export.png", wx.BITMAP_TYPE_PNG) - BMP_NET = wx.Bitmap("../icons/file_from_internet.png", wx.BITMAP_TYPE_PNG) - BMP_SAVE = wx.Bitmap("../icons/file_save.png", wx.BITMAP_TYPE_PNG) - - if sys.platform != 'darwin': - bmp_list = [BMP_IMPORT, BMP_EXPORT, BMP_NET, BMP_SAVE] - for bmp in bmp_list: - bmp.SetWidth(self._size) - bmp.SetHeight(self._size) - self.AddLabelTool(101, "Import medical image...", BMP_IMPORT) - self.AddLabelTool(101, "Export data.", BMP_EXPORT) - self.AddLabelTool(101, "Load medical image...", BMP_NET) - self.AddLabelTool(101, "Save InVesalius project", BMP_SAVE) + if sys.platform == 'darwin': + BMP_IMPORT = wx.Bitmap("../icons/file_import_original.png", wx.BITMAP_TYPE_PNG) + BMP_NET = wx.Bitmap("../icons/file_from_internet_original.png", wx.BITMAP_TYPE_PNG) + BMP_SAVE = wx.Bitmap("../icons/file_save_original.png", wx.BITMAP_TYPE_PNG) + BMP_PRINT = wx.Bitmap("../icons/print_original.png", wx.BITMAP_TYPE_PNG) + BMP_PHOTO = wx.Bitmap("../icons/tool_photo_original.png", wx.BITMAP_TYPE_PNG) + else: + BMP_IMPORT = wx.Bitmap("../icons/file_import.png", wx.BITMAP_TYPE_PNG) + BMP_NET = wx.Bitmap("../icons/file_from_internet.png", wx.BITMAP_TYPE_PNG) + BMP_SAVE = wx.Bitmap("../icons/file_save.png", wx.BITMAP_TYPE_PNG) + BMP_PRINT = wx.Bitmap("../icons/print.png", wx.BITMAP_TYPE_PNG) + BMP_PHOTO = wx.Bitmap("../icons/tool_photo.png", wx.BITMAP_TYPE_PNG) + + self.AddLabelTool(ID_FILE_IMPORT, "Import medical image...", BMP_IMPORT) + self.AddLabelTool(ID_FILE_LOAD_INTERNET, "Load medical image...", BMP_NET) + self.AddLabelTool(ID_FILE_SAVE, "Save InVesalius project", BMP_SAVE) + self.AddLabelTool(101, "Take photo of screen", BMP_PHOTO) + self.AddLabelTool(ID_FILE_PRINT, "Print medical image...", BMP_PRINT) self.Realize() @@ -297,10 +308,7 @@ class ObjectToolBar(wx.ToolBar): def __init__(self, parent): wx.ToolBar.__init__(self, parent, -1, wx.DefaultPosition, wx.DefaultSize, wx.TB_FLAT|wx.TB_NODIVIDER) if sys.platform == 'darwin': - self._size = 25 - else: - self._size = 16 - self.SetToolBitmapSize(wx.Size(self._size,self._size)) + self.SetToolBitmapSize(wx.Size(32,32)) self.parent = parent self.__init_items() @@ -308,24 +316,18 @@ class ObjectToolBar(wx.ToolBar): def __init_items(self): - #BMP_ROTATE = wx.Bitmap("../icons/tool_rotate.gif", wx.BITMAP_TYPE_GIF) - #BMP_TRANSLATE = wx.Bitmap("../icons/tool_translate.gif", wx.BITMAP_TYPE_GIF) - BMP_ZOOM = wx.Bitmap("../icons/tool_zoom.png", wx.BITMAP_TYPE_PNG) - BMP_PHOTO = wx.Bitmap("../icons/tool_photo.png", wx.BITMAP_TYPE_PNG) - BMP_PRINT = wx.Bitmap("../icons/tool_print.png", wx.BITMAP_TYPE_PNG) - - if sys.platform != 'darwin': - bmp_list = [BMP_ZOOM, BMP_PHOTO, BMP_PRINT] - for bmp in bmp_list: - bmp.SetWidth(self._size) - bmp.SetHeight(self._size) - - #self.AddLabelTool(101, "Rotate image", BMP_ROTATE) - #self.AddLabelTool(101, "Translate image", BMP_TRANSLATE) - self.AddLabelTool(101, "Zoom image", BMP_ZOOM) - self.AddLabelTool(101, "Take photo of screen", BMP_PHOTO) - self.AddLabelTool(101, "Print screen", BMP_PRINT) + if sys.platform == 'darwin': + BMP_ROTATE = wx.Bitmap("../icons/tool_rotate_original.gif", wx.BITMAP_TYPE_GIF) + BMP_TRANSLATE = wx.Bitmap("../icons/tool_translate_original.png", wx.BITMAP_TYPE_PNG) + BMP_ZOOM_IN = wx.Bitmap("../icons/tool_zoom_in_original.png", wx.BITMAP_TYPE_PNG) + BMP_ZOOM_OUT = wx.Bitmap("../icons/tool_zoom_out_original.png", wx.BITMAP_TYPE_PNG) + + self.AddLabelTool(101, "Zoom in image", BMP_ZOOM_IN) + self.AddLabelTool(101, "Zoom out image", BMP_ZOOM_OUT) + self.AddLabelTool(101, "Rotate image", BMP_ROTATE) + self.AddLabelTool(101, "Translate image", BMP_TRANSLATE) + self.Realize() def __bind_events(self): @@ -336,10 +338,7 @@ class LayoutToolBar(wx.ToolBar): def __init__(self, parent): wx.ToolBar.__init__(self, parent, -1, wx.DefaultPosition, wx.DefaultSize, wx.TB_FLAT|wx.TB_NODIVIDER) if sys.platform == 'darwin': - self._size = 25 - else: - self._size = 16 - self.SetToolBitmapSize(wx.Size(self._size,self._size)) + self.SetToolBitmapSize(wx.Size(32,32)) self.parent = parent self.__init_items() @@ -347,14 +346,9 @@ class LayoutToolBar(wx.ToolBar): def __init_items(self): - BMP_ROTATE = wx.Bitmap("../icons/layout_data_only.png", wx.BITMAP_TYPE_PNG) - BMP_TRANSLATE = wx.Bitmap("../icons/layout_full.png", wx.BITMAP_TYPE_PNG) + BMP_ROTATE = wx.Bitmap("../icons/layout_data_only_original.gif", wx.BITMAP_TYPE_GIF) + BMP_TRANSLATE = wx.Bitmap("../icons/layout_full_original.gif", wx.BITMAP_TYPE_GIF) - if sys.platform != 'darwin': - bmp_list = [BMP_ROTATE, BMP_TRANSLATE] - for bmp in bmp_list: - bmp.SetWidth(self._size) - bmp.SetHeight(self._size) #BMP_ZOOM = wx.Bitmap("../icons/tool_zoom.png", wx.BITMAP_TYPE_PNG) #BMP_PHOTO = wx.Bitmap("../icons/tool_photo.png", wx.BITMAP_TYPE_PNG) diff --git a/invesalius/gui/task_importer.py b/invesalius/gui/task_importer.py index ff3130d..177bc42 100644 --- a/invesalius/gui/task_importer.py +++ b/invesalius/gui/task_importer.py @@ -58,8 +58,8 @@ class InnerTaskPanel(wx.Panel): self.float_hyper_list = [] # Fixed hyperlink items - tooltip = wx.ToolTip("Select DICOM files to be reconstructed") - link_import_local = hl.HyperLinkCtrl(self, -1, "Open DICOM files...") + tooltip = wx.ToolTip("Select DICOM or Analyze files to be reconstructed") + link_import_local = hl.HyperLinkCtrl(self, -1, "Import medical images...") link_import_local.SetUnderlines(False, False, False) link_import_local.SetColours("BLACK", "BLACK", "BLACK") link_import_local.SetToolTip(tooltip) @@ -182,9 +182,9 @@ class InnerTaskPanel(wx.Panel): self.OnLinkOpenProject() def TestLoadProjects(self): - self.LoadProject("test1.inv") - self.LoadProject("test2.inv") - self.LoadProject("test3.inv") + self.LoadProject("test1.iv3") + self.LoadProject("test2.iv3") + self.LoadProject("test3.iv3") def LoadProject(self, proj_name="Unnamed"): """ diff --git a/invesalius/gui/task_slice.py b/invesalius/gui/task_slice.py index 33bf15e..a633a37 100644 --- a/invesalius/gui/task_slice.py +++ b/invesalius/gui/task_slice.py @@ -298,6 +298,7 @@ class MaskProperties(wx.Panel): index = pubsub_evt.data self.combo_mask_name.SetSelection(index) + def ChangeMaskName(self, pubsub_evt): index, name = pubsub_evt.data self.combo_mask_name.SetString(index, name) diff --git a/invesalius/gui/task_surface.py b/invesalius/gui/task_surface.py index 15a2864..46619a1 100644 --- a/invesalius/gui/task_surface.py +++ b/invesalius/gui/task_surface.py @@ -311,14 +311,14 @@ class SurfaceProperties(wx.Panel): (slider_transparency, 1, flag_slider,4)]) # LINE 4 - cb = wx.CheckBox(self, -1, "Fill largest surface holes") - cb.SetValue(True) + #cb = wx.CheckBox(self, -1, "Fill largest surface holes") + #cb.SetValue(True) # Add all lines into main sizer sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(line1, 1, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 5) sizer.Add(fixed_sizer, 0, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 5) - sizer.Add(cb, 0, wx.GROW|wx.EXPAND|wx.RIGHT|wx.LEFT|wx.TOP|wx.BOTTOM, 5) + #sizer.Add(cb, 0, wx.GROW|wx.EXPAND|wx.RIGHT|wx.LEFT|wx.TOP|wx.BOTTOM, 5) sizer.Fit(self) self.SetSizer(sizer) @@ -328,17 +328,21 @@ class SurfaceProperties(wx.Panel): self.__bind_events() def __bind_events(self): - #ps.Publisher().sendMessage('Update surface info in GUI', - # (surface.name, surface.colour, - # surface.transparency)) ps.Publisher().subscribe(self.InsertNewSurface, 'Update surface info in GUI') + ps.Publisher().subscribe(self.ChangeMaskName, + 'Change surface name') + def ChangeMaskName(self, pubsub_evt): + index, name = pubsub_evt.data + self.combo_surface_name.SetString(index, name) + self.combo_surface_name.Refresh() + def InsertNewSurface(self, pubsub_evt): name = pubsub_evt.data[1] colour = [value*255 for value in pubsub_evt.data[2]] - transparency = 100*pubsub_evt.data[3] + transparency = 100*pubsub_evt.data[4] index = self.combo_surface_name.Append(name) self.combo_surface_name.SetSelection(index) self.button_colour.SetColour(colour) -- libgit2 0.21.2