From fa57f160dccd43910be53b8cb5d56865e55ce5fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Wed, 13 May 2015 14:00:12 +0200 Subject: [PATCH] Log cancelled prints only once Thanks to @imrahil for the headsup --- CHANGELOG.md | 1 + src/octoprint/printer/standard.py | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f7c0635..1a444e79 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)) diff --git a/src/octoprint/printer/standard.py b/src/octoprint/printer/standard.py index 3991c6a5..a652e6e7 100644 --- a/src/octoprint/printer/standard.py +++ b/src/octoprint/printer/standard.py @@ -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()})