Commit f8262789 authored by Guillaume Seguin's avatar Guillaume Seguin

Rename gviz.addgcode to addgcodehilight, remove non-highlight codepaths

parent 4b4e4a2b
...@@ -298,7 +298,7 @@ class GcodeViewMainWrapper(object): ...@@ -298,7 +298,7 @@ class GcodeViewMainWrapper(object):
self.objects[0].model = self.platform self.objects[0].model = self.platform
wx.CallAfter(self.Refresh) wx.CallAfter(self.Refresh)
def addgcode(self, *a): def addgcodehighlight(self, *a):
pass pass
def setlayer(self, *a): def setlayer(self, *a):
......
...@@ -464,7 +464,7 @@ class Gviz(wx.Panel): ...@@ -464,7 +464,7 @@ class Gviz(wx.Panel):
self.dirty = 1 self.dirty = 1
wx.CallAfter(self.Refresh) wx.CallAfter(self.Refresh)
def addgcode(self, gcode = "M105", hilight = 0): def addgcodehighlight(self, gcode = "M105"):
gcode = gcode.split("*")[0] gcode = gcode.split("*")[0]
gcode = gcode.split(";")[0] gcode = gcode.split(";")[0]
gcode = gcode.lower().strip() gcode = gcode.lower().strip()
...@@ -481,7 +481,7 @@ class Gviz(wx.Panel): ...@@ -481,7 +481,7 @@ class Gviz(wx.Panel):
if gline.command not in ["G0", "G1", "G2", "G3"]: if gline.command not in ["G0", "G1", "G2", "G3"]:
return return
start_pos = self.hilightpos[:] if hilight else self.lastpos[:] start_pos = self.hilightpos[:]
target = start_pos[:] target = start_pos[:]
target[5] = 0.0 target[5] = 0.0
...@@ -494,20 +494,8 @@ class Gviz(wx.Panel): ...@@ -494,20 +494,8 @@ class Gviz(wx.Panel):
if gline.i is not None: target[5] = gline.i if gline.i is not None: target[5] = gline.i
if gline.j is not None: target[6] = gline.j if gline.j is not None: target[6] = gline.j
z = target[2]
if not hilight and z not in self.layers:
self.lines[z] = []
self.pens[z] = []
self.arcs[z] = []
self.arcpens[z] = []
self.layers.append(z)
if gline.command in ["G0", "G1"]: if gline.command in ["G0", "G1"]:
line = [_x(start_pos[0]), _y(start_pos[1]), _x(target[0]), _y(target[1])] line = [_x(start_pos[0]), _y(start_pos[1]), _x(target[0]), _y(target[1])]
if not hilight:
self.lines[z].append((_x(start_pos[0]), _y(start_pos[1]), _x(target[0]), _y(target[1])))
self.pens[z].append(self.mainpen if target[3] != self.lastpos[3] else self.travelpen)
else:
self.hilight.append(line) self.hilight.append(line)
self.hilightqueue.put_nowait(line) self.hilightqueue.put_nowait(line)
elif gline.command in ["G2", "G3"]: elif gline.command in ["G2", "G3"]:
...@@ -518,17 +506,9 @@ class Gviz(wx.Panel): ...@@ -518,17 +506,9 @@ class Gviz(wx.Panel):
if gline.command == "G2": # clockwise, reverse endpoints if gline.command == "G2": # clockwise, reverse endpoints
arc[0], arc[1], arc[2], arc[3] = arc[2], arc[3], arc[0], arc[1] arc[0], arc[1], arc[2], arc[3] = arc[2], arc[3], arc[0], arc[1]
if not hilight:
self.arcs[z].append(arc)
self.arcpens[z].append(self.arcpen)
else:
self.hilightarcs.append(arc) self.hilightarcs.append(arc)
self.hilightarcsqueue.put_nowait(arc) self.hilightarcsqueue.put_nowait(arc)
if not hilight:
self.lastpos = target
self.dirty = 1
else:
self.hilightpos = target self.hilightpos = target
wx.CallAfter(self.Refresh) wx.CallAfter(self.Refresh)
......
...@@ -1540,7 +1540,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>.""" ...@@ -1540,7 +1540,7 @@ Printrun. If not, see <http://www.gnu.org/licenses/>."""
try: try:
while not self.sentlines.empty(): while not self.sentlines.empty():
gc = self.sentlines.get_nowait() gc = self.sentlines.get_nowait()
wx.CallAfter(self.gviz.addgcode, gc, 1) wx.CallAfter(self.gviz.addgcodehighlight, gc)
self.sentlines.task_done() self.sentlines.task_done()
except Queue.Empty: except Queue.Empty:
pass pass
......
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