Commit 1289f0e2e312ea02fa2b1ff03c22aa06aa51ace1

Authored by tfmoraes
1 parent 9a65a341

ENH: Showing an info icon about not be possible to use default method to the cre…

…ation of a new surface
Showing 1 changed file with 26 additions and 14 deletions   Show diff stats
invesalius/gui/dialogs.py
... ... @@ -1045,8 +1045,8 @@ class SurfaceCreationDialog(wx.Dialog):
1045 1045 btnsizer.Realize()
1046 1046  
1047 1047 sizer_panels = wx.BoxSizer(wx.HORIZONTAL)
1048   - sizer_panels.Add(surface_method_sizer, 0, wx.EXPAND|wx.ALL, 5)
1049 1048 sizer_panels.Add(surface_options_sizer, 0, wx.EXPAND|wx.ALL, 5)
  1049 + sizer_panels.Add(surface_method_sizer, 0, wx.EXPAND|wx.ALL, 5)
1050 1050  
1051 1051 sizer = wx.BoxSizer(wx.VERTICAL)
1052 1052 sizer.Add(sizer_panels, 0, wx.ALIGN_RIGHT|wx.ALL, 5)
... ... @@ -1062,13 +1062,10 @@ class SurfaceCreationDialog(wx.Dialog):
1062 1062 self.ca.mask_edited = mask.was_edited
1063 1063 self.ca.ReloadMethodsOptions()
1064 1064  
1065   -
1066   -
1067 1065 def GetValue(self):
1068 1066 return {"method": self.ca.GetValue(),
1069 1067 "options": self.nsd.GetValue()}
1070 1068  
1071   -
1072 1069 class SurfaceCreationOptionsPanel(wx.Panel):
1073 1070 def __init__(self, parent, ID=-1):
1074 1071 import constants as const
... ... @@ -1232,28 +1229,39 @@ class SurfaceMethodPanel(wx.Panel):
1232 1229  
1233 1230 def _build_widgets(self):
1234 1231 self.ca_options = CAOptions(self)
  1232 +
1235 1233 self.cb_types = wx.ComboBox(self, -1, _(u'Default'),
1236 1234 choices=[i for i in sorted(self.alg_types)
1237 1235 if not (self.mask_edited and i in self.edited_imp)],
1238 1236 style=wx.CB_READONLY)
1239   - if self.mask_edited:
1240   - self.cb_types.SetValue(_(u'Context aware smoothing'))
1241   - self.ca_options.Enable()
1242   - else:
1243   - self.ca_options.Disable()
  1237 + w, h = self.cb_types.GetSizeTuple()
1244 1238  
  1239 + icon = wx.ArtProvider.GetBitmap(wx.ART_INFORMATION, wx.ART_MESSAGE_BOX,
  1240 + (h * 0.8, h * 0.8))
  1241 + self.bmp = wx.StaticBitmap(self, -1, icon)
  1242 + self.bmp.SetToolTipString(_("It's not possible to use the Default method because the mask was edited"))
1245 1243  
1246   - method_sizer = wx.BoxSizer(wx.HORIZONTAL)
1247   - method_sizer.Add(wx.StaticText(self, -1, u'Method:'), 0,
1248   - wx.EXPAND | wx.ALL, 5)
1249   - method_sizer.Add(self.cb_types, 0, wx.EXPAND)
  1244 + self.method_sizer = wx.BoxSizer(wx.HORIZONTAL)
  1245 + self.method_sizer.Add(wx.StaticText(self, -1, u'Method:'), 0,
  1246 + wx.EXPAND | wx.ALL, 5)
  1247 + self.method_sizer.Add(self.cb_types, 1, wx.EXPAND)
  1248 + self.method_sizer.Add(self.bmp, 0, wx.EXPAND|wx.ALL, 5)
1250 1249  
1251 1250 self.main_sizer = wx.BoxSizer(wx.VERTICAL)
1252   - self.main_sizer.Add(method_sizer, 0, wx.EXPAND | wx.ALL, 5)
  1251 + self.main_sizer.Add(self.method_sizer, 0, wx.EXPAND | wx.ALL, 5)
1253 1252 self.main_sizer.Add(self.ca_options, 0, wx.EXPAND | wx.ALL, 5)
1254 1253  
1255 1254 self.SetSizer(self.main_sizer)
  1255 + self.Layout()
1256 1256 self.Fit()
  1257 +
  1258 + if self.mask_edited:
  1259 + self.cb_types.SetValue(_(u'Context aware smoothing'))
  1260 + self.ca_options.Enable()
  1261 + self.method_sizer.Show(self.bmp)
  1262 + else:
  1263 + self.ca_options.Disable()
  1264 + self.method_sizer.Hide(self.bmp)
1257 1265  
1258 1266 def _bind_wx(self):
1259 1267 self.cb_types.Bind(wx.EVT_COMBOBOX, self._set_cb_types)
... ... @@ -1296,6 +1304,10 @@ class SurfaceMethodPanel(wx.Panel):
1296 1304 if self.mask_edited:
1297 1305 self.cb_types.SetValue(_(u'Context aware smoothing'))
1298 1306 self.ca_options.Enable()
  1307 + self.method_sizer.Show(self.bmp)
1299 1308 else:
1300 1309 self.cb_types.SetValue(_(u'Default'))
1301 1310 self.ca_options.Disable()
  1311 + self.method_sizer.Hide(self.bmp)
  1312 +
  1313 + self.method_sizer.Layout()
... ...