Commit 3425dbfb authored by Miro Hrončok's avatar Miro Hrončok

Plater: Display a decent error message when loading a file fails

In plater, when loading a corrupted STL file, it displays traceback
in terminal but says nothing. This makes sure that it will display an actuall
GUI error message to the user.

Also added it to the SCAD load option.
parent 016cb3e2
...@@ -235,9 +235,17 @@ class StlPlater(Plater): ...@@ -235,9 +235,17 @@ class StlPlater(Plater):
def load_file(self, filename): def load_file(self, filename):
if filename.lower().endswith(".stl"): if filename.lower().endswith(".stl"):
try:
self.load_stl(filename) self.load_stl(filename)
except:
dlg = wx.MessageDialog(self, _("Loading STL file failed"), _("Error"),wx.OK)
dlg.ShowModal()
elif filename.lower().endswith(".scad"): elif filename.lower().endswith(".scad"):
try:
self.load_scad(filename) self.load_scad(filename)
except:
dlg = wx.MessageDialog(self, _("Loading OpenSCAD file failed"), _("Error"),wx.OK)
dlg.ShowModal()
def load_scad(self, name): def load_scad(self, name):
lf = open(name) lf = open(name)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment