Commit 1e05ec1ef8309206beb5a0a919640cd5f5fc1763

Authored by rmatsuda
2 parents a27b209f 1e982e16
Exists in master

Merge branch 'master' into icp

invesalius/gui/brain_seg_dialog.py
... ... @@ -16,6 +16,7 @@ from pubsub import pub as Publisher
16 16  
17 17 import invesalius.data.slice_ as slc
18 18 from invesalius.segmentation.brain import segment, utils
  19 +from invesalius.gui import dialogs
19 20  
20 21 HAS_THEANO = bool(importlib.util.find_spec("theano"))
21 22 HAS_PLAIDML = bool(importlib.util.find_spec("plaidml"))
... ... @@ -237,13 +238,13 @@ class BrainSegmenterDialog(wx.Dialog):
237 238 except (multiprocessing.ProcessError, OSError, ValueError) as err:
238 239 self.OnStop(None)
239 240 self.HideProgress()
240   - dlg = wx.MessageDialog(
  241 + dlg = dialogs.ErrorMessageBox(
241 242 None,
242 243 "It was not possible to start brain segmentation because:"
243 244 + "\n"
244 245 + str(err),
245 246 "Brain segmentation error",
246   - wx.ICON_ERROR | wx.OK,
  247 + # wx.ICON_ERROR | wx.OK,
247 248 )
248 249 dlg.ShowModal()
249 250  
... ... @@ -280,15 +281,15 @@ class BrainSegmenterDialog(wx.Dialog):
280 281 error, traceback = self.ps.exception
281 282 self.OnStop(None)
282 283 self.HideProgress()
283   - dlg = wx.MessageDialog(
  284 + dlg = dialogs.ErrorMessageBox(
284 285 None,
  286 + "Brain segmentation error",
285 287 "It was not possible to use brain segmentation because:"
286 288 + "\n"
287 289 + str(error)
288 290 + "\n"
289 291 + traceback,
290   - "Brain segmentation error",
291   - wx.ICON_ERROR | wx.OK,
  292 + # wx.ICON_ERROR | wx.OK,
292 293 )
293 294 dlg.ShowModal()
294 295 return
... ...
invesalius/gui/dialogs.py
... ... @@ -668,8 +668,8 @@ class MessageBox(wx.Dialog):
668 668 btnsizer.Realize()
669 669  
670 670 sizer = wx.BoxSizer(wx.VERTICAL)
671   - sizer.Add(title_label, 0, wx.ALIGN_CENTRE|wx.ALL|wx.EXPAND, 5)
672   - sizer.Add(text, 1, wx.ALIGN_CENTRE|wx.ALL|wx.EXPAND, 5)
  671 + sizer.Add(title_label, 0, wx.ALL | wx.EXPAND, 5)
  672 + sizer.Add(text, 1, wx.ALL | wx.EXPAND, 5)
673 673 sizer.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.EXPAND|wx.ALL, 5)
674 674 self.SetSizer(sizer)
675 675 sizer.Fit(self)
... ... @@ -677,6 +677,33 @@ class MessageBox(wx.Dialog):
677 677 self.ShowModal()
678 678  
679 679  
  680 +class ErrorMessageBox(wx.Dialog):
  681 + def __init__(self, parent, title, message, caption="InVesalius3 Error"):
  682 + wx.Dialog.__init__(self, parent, title=caption, style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER)
  683 +
  684 + title_label = wx.StaticText(self, -1, title)
  685 +
  686 + text = wx.TextCtrl(self, style=wx.TE_MULTILINE|wx.TE_READONLY|wx.BORDER_NONE)
  687 + text.SetValue(message)
  688 + text.SetBackgroundColour(wx.SystemSettings.GetColour(4))
  689 +
  690 + width, height = text.GetTextExtent("M"*60)
  691 + text.SetMinSize((width, -1))
  692 +
  693 + btn_ok = wx.Button(self, wx.ID_OK)
  694 + btnsizer = wx.StdDialogButtonSizer()
  695 + btnsizer.AddButton(btn_ok)
  696 + btnsizer.Realize()
  697 +
  698 + sizer = wx.BoxSizer(wx.VERTICAL)
  699 + sizer.Add(title_label, 0, wx.ALL | wx.EXPAND, 5)
  700 + sizer.Add(text, 1, wx.ALL | wx.EXPAND, 5)
  701 + sizer.Add(btnsizer, 0, wx.EXPAND | wx.ALL, 5)
  702 + self.SetSizer(sizer)
  703 + sizer.Fit(self)
  704 + self.Center()
  705 +
  706 +
680 707 def SaveChangesDialog__Old(filename):
681 708 message = _("The project %s has been modified.\nSave changes?")%filename
682 709 dlg = MessageDialog(message)
... ...
invesalius/gui/task_navigator.py
... ... @@ -215,10 +215,10 @@ class InnerFoldPanel(wx.Panel):
215 215 checkobj.Bind(wx.EVT_CHECKBOX, self.OnShowObject)
216 216 self.checkobj = checkobj
217 217  
218   - if sys.platform != 'win32':
219   - self.checkcamera.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
220   - checktrigger.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
221   - checkobj.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
  218 + # if sys.platform != 'win32':
  219 + self.checkcamera.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
  220 + checktrigger.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
  221 + checkobj.SetWindowVariant(wx.WINDOW_VARIANT_SMALL)
222 222  
223 223 line_sizer = wx.BoxSizer(wx.HORIZONTAL)
224 224 line_sizer.Add(checkcamera, 0, wx.ALIGN_LEFT | wx.RIGHT | wx.LEFT, 5)
... ...