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