Commit b3da9b12 authored by kliment's avatar kliment

SD Upload works.

parent d2319d8f
...@@ -12,6 +12,10 @@ if os.name=="nt": ...@@ -12,6 +12,10 @@ if os.name=="nt":
except: except:
pass pass
def dosify(name):
return os.path.split(name)[1].split(".")[0][:8]+".g"
class PronterWindow(wx.Frame): class PronterWindow(wx.Frame):
def __init__(self, filename=None,size=(800,500)): def __init__(self, filename=None,size=(800,500)):
self.filename=filename self.filename=filename
...@@ -37,7 +41,6 @@ class PronterWindow(wx.Frame): ...@@ -37,7 +41,6 @@ class PronterWindow(wx.Frame):
#Commands to implement: #Commands to implement:
#gcodes(console) move/extrude/settemp/bedtemp/extrude/reverse(control panel) #gcodes(console) move/extrude/settemp/bedtemp/extrude/reverse(control panel)
#upload
#help #help
def scanserial(self): def scanserial(self):
...@@ -296,7 +299,31 @@ class PronterWindow(wx.Frame): ...@@ -296,7 +299,31 @@ class PronterWindow(wx.Frame):
return return
self.p.startprint(self.f) self.p.startprint(self.f)
def endupload(self):
self.p.send_now("M29 ")
wx.CallAfter(self.status.SetStatusText,"File upload complete")
time.sleep(0.5)
self.p.clear=True
self.uploading=False
def uploadtrigger(self,l):
if "Writing to file" in l:
self.uploading=True
self.p.startprint(self.f)
self.p.endcb=self.endupload
self.recvlisteners.remove(self.uploadtrigger)
elif "open failed, File" in l:
self.recvlisteners.remove(self.uploadtrigger)
def upload(self,event): def upload(self,event):
if not len(self.f):
return
if not self.p.online:
return
dlg=wx.TextEntryDialog(self,"Enter a target filename in 8.3 format:","Pick SD filename",dosify(self.filename))
if dlg.ShowModal()==wx.ID_OK:
self.p.send_now("M28 "+dlg.GetValue())
self.recvlisteners+=[self.uploadtrigger]
pass pass
def pause(self,event): def pause(self,event):
......
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