From 93ce14c0750da0e4e313f9810694da70f7916d7c Mon Sep 17 00:00:00 2001 From: Thiago Franco de Moraes Date: Tue, 28 Mar 2017 13:56:50 -0300 Subject: [PATCH] Added error messages when importing surface file --- invesalius/data/surface.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/invesalius/data/surface.py b/invesalius/data/surface.py index 155a107..8845085 100644 --- a/invesalius/data/surface.py +++ b/invesalius/data/surface.py @@ -260,15 +260,18 @@ class SurfaceManager(): elif filename.lower().endswith('.vtp'): reader = vtk.vtkXMLPolyDataReader() else: + wx.MessageBox(_("File format not reconized by InVesalius"), _("Import surface error")) return reader.SetFileName(filename) reader.Update() polydata = reader.GetOutput() - name = os.path.splitext(os.path.split(filename)[-1])[0] - - self.CreateSurfaceFromPolydata(polydata, name=name) + if polydata.GetNumberOfPoints() == 0: + wx.MessageBox(_("InVesalius was not able to import this surface"), _("Import surface error")) + else: + name = os.path.splitext(os.path.split(filename)[-1])[0] + self.CreateSurfaceFromPolydata(polydata, name=name) def CreateSurfaceFromPolydata(self, polydata, overwrite=False, name=None, colour=None, -- libgit2 0.21.2