Commit 79af67f1 authored by Guillaume Seguin's avatar Guillaume Seguin

Refactor PronterWindow.sentcb

parent e00311ab
...@@ -245,47 +245,31 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -245,47 +245,31 @@ class PronterWindow(MainWindow, pronsole.pronsole):
wx.CallAfter(self.printbtn.Enable) wx.CallAfter(self.printbtn.Enable)
def sentcb(self, line): def sentcb(self, line):
if "G1" in line: gline = gcoder.Line(line)
if "Z" in line: gline.parse_coordinates(imperial = False)
try: if gline.is_move:
layer = float(line.split("Z")[1].split()[0].split("*")[0]) if gline.z != None:
layer = gline.z
if layer != self.curlayer: if layer != self.curlayer:
self.curlayer = layer self.curlayer = layer
self.gviz.hilight.clear() self.gviz.hilight.clear()
self.gviz.hilightarcs.clear() self.gviz.hilightarcs.clear()
threading.Thread(target = wx.CallAfter, args = (self.gviz.setlayer, layer)).start() wx.CallAfter(self.gviz.setlayer, layer)
except: elif gline.command in ["M104", "M109"]:
pass gline.parse_coordinates(imperial = False, force = True)
try: if gline.s != None:
self.sentlines.put_nowait(line) temp = gline.s
except Queue.Full:
pass
#threading.Thread(target = self.gviz.addgcode, args = (line, 1)).start()
#self.gwindow.p.addgcode(line, hilight = 1)
if "M104" in line or "M109" in line:
if "S" in line:
try:
temp = float(line.split("S")[1].split("*")[0])
if self.display_gauges: wx.CallAfter(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: elif gline.command == "M140":
pass gline.parse_coordinates(imperial = False, force = True)
try: if gline.s != None:
self.sentlines.put_nowait(line) temp = gline.s
except:
pass
if "M140" in line:
if "S" in line:
try:
temp = float(line.split("S")[1].split("*")[0])
if self.display_gauges: wx.CallAfter(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: else:
pass return
try:
self.sentlines.put_nowait(line) self.sentlines.put_nowait(line)
except:
pass
def do_extrude(self, l = ""): def do_extrude(self, l = ""):
try: try:
......
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