Use callafter to avoid threading issues on gtk
parent
a4f36d1359
commit
642c6dad9e
|
@ -203,20 +203,20 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
|
||||||
self.hsetpoint=f
|
self.hsetpoint=f
|
||||||
#self.tgauge.SetTarget(int(f))
|
#self.tgauge.SetTarget(int(f))
|
||||||
if f>0:
|
if f>0:
|
||||||
self.htemp.SetValue(l)
|
wx.CallAfter(self.htemp.SetValue,l)
|
||||||
self.set("last_temperature",str(f))
|
self.set("last_temperature",str(f))
|
||||||
self.settoff.SetBackgroundColour("")
|
wx.CallAfter(self.settoff.SetBackgroundColour,"")
|
||||||
self.settoff.SetForegroundColour("")
|
wx.CallAfter(self.settoff.SetForegroundColour,"")
|
||||||
self.settbtn.SetBackgroundColour("#FFAA66")
|
wx.CallAfter(self.settbtn.SetBackgroundColour,"#FFAA66")
|
||||||
self.settbtn.SetForegroundColour("#660000")
|
wx.CallAfter(self.settbtn.SetForegroundColour,"#660000")
|
||||||
self.htemp.SetBackgroundColour("#FFDABB")
|
wx.CallAfter(self.htemp.SetBackgroundColour,"#FFDABB")
|
||||||
else:
|
else:
|
||||||
self.settoff.SetBackgroundColour("#0044CC")
|
wx.CallAfter(self.settoff.SetBackgroundColour,"#0044CC")
|
||||||
self.settoff.SetForegroundColour("white")
|
wx.CallAfter(self.settoff.SetForegroundColour,"white")
|
||||||
self.settbtn.SetBackgroundColour("")
|
wx.CallAfter(self.settbtn.SetBackgroundColour,"")
|
||||||
self.settbtn.SetForegroundColour("")
|
wx.CallAfter(self.settbtn.SetForegroundColour,"")
|
||||||
self.htemp.SetBackgroundColour("white")
|
wx.CallAfter(self.htemp.SetBackgroundColour,"white")
|
||||||
self.htemp.Refresh()
|
wx.CallAfter(self.htemp.Refresh)
|
||||||
else:
|
else:
|
||||||
print _("Printer is not online.")
|
print _("Printer is not online.")
|
||||||
else:
|
else:
|
||||||
|
@ -238,20 +238,20 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
|
||||||
print _("Setting bed temperature to "),f,_(" degrees Celsius.")
|
print _("Setting bed temperature to "),f,_(" degrees Celsius.")
|
||||||
self.bsetpoint=f
|
self.bsetpoint=f
|
||||||
if f>0:
|
if f>0:
|
||||||
self.btemp.SetValue(l)
|
wx.CallAfter(self.btemp.SetValue,l)
|
||||||
self.set("last_bed_temperature",str(f))
|
self.set("last_bed_temperature",str(f))
|
||||||
self.setboff.SetBackgroundColour("")
|
wx.CallAfter(self.setboff.SetBackgroundColour,"")
|
||||||
self.setboff.SetForegroundColour("")
|
wx.CallAfter(self.setboff.SetForegroundColour,"")
|
||||||
self.setbbtn.SetBackgroundColour("#FFAA66")
|
wx.CallAfter(self.setbbtn.SetBackgroundColour,"#FFAA66")
|
||||||
self.setbbtn.SetForegroundColour("#660000")
|
wx.CallAfter(self.setbbtn.SetForegroundColour,"#660000")
|
||||||
self.btemp.SetBackgroundColour("#FFDABB")
|
wx.CallAfter(self.btemp.SetBackgroundColour,"#FFDABB")
|
||||||
else:
|
else:
|
||||||
self.setboff.SetBackgroundColour("#0044CC")
|
wx.CallAfter(self.setboff.SetBackgroundColour,"#0044CC")
|
||||||
self.setboff.SetForegroundColour("white")
|
wx.CallAfter(self.setboff.SetForegroundColour,"white")
|
||||||
self.setbbtn.SetBackgroundColour("")
|
wx.CallAfter(self.setbbtn.SetBackgroundColour,"")
|
||||||
self.setbbtn.SetForegroundColour("")
|
wx.CallAfter(self.setbbtn.SetForegroundColour,"")
|
||||||
self.btemp.SetBackgroundColour("white")
|
wx.CallAfter(self.btemp.SetBackgroundColour,"white")
|
||||||
self.btemp.Refresh()
|
wx.CallAfter(self.btemp.Refresh)
|
||||||
else:
|
else:
|
||||||
print _("Printer is not online.")
|
print _("Printer is not online.")
|
||||||
else:
|
else:
|
||||||
|
@ -1076,11 +1076,11 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
|
||||||
if l.strip()=="":
|
if l.strip()=="":
|
||||||
self.monitorbox.SetValue(not self.monitorbox.GetValue())
|
self.monitorbox.SetValue(not self.monitorbox.GetValue())
|
||||||
elif l.strip()=="off":
|
elif l.strip()=="off":
|
||||||
self.monitorbox.SetValue(False)
|
wx.CallAfter(self.monitorbox.SetValue,False)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
self.monitor_interval=float(l)
|
self.monitor_interval=float(l)
|
||||||
self.monitorbox.SetValue(self.monitor_interval>0)
|
wx.CallAfter(self.monitorbox.SetValue,self.monitor_interval>0)
|
||||||
except:
|
except:
|
||||||
print _("Invalid period given.")
|
print _("Invalid period given.")
|
||||||
self.setmonitor(None)
|
self.setmonitor(None)
|
||||||
|
|
Loading…
Reference in New Issue