Commit c2a60d20 authored by Guillaume Seguin's avatar Guillaume Seguin

Cleanup loadfile(), some tabs/space mixing might explain #370

parent 27759e3f
......@@ -1373,19 +1373,18 @@ class PronterWindow(MainWindow, pronsole.pronsole):
basedir = os.path.split(self.filename)[0]
except:
pass
dlg=None
if filename is None:
dlg = wx.FileDialog(self, _("Open file to print"), basedir, style = wx.FD_OPEN|wx.FD_FILE_MUST_EXIST)
dlg.SetWildcard(_("OBJ, STL, and GCODE files (*.gcode;*.gco;*.g;*.stl;*.STL;*.obj;*.OBJ)|*.gcode;*.gco;*.g;*.stl;*.STL;*.obj;*.OBJ|All Files (*.*)|*.*"))
if(filename is not None or dlg.ShowModal() == wx.ID_OK):
if filename is not None:
dlg = None
if filename is None:
dlg = wx.FileDialog(self, _("Open file to print"), basedir, style = wx.FD_OPEN|wx.FD_FILE_MUST_EXIST)
dlg.SetWildcard(_("OBJ, STL, and GCODE files (*.gcode;*.gco;*.g;*.stl;*.STL;*.obj;*.OBJ)|*.gcode;*.gco;*.g;*.stl;*.STL;*.obj;*.OBJ|All Files (*.*)|*.*"))
if filename or dlg.ShowModal() == wx.ID_OK:
if filename:
name = filename
else:
name = dlg.GetPath()
if not(os.path.exists(name)):
dlg.Destroy()
if not os.path.exists(name):
self.status.SetStatusText(_("File not found!"))
if dlg is not None:
dlg.Destroy()
return
path = os.path.split(name)[0]
if path != self.settings.last_file_path:
......@@ -1407,8 +1406,8 @@ class PronterWindow(MainWindow, pronsole.pronsole):
if self.p.online:
wx.CallAfter(self.printbtn.Enable)
threading.Thread(target = self.loadviz).start()
if dlg is not None:
dlg.Destroy()
else:
dlg.Destroy()
def loadviz(self):
gcode = self.fgcode
......
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