parent
97a530d53b
commit
013c9f0bec
14
pronsole.py
14
pronsole.py
|
@ -19,6 +19,20 @@ except:
|
||||||
def dosify(name):
|
def dosify(name):
|
||||||
return os.path.split(name)[1].split(".")[0][:8]+".g"
|
return os.path.split(name)[1].split(".")[0][:8]+".g"
|
||||||
|
|
||||||
|
def totalelength(g):
|
||||||
|
tot=0
|
||||||
|
cur=0
|
||||||
|
for i in g:
|
||||||
|
if "E" in i and ("G1" in i or "G0" in i):
|
||||||
|
try:
|
||||||
|
cur=float(i.split("E")[1].split(" ")[0])
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
elif "G92" in i and "E0" in i:
|
||||||
|
tot+=cur
|
||||||
|
return tot
|
||||||
|
|
||||||
|
|
||||||
class Settings:
|
class Settings:
|
||||||
#def _temperature_alias(self): return {"pla":210,"abs":230,"off":0}
|
#def _temperature_alias(self): return {"pla":210,"abs":230,"off":0}
|
||||||
#def _temperature_validate(self,v):
|
#def _temperature_validate(self,v):
|
||||||
|
|
|
@ -121,7 +121,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
|
||||||
self.mini=False
|
self.mini=False
|
||||||
self.p.sendcb=self.sentcb
|
self.p.sendcb=self.sentcb
|
||||||
self.p.startcb=self.startcb
|
self.p.startcb=self.startcb
|
||||||
#self.p.endcb=self.endcb
|
self.p.endcb=self.endcb
|
||||||
self.starttime=0
|
self.starttime=0
|
||||||
self.curlayer=0
|
self.curlayer=0
|
||||||
self.cur_button=None
|
self.cur_button=None
|
||||||
|
@ -130,9 +130,11 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
|
||||||
self.starttime=time.time()
|
self.starttime=time.time()
|
||||||
|
|
||||||
def endcb(self):
|
def endcb(self):
|
||||||
print "Print took "+str(int(time.time()-self.starttime)/60)+" minutes."
|
if(self.p.queueindex==0):
|
||||||
wx.CallAfter(self.pausebtn.Hide)
|
print "Print took "+str(int(time.time()-self.starttime)/60)+" minutes "+str(int(time.time()-self.starttime)%60)+" seconds"
|
||||||
wx.CallAfter(self.printbtn.SetLabel,"Print")
|
wx.CallAfter(self.pausebtn.Disable)
|
||||||
|
wx.CallAfter(self.printbtn.SetLabel,"Print")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def online(self):
|
def online(self):
|
||||||
|
@ -524,7 +526,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
|
||||||
self.topsizer.Fit(self)
|
self.topsizer.Fit(self)
|
||||||
|
|
||||||
# disable all printer controls until we connect to a printer
|
# disable all printer controls until we connect to a printer
|
||||||
self.pausebtn.Hide()
|
self.pausebtn.Disable()
|
||||||
for i in self.printerControls:
|
for i in self.printerControls:
|
||||||
i.Disable()
|
i.Disable()
|
||||||
|
|
||||||
|
@ -934,7 +936,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
|
||||||
wx.CallAfter(self.printbtn.Enable)
|
wx.CallAfter(self.printbtn.Enable)
|
||||||
|
|
||||||
wx.CallAfter(self.status.SetStatusText,"Loaded "+self.filename+", %d lines"%(len(self.f),))
|
wx.CallAfter(self.status.SetStatusText,"Loaded "+self.filename+", %d lines"%(len(self.f),))
|
||||||
wx.CallAfter(self.pausebtn.Hide)
|
wx.CallAfter(self.pausebtn.Disable)
|
||||||
wx.CallAfter(self.printbtn.SetLabel,"Print")
|
wx.CallAfter(self.printbtn.SetLabel,"Print")
|
||||||
|
|
||||||
threading.Thread(target=self.loadviz).start()
|
threading.Thread(target=self.loadviz).start()
|
||||||
|
@ -981,12 +983,13 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
|
||||||
self.status.SetStatusText("Loaded "+name+", %d lines"%(len(self.f),))
|
self.status.SetStatusText("Loaded "+name+", %d lines"%(len(self.f),))
|
||||||
wx.CallAfter(self.printbtn.SetLabel, "Print")
|
wx.CallAfter(self.printbtn.SetLabel, "Print")
|
||||||
wx.CallAfter(self.pausebtn.SetLabel, "Pause")
|
wx.CallAfter(self.pausebtn.SetLabel, "Pause")
|
||||||
wx.CallAfter(self.pausebtn.Hide)
|
wx.CallAfter(self.pausebtn.Disable)
|
||||||
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()
|
||||||
|
|
||||||
def loadviz(self):
|
def loadviz(self):
|
||||||
|
print pronsole.totalelength(self.f),"mm of filament used in this print"
|
||||||
self.gviz.clear()
|
self.gviz.clear()
|
||||||
self.gwindow.p.clear()
|
self.gwindow.p.clear()
|
||||||
for i in self.f:
|
for i in self.f:
|
||||||
|
@ -1107,7 +1110,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
|
||||||
|
|
||||||
wx.CallAfter(self.connectbtn.Enable);
|
wx.CallAfter(self.connectbtn.Enable);
|
||||||
wx.CallAfter(self.printbtn.Disable);
|
wx.CallAfter(self.printbtn.Disable);
|
||||||
wx.CallAfter(self.pausebtn.Hide);
|
wx.CallAfter(self.pausebtn.Disable);
|
||||||
for i in self.printerControls:
|
for i in self.printerControls:
|
||||||
wx.CallAfter(i.Disable)
|
wx.CallAfter(i.Disable)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue