Commit c8ed2fb3 authored by Guillaume Seguin's avatar Guillaume Seguin

Start refactoring of excluder logic

parent 46c2805d
...@@ -407,18 +407,24 @@ class PronterWindow(MainWindow, pronsole.pronsole): ...@@ -407,18 +407,24 @@ class PronterWindow(MainWindow, pronsole.pronsole):
return return
self.sentlines.put_nowait(line) self.sentlines.put_nowait(line)
def preprintsendcb(self, gline): def is_excluded_move(self, gline):
if not gline.is_move or not self.excluder or not self.excluder.rectangles: if not gline.is_move or not self.excluder or not self.excluder.rectangles:
return gline return False
if gline.x == None and gline.y == None: if gline.x == None and gline.y == None:
return gline return False
for (x0, y0, x1, y1) in self.excluder.rectangles: for (x0, y0, x1, y1) in self.excluder.rectangles:
if x0 <= gline.current_x <= x1 and y0 <= gline.current_y <= y1: if x0 <= gline.current_x <= x1 and y0 <= gline.current_y <= y1:
if gline.e != None and not gline.relative_e: return True
return gcoder.Line("G92 E%.5f" % gline.e) return False
else:
return None def preprintsendcb(self, gline):
return gline if self.is_excluded_move(gline):
if gline.e != None and not gline.relative_e:
return gcoder.Line("G92 E%.5f" % gline.e)
else:
return None
else:
return gline
def printsentcb(self, gline): def printsentcb(self, gline):
if gline.is_move and hasattr(self.gwindow, "set_current_gline"): if gline.is_move and hasattr(self.gwindow, "set_current_gline"):
......
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