Commit fee5b5b9 authored by Paul Telford's avatar Paul Telford

Adds support for running an executable when print is finished.

parent d731aaf9
...@@ -201,6 +201,7 @@ class Settings: ...@@ -201,6 +201,7 @@ class Settings:
self.e_feedrate = 300 self.e_feedrate = 300
self.slicecommand="python skeinforge/skeinforge_application/skeinforge_utilities/skeinforge_craft.py $s" self.slicecommand="python skeinforge/skeinforge_application/skeinforge_utilities/skeinforge_craft.py $s"
self.sliceoptscommand="python skeinforge/skeinforge_application/skeinforge.py" self.sliceoptscommand="python skeinforge/skeinforge_application/skeinforge.py"
self.final_command = ""
def _set(self,key,value): def _set(self,key,value):
try: try:
...@@ -274,6 +275,7 @@ class pronsole(cmd.Cmd): ...@@ -274,6 +275,7 @@ class pronsole(cmd.Cmd):
self.helpdict["temperature_pla"] = _("Extruder temp for PLA (default: 185 deg C)") self.helpdict["temperature_pla"] = _("Extruder temp for PLA (default: 185 deg C)")
self.helpdict["xy_feedrate"] = _("Feedrate for Control Panel Moves in X and Y (default: 3000mm/min)") self.helpdict["xy_feedrate"] = _("Feedrate for Control Panel Moves in X and Y (default: 3000mm/min)")
self.helpdict["z_feedrate"] = _("Feedrate for Control Panel Moves in Z (default: 200mm/min)") self.helpdict["z_feedrate"] = _("Feedrate for Control Panel Moves in Z (default: 200mm/min)")
self.helpdict["final_command"] = _("Executable to run when the print is finished")
self.commandprefixes='MGT$' self.commandprefixes='MGT$'
def set_temp_preset(self,key,value): def set_temp_preset(self,key,value):
......
...@@ -165,6 +165,10 @@ class PronterWindow(wx.Frame,pronsole.pronsole): ...@@ -165,6 +165,10 @@ class PronterWindow(wx.Frame,pronsole.pronsole):
wx.CallAfter(self.pausebtn.Disable) wx.CallAfter(self.pausebtn.Disable)
wx.CallAfter(self.printbtn.SetLabel,_("Print")) wx.CallAfter(self.printbtn.SetLabel,_("Print"))
import shlex
param = self.settings.final_command
pararray=[i.replace("$s",str(self.filename)).replace("$t", str(time.strftime('%H:%M:%S', time.gmtime(int(time.time()-self.starttime+self.extra_print_time))))).encode() for i in shlex.split(param.replace("\\","\\\\").encode())]
self.finalp=subprocess.Popen(pararray,stderr=subprocess.STDOUT,stdout=subprocess.PIPE)
def online(self): def online(self):
print _("Printer is now online.") print _("Printer is now online.")
......
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