Commit 90e32562 authored by Guillaume Seguin's avatar Guillaume Seguin

More work on getting the gauges back

parent 89453bef
...@@ -26,6 +26,7 @@ from printrun import gviz ...@@ -26,6 +26,7 @@ from printrun import gviz
from printrun.xybuttons import XYButtons from printrun.xybuttons import XYButtons
from printrun.zbuttons import ZButtons from printrun.zbuttons import ZButtons
from printrun.graph import Graph from printrun.graph import Graph
from printrun.pronterface_widgets import TempGauge
def make_button(parent, label, callback, tooltip, container = None, size = wx.DefaultSize, style = 0): def make_button(parent, label, callback, tooltip, container = None, size = wx.DefaultSize, style = 0):
button = wx.Button(parent, -1, label, style = style, size = size) button = wx.Button(parent, -1, label, style = style, size = size)
...@@ -144,8 +145,6 @@ class LeftPane(wx.GridBagSizer): ...@@ -144,8 +145,6 @@ class LeftPane(wx.GridBagSizer):
if( '(' not in root.htemp.Value): if( '(' not in root.htemp.Value):
root.htemp.SetValue(root.htemp.Value + ' (user)') root.htemp.SetValue(root.htemp.Value + ' (user)')
#self.Add(root.btemp, pos = (4, 1), span = (1, 3))
#self.Add(root.setbbtn, pos = (4, 4), span = (1, 2))
root.tempdisp = wx.StaticText(root.panel,-1, "") root.tempdisp = wx.StaticText(root.panel,-1, "")
root.edist = wx.SpinCtrl(root.panel,-1, "5", min = 0, max = 1000, size = (60,-1)) root.edist = wx.SpinCtrl(root.panel,-1, "5", min = 0, max = 1000, size = (60,-1))
...@@ -165,22 +164,33 @@ class LeftPane(wx.GridBagSizer): ...@@ -165,22 +164,33 @@ class LeftPane(wx.GridBagSizer):
root.zfeedc.Bind(wx.EVT_SPINCTRL, root.setfeeds) root.zfeedc.Bind(wx.EVT_SPINCTRL, root.setfeeds)
root.zfeedc.SetBackgroundColour((180, 255, 180)) root.zfeedc.SetBackgroundColour((180, 255, 180))
root.zfeedc.SetForegroundColour("black") root.zfeedc.SetForegroundColour("black")
# self.Add((10, 0), pos = (0, 11), span = (1, 1))
root.display_gauges = True # FIXME : move to options or CLI options
#root.hottgauge = TempGauge(root.panel, size = (200, 24), title = _("Heater:"), maxval = 230) if root.display_gauges:
#self.Add(root.hottgauge, pos = (7, 0), span = (1, 4)) root.hottgauge = TempGauge(root.panel, size = (200, 24), title = _("Heater:"), maxval = 300)
#root.bedtgauge = TempGauge(root.panel, size = (200, 24), title = _("Bed:"), maxval = 130) self.Add(root.hottgauge, pos = (6, 0), span = (1, 6))
#self.Add(root.bedtgauge, pos = (8, 0), span = (1, 4)) root.bedtgauge = TempGauge(root.panel, size = (200, 24), title = _("Bed:"), maxval = 150)
#def scroll_setpoint(e): self.Add(root.bedtgauge, pos = (7, 0), span = (1, 6))
# if e.GetWheelRotation()>0: def hotendgauge_scroll_setpoint(e):
# root.do_settemp(str(root.hsetpoint+1)) rot = e.GetWheelRotation()
# elif e.GetWheelRotation()<0: if rot > 0:
# root.do_settemp(str(max(0, root.hsetpoint-1))) root.do_settemp(str(root.hsetpoint + 1))
#root.tgauge.Bind(wx.EVT_MOUSEWHEEL, scroll_setpoint) elif rot < 0:
root.do_settemp(str(max(0, root.hsetpoint - 1)))
def bedgauge_scroll_setpoint(e):
rot = e.GetWheelRotation()
if rot > 0:
root.do_settemp(str(root.bsetpoint + 1))
elif rot < 0:
root.do_settemp(str(max(0, root.bsetpoint - 1)))
root.hottgauge.Bind(wx.EVT_MOUSEWHEEL, hotendgauge_scroll_setpoint)
root.bedtgauge.Bind(wx.EVT_MOUSEWHEEL, bedgauge_scroll_setpoint)
self.Add(root.tempdisp, pos = (8, 0), span = (1, 6))
else:
self.Add(root.tempdisp, pos = (6, 0), span = (1, 6))
root.graph = Graph(root.panel, wx.ID_ANY) root.graph = Graph(root.panel, wx.ID_ANY)
self.Add(root.graph, pos = (4, 5), span = (2, 1)) self.Add(root.graph, pos = (4, 5), span = (2, 1))
self.Add(root.tempdisp, pos = (6, 0), span = (1, 6))
class VizPane(wx.BoxSizer): class VizPane(wx.BoxSizer):
......
...@@ -256,7 +256,7 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -256,7 +256,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
if "S" in line: if "S" in line:
try: try:
temp = float(line.split("S")[1].split("*")[0]) temp = float(line.split("S")[1].split("*")[0])
#self.hottgauge.SetTarget(temp) if self.display_gauges: wx.CallAfter(self.hottgauge.SetTarget, temp)
wx.CallAfter(self.graph.SetExtruder0TargetTemperature, temp) wx.CallAfter(self.graph.SetExtruder0TargetTemperature, temp)
except: except:
pass pass
...@@ -268,7 +268,7 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -268,7 +268,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
if "S" in line: if "S" in line:
try: try:
temp = float(line.split("S")[1].split("*")[0]) temp = float(line.split("S")[1].split("*")[0])
#self.bedtgauge.SetTarget(temp) if self.display_gauges: wx.CallAfter(self.bedtgauge.SetTarget, temp)
wx.CallAfter(self.graph.SetBedTargetTemperature, temp) wx.CallAfter(self.graph.SetBedTargetTemperature, temp)
except: except:
pass pass
...@@ -295,7 +295,7 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -295,7 +295,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
def setbedgui(self, f): def setbedgui(self, f):
self.bsetpoint = f self.bsetpoint = f
#self.bedtgauge.SetTarget(int(f)) if self.display_gauges: self.bedtgauge.SetTarget(int(f))
wx.CallAfter(self.graph.SetBedTargetTemperature, int(f)) wx.CallAfter(self.graph.SetBedTargetTemperature, int(f))
if f>0: if f>0:
wx.CallAfter(self.btemp.SetValue, str(f)) wx.CallAfter(self.btemp.SetValue, str(f))
...@@ -315,7 +315,7 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -315,7 +315,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
def sethotendgui(self, f): def sethotendgui(self, f):
self.hsetpoint = f self.hsetpoint = f
#self.hottgauge.SetTarget(int(f)) if self.display_gauges: self.hottgauge.SetTarget(int(f))
wx.CallAfter(self.graph.SetExtruder0TargetTemperature, int(f)) wx.CallAfter(self.graph.SetExtruder0TargetTemperature, int(f))
if f > 0: if f > 0:
wx.CallAfter(self.htemp.SetValue, str(f)) wx.CallAfter(self.htemp.SetValue, str(f))
...@@ -1040,17 +1040,22 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -1040,17 +1040,22 @@ class PronterWindow(MainWindow, pronsole.pronsole):
def clearOutput(self, e): def clearOutput(self, e):
self.logbox.Clear() self.logbox.Clear()
def update_tempdisplay(self):
try:
hotend_temp = parse_temperature_report(self.tempreport, "T:")
wx.CallAfter(self.graph.SetExtruder0Temperature, hotend_temp)
if self.display_gauges: wx.CallAfter(self.hottgauge.SetValue, hotend_temp)
bed_temp = parse_temperature_report(self.tempreport, "B:")
wx.CallAfter(self.graph.SetBedTemperature, bed_temp)
if self.display_gauges: wx.CallAfter(self.bedtgauge.SetValue, bed_temp)
except:
traceback.print_exc()
def statuschecker(self): def statuschecker(self):
while self.statuscheck: while self.statuscheck:
string = "" string = ""
wx.CallAfter(self.tempdisp.SetLabel, self.tempreport.strip().replace("ok ", "")) wx.CallAfter(self.tempdisp.SetLabel, self.tempreport.strip().replace("ok ", ""))
try: self.update_tempdisplay()
#self.hottgauge.SetValue(parse_temperature_report(self.tempreport, "T:"))
wx.CallAfter(self.graph.SetExtruder0Temperature, parse_temperature_report(self.tempreport, "T:"))
#self.bedtgauge.SetValue(parse_temperature_report(self.tempreport, "B:"))
wx.CallAfter(self.graph.SetBedTemperature, parse_temperature_report(self.tempreport, "B:"))
except:
pass
fractioncomplete = 0.0 fractioncomplete = 0.0
if self.sdprinting: if self.sdprinting:
fractioncomplete = float(self.percentdone / 100.0) fractioncomplete = float(self.percentdone / 100.0)
...@@ -1111,12 +1116,7 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -1111,12 +1116,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
if "T:" in l: if "T:" in l:
self.tempreport = l self.tempreport = l
wx.CallAfter(self.tempdisp.SetLabel, self.tempreport.strip().replace("ok ", "")) wx.CallAfter(self.tempdisp.SetLabel, self.tempreport.strip().replace("ok ", ""))
try: self.update_tempdisplay()
#self.hottgauge.SetValue(parse_temperature_report(self.tempreport, "T:"))
wx.CallAfter(self.graph.SetExtruder0Temperature, parse_temperature_report(self.tempreport, "T:"))
wx.CallAfter(self.graph.SetBedTemperature, parse_temperature_report(self.tempreport, "B:"))
except:
traceback.print_exc()
tstring = l.rstrip() tstring = l.rstrip()
#print tstring #print tstring
if (tstring!="ok") and (tstring!="wait") and ("ok T:" not in tstring) and (not self.p.loud): if (tstring!="ok") and (tstring!="wait") and ("ok T:" not in tstring) and (not self.p.loud):
......
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