Commit 4b5456e1 authored by Guillaume Seguin's avatar Guillaume Seguin

Print message after a successful injection

parent c2072b38
......@@ -246,6 +246,7 @@ class GCode(object):
# Update indices arrays & global gcodes list
self.layer_idxs.insert(end_index + i, layer_idx)
self.line_idxs.insert(end_index + i, end_line + i + 1)
return commands[::-1]
def append(self, command, store = True):
command = command.strip()
......
......@@ -15,12 +15,16 @@
from .gui.widgets import MacroEditor
from .utils import install_locale
install_locale('pronterface')
def injector(gcode, viz_layer, layer_idx):
cb = lambda toadd: inject(gcode, layer_idx, toadd)
cb = lambda toadd: inject(gcode, viz_layer, layer_idx, toadd)
z = gcode.all_layers[layer_idx].z
z = z if z is not None else 0
MacroEditor(_("Inject G-Code at layer %d (Z = %.03f)") % (viz_layer, z), "", cb, True)
def inject(gcode, layer_idx, toadd):
# TODO: save modifier gcode after injection ?
gcode.prepend_to_layer(toadd, layer_idx)
def inject(gcode, viz_layer, layer_idx, toadd):
# TODO: save modified gcode after injection ?
nlines = len(gcode.prepend_to_layer(toadd, layer_idx))
print _("Successfully injected %d lines at beginning of layer %d") % (nlines, viz_layer)
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