Commit c8312e17c2cbce1c3399784005ace88059c84b36

Authored by Thiago Franco de Moraes
1 parent 18762534

fixed problem with surface indexes in combobox

Showing 1 changed file with 5 additions and 2 deletions   Show diff stats
invesalius/gui/task_surface.py
@@ -477,9 +477,11 @@ class SurfaceProperties(wx.Panel): @@ -477,9 +477,11 @@ class SurfaceProperties(wx.Panel):
477 477
478 old_dict = self.surface_list 478 old_dict = self.surface_list
479 new_dict = [] 479 new_dict = []
  480 + i = 0
480 for n, (name, index) in enumerate(old_dict): 481 for n, (name, index) in enumerate(old_dict):
481 if n not in list_index: 482 if n not in list_index:
482 - new_dict.append([name, index]) 483 + new_dict.append([name, i])
  484 + i+=1
483 self.surface_list = new_dict 485 self.surface_list = new_dict
484 486
485 s = self.combo_surface_name.GetSelection() 487 s = self.combo_surface_name.GetSelection()
@@ -510,6 +512,7 @@ class SurfaceProperties(wx.Panel): @@ -510,6 +512,7 @@ class SurfaceProperties(wx.Panel):
510 name = pubsub_evt.data[1] 512 name = pubsub_evt.data[1]
511 colour = [value*255 for value in pubsub_evt.data[2]] 513 colour = [value*255 for value in pubsub_evt.data[2]]
512 i = 0 514 i = 0
  515 + print name, index, self.surface_list
513 try: 516 try:
514 i = self.surface_list.index([name, index]) 517 i = self.surface_list.index([name, index])
515 overwrite = True 518 overwrite = True
@@ -532,7 +535,7 @@ class SurfaceProperties(wx.Panel): @@ -532,7 +535,7 @@ class SurfaceProperties(wx.Panel):
532 def OnComboName(self, evt): 535 def OnComboName(self, evt):
533 surface_name = evt.GetString() 536 surface_name = evt.GetString()
534 surface_index = evt.GetSelection() 537 surface_index = evt.GetSelection()
535 - Publisher.sendMessage('Change surface selected', surface_index) 538 + Publisher.sendMessage('Change surface selected', self.surface_list[surface_index][1])
536 539
537 def OnSelectColour(self, evt): 540 def OnSelectColour(self, evt):
538 colour = [value/255.0 for value in evt.GetValue()] 541 colour = [value/255.0 for value in evt.GetValue()]