self._comm.sendCommand(line[1])
elif line[0] == 'START':
self._comm.printGCode(self._gcodeList)
+ elif line[0] == 'PAUSE':
+ self._comm.setPause(True)
+ elif line[0] == 'RESUME':
+ self._comm.setPause(False)
else:
sys.stderr.write(str(line))
#Abort the previously loaded print file
def cancelPrint(self):
- if not self.isPrinting()or self._process is None:
+ if not self.isPrinting() or self._process is None:
return
self._process.stdin.write('STOP\n')
self._printProgress = 0
def isPrinting(self):
- return self._commState == machineCom.MachineCom.STATE_PRINTING
+ return self._commState == machineCom.MachineCom.STATE_PRINTING or self.isPaused()
+
+ #Returns true if we have the ability to pause the file printing.
+ def hasPause(self):
+ return True
+
+ def isPaused(self):
+ return self._commState == machineCom.MachineCom.STATE_PAUSED
+
+ #Pause or unpause the printing depending on the value, if supported.
+ def pause(self, value):
+ if not self.isPrinting() or self._process is None:
+ return
+ self._process.stdin.write('PAUSE\n' if value else "RESUME\n")
#Amount of progression of the current print file. 0.0 to 1.0
def getPrintProgress(self):