diff --git a/invesalius/control.py b/invesalius/control.py index 8742a28..01f59cd 100755 --- a/invesalius/control.py +++ b/invesalius/control.py @@ -246,18 +246,21 @@ class Controller(): def OnLoadImportPanel(self, evt): patient_series = evt.data - self.LoadImportPanel(patient_series) - ps.Publisher().sendMessage('Show import panel') - ps.Publisher().sendMessage("Show import panel in frame") + ok = self.LoadImportPanel(patient_series) + if ok: + ps.Publisher().sendMessage('Show import panel') + ps.Publisher().sendMessage("Show import panel in frame") def LoadImportPanel(self, patient_series): - if isinstance(patient_series, list): + if patient_series and isinstance(patient_series, list): ps.Publisher().sendMessage("Load import panel", patient_series) first_patient = patient_series[0] ps.Publisher().sendMessage("Load dicom preview", first_patient) + return True else: - print "No DICOM files on directory" + dialog.ImportInvalidFiles() + return False def OnImportMedicalImages(self, pubsub_evt): directory = pubsub_evt.data diff --git a/invesalius/gui/dialogs.py b/invesalius/gui/dialogs.py index 72e275e..b0c3578 100644 --- a/invesalius/gui/dialogs.py +++ b/invesalius/gui/dialogs.py @@ -263,27 +263,37 @@ def SaveChangesDialog__Old(filename): def ImportEmptyDirectory(dirpath): + msg = "%s is an empty directory." % dirpath if sys.platform == 'darwin': dlg = wx.MessageDialog(None, "", - "%s is an empty directory." % dirpath, + msg, wx.ICON_INFORMATION | wx.OK) else: - dlg = wx.MessageDialog(None, "%s is an empty directory." % dirpath, + dlg = wx.MessageDialog(None, msg, "InVesalius 3", wx.ICON_INFORMATION | wx.OK) dlg.ShowModal() dlg.Destroy() - +def ImportInvalidFiles(): + msg = "There are no DICOM files on the selected directory." + if sys.platform == 'darwin': + dlg = wx.MessageDialog(None, "", msg, + wx.ICON_INFORMATION | wx.OK) + else: + dlg = wx.MessageDialog(None, msg, "InVesalius 3", + wx.ICON_INFORMATION | wx.OK) + dlg.ShowModal() + dlg.Destroy() def SaveChangesDialog(filename): current_dir = os.path.abspath(".") + msg = "Save changes to %s?"%filename if sys.platform == 'darwin': - dlg = wx.MessageDialog(None, "", - "Save changes to %s?"%filename, + dlg = wx.MessageDialog(None, "", msg, wx.ICON_QUESTION | wx.YES_NO | wx.CANCEL) else: - dlg = wx.MessageDialog(None, "Save changes to %s?"%filename, + dlg = wx.MessageDialog(None, msg, "InVesalius 3", wx.ICON_QUESTION | wx.YES_NO | wx.CANCEL) @@ -300,12 +310,12 @@ def SaveChangesDialog(filename): def SaveChangesDialog2(filename): current_dir = os.path.abspath(".") + msg = "Save changes to %s?"%filename if sys.platform == 'darwin': - dlg = wx.MessageDialog(None, "", - "Save changes to %s?"%filename, + dlg = wx.MessageDialog(None, "", msg, wx.ICON_QUESTION | wx.YES_NO) else: - dlg = wx.MessageDialog(None, "Save changes to %s?"%filename, + dlg = wx.MessageDialog(None, msg, "InVesalius 3", wx.ICON_QUESTION | wx.YES_NO) -- libgit2 0.21.2