added multipass placeholder functions

This commit is contained in:
make-ing 2016-03-02 15:48:52 +01:00
parent 73749fbb19
commit 9c822b7e93
4 changed files with 36 additions and 1 deletions

View file

@ -433,6 +433,22 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
payload["origin"] = FileDestinations.SDCARD payload["origin"] = FileDestinations.SDCARD
eventManager().fire(Events.PRINT_FAILED, payload) eventManager().fire(Events.PRINT_FAILED, payload)
def increase_passes(self):
"""
increase the number of passes by one.
"""
if self._comm is None:
return
self._comm.increasePasses()
def degrease_passes(self):
"""
degrease the number of passes by one.
"""
if self._comm is None:
return
self._comm.degreasePasses()
def get_state_string(self): def get_state_string(self):
""" """
Returns a human readable string corresponding to the current communication state. Returns a human readable string corresponding to the current communication state.

View file

@ -23,7 +23,9 @@ def controlJob():
"start": [], "start": [],
"restart": [], "restart": [],
"pause": [], "pause": [],
"cancel": [] "cancel": [],
"incpasses": [],
"degpasses": []
} }
command, data, response = get_json_command_from_request(request, valid_commands) command, data, response = get_json_command_from_request(request, valid_commands)
@ -48,6 +50,15 @@ def controlJob():
if not activePrintjob: if not activePrintjob:
return make_response("Printer is neither printing nor paused, 'cancel' command cannot be performed", 409) return make_response("Printer is neither printing nor paused, 'cancel' command cannot be performed", 409)
printer.cancel_print() printer.cancel_print()
elif command == "incpasses":
if not activePrintjob:
return make_response("Printer is neither printing nor paused, 'incpasses' command cannot be performed", 409)
printer.increase_passes()
elif command == "degpasses":
if not activePrintjob:
return make_response("Printer is neither printing nor paused, 'degpasses' command cannot be performed", 409)
printer.degrease_passes()
return NO_CONTENT return NO_CONTENT

View file

@ -332,10 +332,12 @@ $(function() {
self.increasePasses = function(){ self.increasePasses = function(){
self.numberOfPasses(self.numberOfPasses()+1); self.numberOfPasses(self.numberOfPasses()+1);
self._jobCommand("incpasses");
} }
self.decreasePasses = function(){ self.decreasePasses = function(){
var passes = Math.max(self.numberOfPasses()-1, 1); var passes = Math.max(self.numberOfPasses()-1, 1);
self.numberOfPasses(passes); self.numberOfPasses(passes);
self._jobCommand("degpasses");
} }
self.onEventPrintDone = function(){ self.onEventPrintDone = function(){

View file

@ -893,6 +893,12 @@ class MachineCom(object):
self._send_event.set() self._send_event.set()
eventManager().fire(Events.PRINT_PAUSED, payload) eventManager().fire(Events.PRINT_PAUSED, payload)
def increasePasses(self):
self._log("increase Passes")
def degreasePasses(self):
self._log("degrease Passes")
def getStateString(self): def getStateString(self):
if self._state == self.STATE_NONE: if self._state == self.STATE_NONE:
return "Offline" return "Offline"