Cleanup status check in pronterface
parent
75fc0140ae
commit
3ba713e5d0
|
@ -102,6 +102,7 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
|
|||
self.panel=wx.Panel(self,-1,size=size)
|
||||
|
||||
self.statuscheck=False
|
||||
self.status_thread=None
|
||||
self.capture_skip={}
|
||||
self.capture_skip_newline=False
|
||||
self.tempreport=""
|
||||
|
@ -1259,7 +1260,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
|
|||
raise
|
||||
|
||||
def kill(self,e):
|
||||
self.statuscheck=0
|
||||
self.statuscheck = False
|
||||
self.status_thread.join()
|
||||
self.p.recvcb=None
|
||||
self.p.disconnect()
|
||||
if hasattr(self,"feedrates_changed"):
|
||||
|
@ -1322,15 +1324,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
|
|||
|
||||
def statuschecker(self):
|
||||
try:
|
||||
while(self.statuscheck):
|
||||
while self.statuscheck:
|
||||
string = ""
|
||||
#if(self.p.online):
|
||||
# string+=_("Printer is online. ")
|
||||
#try:
|
||||
# string+=_("Loaded ")+os.path.split(self.filename)[1]+" "
|
||||
#except:
|
||||
# pass
|
||||
#string+=(self.tempreport.replace("\r","").replace("T:",_("Hotend") + ":").replace("B:",_("Bed") + ":").replace("\n","").replace("ok ",""))+" "
|
||||
wx.CallAfter(self.tempdisp.SetLabel,self.tempreport.strip().replace("ok ",""))
|
||||
try:
|
||||
#self.hottgauge.SetValue(parse_temperature_report(self.tempreport, "T:"))
|
||||
|
@ -1351,8 +1346,8 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
|
|||
secondselapsed = int(time.time() - self.starttime + self.extra_print_time)
|
||||
secondsestimate = secondselapsed / fractioncomplete
|
||||
secondsremain = secondsestimate - secondselapsed
|
||||
string+= _(" Est: %s of %s remaining | ") % (time.strftime('%H:%M:%S', time.gmtime(secondsremain)),
|
||||
time.strftime('%H:%M:%S', time.gmtime(secondsestimate)))
|
||||
string += _(" Est: %s of %s remaining | ") % (format_time(secondsremain),
|
||||
format_time(secondsestimate))
|
||||
string += _(" Z: %0.2f mm") % self.curlayer
|
||||
wx.CallAfter(self.status.SetStatusText, string)
|
||||
wx.CallAfter(self.gviz.Refresh)
|
||||
|
@ -1699,12 +1694,14 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
|
|||
self.set("port",port)
|
||||
if baud != self.settings.baudrate:
|
||||
self.set("baudrate",str(baud))
|
||||
threading.Thread(target=self.statuschecker).start()
|
||||
self.status_thread = threading.Thread(target = self.statuschecker)
|
||||
self.status_thread.start()
|
||||
|
||||
def disconnect(self,event):
|
||||
print _("Disconnected.")
|
||||
self.p.disconnect()
|
||||
self.statuscheck = False
|
||||
self.status_thread.join()
|
||||
|
||||
self.connectbtn.SetLabel("Connect")
|
||||
self.connectbtn.SetToolTip(wx.ToolTip("Connect to the printer"))
|
||||
|
|
Loading…
Reference in New Issue