Commit a7ddd4ef190e97ebdb92f6671b057f4369b4e8f0
1 parent
819fe60c
Exists in
wx2.9_mac
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
@@ -336,34 +336,39 @@ class MaskProperties(wx.Panel): | @@ -336,34 +336,39 @@ class MaskProperties(wx.Panel): | ||
336 | ## LINE 1 | 336 | ## LINE 1 |
337 | 337 | ||
338 | # Combo related to mask naem | 338 | # Combo related to mask naem |
339 | - #combo_mask_name = wx.ComboBox(self, -1, "", choices= MASK_LIST, | ||
340 | - #style=wx.CB_DROPDOWN|wx.CB_READONLY) | 339 | + combo_mask_name = wx.ComboBox(self, -1, "", choices= MASK_LIST, |
340 | + style=wx.CB_DROPDOWN|wx.CB_READONLY) | ||
341 | #combo_mask_name.SetSelection(0) # wx.CB_SORT | 341 | #combo_mask_name.SetSelection(0) # wx.CB_SORT |
342 | - #if sys.platform != 'win32': | ||
343 | - #combo_mask_name.SetWindowVariant(wx.WINDOW_VARIANT_SMALL) | ||
344 | - #self.combo_mask_name = combo_mask_name | 342 | + if sys.platform != 'win32': |
343 | + combo_mask_name.SetWindowVariant(wx.WINDOW_VARIANT_SMALL) | ||
344 | + self.combo_mask_name = combo_mask_name | ||
345 | 345 | ||
346 | # Mask colour | 346 | # Mask colour |
347 | - #button_colour= csel.ColourSelect(self, 111,colour=(0,255,0),size=(-1,22)) | ||
348 | - #self.button_colour = button_colour | 347 | + button_colour= csel.ColourSelect(self, 111,colour=(0,255,0),size=(-1,22)) |
348 | + self.button_colour = button_colour | ||
349 | 349 | ||
350 | # Sizer which represents the first line | 350 | # Sizer which represents the first line |
351 | - #line1 = wx.BoxSizer(wx.HORIZONTAL) | ||
352 | - #line1.Add(combo_mask_name, 1, wx.EXPAND|wx.GROW|wx.TOP|wx.RIGHT, 2) | ||
353 | - #line1.Add(button_colour, 0, wx.TOP|wx.LEFT|wx.RIGHT, 2) | 351 | + line1 = wx.BoxSizer(wx.HORIZONTAL) |
352 | + line1.Add(combo_mask_name, 0, wx.EXPAND|wx.GROW|wx.TOP|wx.RIGHT, 2) | ||
353 | + line1.Add(button_colour, 0, wx.TOP|wx.LEFT|wx.RIGHT, 2) | ||
354 | 354 | ||
355 | ### LINE 2 | 355 | ### LINE 2 |
356 | - #text_thresh = wx.StaticText(self, -1, | ||
357 | - #_("Set predefined or manual threshold:")) | 356 | + text_thresh = wx.StaticText(self, -1, |
357 | + _("Set predefined or manual threshold:")) | ||
358 | 358 | ||
359 | ### LINE 3 | 359 | ### LINE 3 |
360 | - #combo_thresh = wx.ComboBox(self, -1, "", size=(15,-1), | ||
361 | - #choices=[],#THRESHOLD_LIST | ||
362 | - #style=wx.CB_DROPDOWN|wx.CB_READONLY) | ||
363 | - #combo_thresh.SetSelection(0) | ||
364 | - #if sys.platform != 'win32': | ||
365 | - #combo_thresh.SetWindowVariant(wx.WINDOW_VARIANT_SMALL) | ||
366 | - #self.combo_thresh = combo_thresh | 360 | + THRESHOLD_LIST = ["",] |
361 | + combo_thresh = wx.ComboBox(self, -1, "", #size=(15,-1), | ||
362 | + choices=THRESHOLD_LIST, | ||
363 | + style=wx.CB_DROPDOWN|wx.CB_READONLY) | ||
364 | + combo_thresh.SetSelection(0) | ||
365 | + if sys.platform != 'win32': | ||
366 | + combo_thresh.SetWindowVariant(wx.WINDOW_VARIANT_SMALL) | ||
367 | + self.combo_thresh = combo_thresh | ||
368 | + | ||
369 | + line2 = wx.BoxSizer(wx.HORIZONTAL) | ||
370 | + line2.Add(text_thresh, 0, wx.GROW|wx.EXPAND|wx.ALL, 5) | ||
371 | + line2.Add(combo_thresh, 0, wx.EXPAND|wx.GROW|wx.TOP|wx.RIGHT, 2) | ||
367 | 372 | ||
368 | ## LINE 4 | 373 | ## LINE 4 |
369 | gradient = grad.GradientCtrl(self, -1, -5000, 5000, 0, 5000, | 374 | gradient = grad.GradientCtrl(self, -1, -5000, 5000, 0, 5000, |
@@ -372,9 +377,8 @@ class MaskProperties(wx.Panel): | @@ -372,9 +377,8 @@ class MaskProperties(wx.Panel): | ||
372 | 377 | ||
373 | # Add all lines into main sizer | 378 | # Add all lines into main sizer |
374 | sizer = wx.BoxSizer(wx.VERTICAL) | 379 | sizer = wx.BoxSizer(wx.VERTICAL) |
375 | - #sizer.Add(line1, 1, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 5) | ||
376 | - #sizer.Add(text_thresh, 1, wx.GROW|wx.EXPAND|wx.ALL, 5) | ||
377 | - #sizer.Add(combo_thresh, 1, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT, 5) | 380 | + sizer.Add(line1, 0, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 5) |
381 | + sizer.Add(line2, 0, wx.GROW|wx.EXPAND|wx.LEFT|wx.RIGHT, 5) | ||
378 | sizer.Add(gradient, 1, wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT|wx.BOTTOM, 6) | 382 | sizer.Add(gradient, 1, wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT|wx.BOTTOM, 6) |
379 | sizer.Fit(self) | 383 | sizer.Fit(self) |
380 | 384 | ||
@@ -388,7 +392,7 @@ class MaskProperties(wx.Panel): | @@ -388,7 +392,7 @@ class MaskProperties(wx.Panel): | ||
388 | self.threshold_modes = proj.threshold_modes | 392 | self.threshold_modes = proj.threshold_modes |
389 | self.threshold_modes_names = [] | 393 | self.threshold_modes_names = [] |
390 | self.bind_evt_gradient = True | 394 | self.bind_evt_gradient = True |
391 | - #self.__bind_events() | 395 | + self.__bind_events() |
392 | self.__bind_events_wx() | 396 | self.__bind_events_wx() |
393 | 397 | ||
394 | 398 | ||
@@ -432,9 +436,9 @@ class MaskProperties(wx.Panel): | @@ -432,9 +436,9 @@ class MaskProperties(wx.Panel): | ||
432 | def __bind_events_wx(self): | 436 | def __bind_events_wx(self): |
433 | self.Bind(grad.EVT_THRESHOLD_CHANGED, self.OnSlideChanged, self.gradient) | 437 | self.Bind(grad.EVT_THRESHOLD_CHANGED, self.OnSlideChanged, self.gradient) |
434 | self.Bind(grad.EVT_THRESHOLD_CHANGING, self.OnSlideChanging, self.gradient) | 438 | self.Bind(grad.EVT_THRESHOLD_CHANGING, self.OnSlideChanging, self.gradient) |
435 | - #self.combo_thresh.Bind(wx.EVT_COMBOBOX, self.OnComboThresh) | ||
436 | - #self.combo_mask_name.Bind(wx.EVT_COMBOBOX, self.OnComboName) | ||
437 | - #self.button_colour.Bind(csel.EVT_COLOURSELECT, self.OnSelectColour) | 439 | + self.combo_thresh.Bind(wx.EVT_COMBOBOX, self.OnComboThresh) |
440 | + self.combo_mask_name.Bind(wx.EVT_COMBOBOX, self.OnComboName) | ||
441 | + self.button_colour.Bind(csel.EVT_COLOURSELECT, self.OnSelectColour) | ||
438 | 442 | ||
439 | def SelectMaskName(self, pubsub_evt): | 443 | def SelectMaskName(self, pubsub_evt): |
440 | index = pubsub_evt.data | 444 | index = pubsub_evt.data |