Commit 0d30f2005468d96617a8740765ed4206e810081a

Authored by Thiago Franco de Moraes
Committed by thiago
1 parent 53373521
Exists in wxgtk3_b5

The comboboxes from mask properties are working now.

The problem was that combobox must not empty.
Showing 1 changed file with 30 additions and 26 deletions   Show diff stats
invesalius/gui/task_slice.py
@@ -311,34 +311,39 @@ class MaskProperties(wx.Panel): @@ -311,34 +311,39 @@ class MaskProperties(wx.Panel):
311 ## LINE 1 311 ## LINE 1
312 312
313 # Combo related to mask naem 313 # Combo related to mask naem
314 - #combo_mask_name = wx.ComboBox(self, -1, "", choices= MASK_LIST,  
315 - #style=wx.CB_DROPDOWN|wx.CB_READONLY) 314 + combo_mask_name = wx.ComboBox(self, -1, "", choices= MASK_LIST,
  315 + style=wx.CB_DROPDOWN|wx.CB_READONLY)
316 #combo_mask_name.SetSelection(0) # wx.CB_SORT 316 #combo_mask_name.SetSelection(0) # wx.CB_SORT
317 - #if sys.platform != 'win32':  
318 - #combo_mask_name.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)  
319 - #self.combo_mask_name = combo_mask_name 317 + if sys.platform != 'win32':
  318 + combo_mask_name.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
  319 + self.combo_mask_name = combo_mask_name
320 320
321 # Mask colour 321 # Mask colour
322 - #button_colour= csel.ColourSelect(self, 111,colour=(0,255,0),size=(-1,22))  
323 - #self.button_colour = button_colour 322 + button_colour= csel.ColourSelect(self, 111,colour=(0,255,0),size=(-1,22))
  323 + self.button_colour = button_colour
324 324
325 # Sizer which represents the first line 325 # Sizer which represents the first line
326 - #line1 = wx.BoxSizer(wx.HORIZONTAL)  
327 - #line1.Add(combo_mask_name, 1, wx.EXPAND|wx.GROW|wx.TOP|wx.RIGHT, 2)  
328 - #line1.Add(button_colour, 0, wx.TOP|wx.LEFT|wx.RIGHT, 2) 326 + line1 = wx.BoxSizer(wx.HORIZONTAL)
  327 + line1.Add(combo_mask_name, 0, wx.EXPAND|wx.GROW|wx.TOP|wx.RIGHT, 2)
  328 + line1.Add(button_colour, 0, wx.TOP|wx.LEFT|wx.RIGHT, 2)
329 329
330 ### LINE 2 330 ### LINE 2
331 - #text_thresh = wx.StaticText(self, -1,  
332 - #_("Set predefined or manual threshold:")) 331 + text_thresh = wx.StaticText(self, -1,
  332 + _("Set predefined or manual threshold:"))
333 333
334 ### LINE 3 334 ### LINE 3
335 - #combo_thresh = wx.ComboBox(self, -1, "", size=(15,-1),  
336 - #choices=[],#THRESHOLD_LIST  
337 - #style=wx.CB_DROPDOWN|wx.CB_READONLY)  
338 - #combo_thresh.SetSelection(0)  
339 - #if sys.platform != 'win32':  
340 - #combo_thresh.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)  
341 - #self.combo_thresh = combo_thresh 335 + THRESHOLD_LIST = ["",]
  336 + combo_thresh = wx.ComboBox(self, -1, "", #size=(15,-1),
  337 + choices=THRESHOLD_LIST,
  338 + style=wx.CB_DROPDOWN|wx.CB_READONLY)
  339 + combo_thresh.SetSelection(0)
  340 + if sys.platform != 'win32':
  341 + combo_thresh.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
  342 + self.combo_thresh = combo_thresh
  343 +
  344 + line2 = wx.BoxSizer(wx.HORIZONTAL)
  345 + line2.Add(text_thresh, 0, wx.GROW|wx.EXPAND|wx.ALL, 5)
  346 + line2.Add(combo_thresh, 0, wx.EXPAND|wx.GROW|wx.TOP|wx.RIGHT, 2)
342 347
343 ## LINE 4 348 ## LINE 4
344 gradient = grad.GradientCtrl(self, -1, -5000, 5000, 0, 5000, 349 gradient = grad.GradientCtrl(self, -1, -5000, 5000, 0, 5000,
@@ -347,9 +352,8 @@ class MaskProperties(wx.Panel): @@ -347,9 +352,8 @@ class MaskProperties(wx.Panel):
347 352
348 # Add all lines into main sizer 353 # Add all lines into main sizer
349 sizer = wx.BoxSizer(wx.VERTICAL) 354 sizer = wx.BoxSizer(wx.VERTICAL)
350 - #sizer.Add(line1, 1, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 5)  
351 - #sizer.Add(text_thresh, 1, wx.GROW|wx.EXPAND|wx.ALL, 5)  
352 - #sizer.Add(combo_thresh, 1, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT, 5) 355 + sizer.Add(line1, 0, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 5)
  356 + sizer.Add(line2, 0, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT, 5)
353 sizer.Add(gradient, 1, wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT|wx.BOTTOM, 6) 357 sizer.Add(gradient, 1, wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT|wx.BOTTOM, 6)
354 sizer.Fit(self) 358 sizer.Fit(self)
355 359
@@ -363,7 +367,7 @@ class MaskProperties(wx.Panel): @@ -363,7 +367,7 @@ class MaskProperties(wx.Panel):
363 self.threshold_modes = proj.threshold_modes 367 self.threshold_modes = proj.threshold_modes
364 self.threshold_modes_names = [] 368 self.threshold_modes_names = []
365 self.bind_evt_gradient = True 369 self.bind_evt_gradient = True
366 - #self.__bind_events() 370 + self.__bind_events()
367 self.__bind_events_wx() 371 self.__bind_events_wx()
368 372
369 373
@@ -407,9 +411,9 @@ class MaskProperties(wx.Panel): @@ -407,9 +411,9 @@ class MaskProperties(wx.Panel):
407 def __bind_events_wx(self): 411 def __bind_events_wx(self):
408 self.Bind(grad.EVT_THRESHOLD_CHANGED, self.OnSlideChanged, self.gradient) 412 self.Bind(grad.EVT_THRESHOLD_CHANGED, self.OnSlideChanged, self.gradient)
409 self.Bind(grad.EVT_THRESHOLD_CHANGING, self.OnSlideChanging, self.gradient) 413 self.Bind(grad.EVT_THRESHOLD_CHANGING, self.OnSlideChanging, self.gradient)
410 - #self.combo_thresh.Bind(wx.EVT_COMBOBOX, self.OnComboThresh)  
411 - #self.combo_mask_name.Bind(wx.EVT_COMBOBOX, self.OnComboName)  
412 - #self.button_colour.Bind(csel.EVT_COLOURSELECT, self.OnSelectColour) 414 + self.combo_thresh.Bind(wx.EVT_COMBOBOX, self.OnComboThresh)
  415 + self.combo_mask_name.Bind(wx.EVT_COMBOBOX, self.OnComboName)
  416 + self.button_colour.Bind(csel.EVT_COLOURSELECT, self.OnSelectColour)
413 417
414 def SelectMaskName(self, pubsub_evt): 418 def SelectMaskName(self, pubsub_evt):
415 index = pubsub_evt.data 419 index = pubsub_evt.data