Log cancelled prints only once

Thanks to @imrahil for the headsup
This commit is contained in:
Gina Häußge 2015-05-13 14:00:12 +02:00
parent 45cda586d2
commit fa57f160dc
2 changed files with 3 additions and 3 deletions

View file

@ -198,6 +198,7 @@
* Made initial connection to printer a bit more responsive: Having to wait for the first serial timeout before sending
the first ``M105`` even when not waiting for seeing a "start" caused unnecessary wait times for reaching the
"Operational" state.
* Log cancelled prints only once (thanks to @imrahil for the headsup)
([Commits](https://github.com/foosel/OctoPrint/compare/master...devel))

View file

@ -762,9 +762,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
# forward relevant state changes to gcode manager
if oldState == comm.MachineCom.STATE_PRINTING:
if self._selectedFile is not None:
if state == comm.MachineCom.STATE_OPERATIONAL:
self._fileManager.log_print(FileDestinations.SDCARD if self._selectedFile["sd"] else FileDestinations.LOCAL, self._selectedFile["filename"], time.time(), self._comm.getPrintTime(), True, self._printerProfileManager.get_current_or_default()["id"])
elif state == comm.MachineCom.STATE_CLOSED or state == comm.MachineCom.STATE_ERROR or state == comm.MachineCom.STATE_CLOSED_WITH_ERROR:
if state == comm.MachineCom.STATE_CLOSED or state == comm.MachineCom.STATE_ERROR or state == comm.MachineCom.STATE_CLOSED_WITH_ERROR:
self._fileManager.log_print(FileDestinations.SDCARD if self._selectedFile["sd"] else FileDestinations.LOCAL, self._selectedFile["filename"], time.time(), self._comm.getPrintTime(), False, self._printerProfileManager.get_current_or_default()["id"])
self._analysisQueue.resume() # printing done, put those cpu cycles to good use
elif state == comm.MachineCom.STATE_PRINTING:
@ -821,6 +819,7 @@ class Printer(PrinterInterface, comm.MachineComPrintCallback):
self.start_print()
def on_comm_print_job_done(self):
self._fileManager.log_print(FileDestinations.SDCARD if self._selectedFile["sd"] else FileDestinations.LOCAL, self._selectedFile["filename"], time.time(), self._comm.getPrintTime(), True, self._printerProfileManager.get_current_or_default()["id"])
self._setProgressData(1.0, self._selectedFile["filesize"], self._comm.getPrintTime(), 0)
self._stateMonitor.set_state({"text": self.get_state_string(), "flags": self._getStateFlags()})