diff --git a/src/octoprint/printer.py b/src/octoprint/printer.py index f2582382..f4a5a6bb 100644 --- a/src/octoprint/printer.py +++ b/src/octoprint/printer.py @@ -67,7 +67,6 @@ class Printer(): self._sdPrinting = False self._sdStreaming = False self._sdFilelistAvailable = threading.Event() - self._sdRemoteName = None self._streamingFinishedCallback = None self._selectedFile = None @@ -431,9 +430,6 @@ class Printer(): "sdReady": self.isSdReady() } - def getCurrentData(self): - return self._stateMonitor.getCurrentData() - #~~ callbacks triggered from self._comm def mcLog(self, message): @@ -520,9 +516,10 @@ class Printer(): self._sdStreaming = False if self._streamingFinishedCallback is not None: - self._streamingFinishedCallback(self._sdRemoteName, FileDestinations.SDCARD) + # in case of SD files, both filename and absolutePath are the same, so we set the (remote) filename for + # both parameters + self._streamingFinishedCallback(filename, filename, FileDestinations.SDCARD) - self._sdRemoteName = None self._setCurrentZ(None) self._setJobData(None, None, None) self._setProgressData(None, None, None, None) @@ -657,9 +654,6 @@ class Printer(): else: return self._comm.isSdReady() - def isLoading(self): - return self._gcodeLoader is not None - class StateMonitor(object): def __init__(self, ratelimit, updateCallback, addTemperatureCallback, addLogCallback, addMessageCallback): self._ratelimit = ratelimit diff --git a/src/octoprint/server/api/files.py b/src/octoprint/server/api/files.py index 0def0349..258ff950 100644 --- a/src/octoprint/server/api/files.py +++ b/src/octoprint/server/api/files.py @@ -126,8 +126,6 @@ def uploadGcodeFile(target): if futureFilename == currentFilename and target == currentOrigin and printer.isPrinting() or printer.isPaused(): return make_response("Trying to overwrite file that is currently being printed: %s" % currentFilename, 409) - filename = None - def fileProcessingFinished(filename, absFilename, destination): """ Callback for when the file processing (upload, optional slicing, addition to analysis queue) has @@ -138,10 +136,10 @@ def uploadGcodeFile(target): if destination == FileDestinations.SDCARD: return filename, printer.addSdFile(filename, absFilename, selectAndOrPrint) else: - selectAndOrPrint(absFilename, destination) + selectAndOrPrint(filename, absFilename, destination) return filename - def selectAndOrPrint(nameToSelect, destination): + def selectAndOrPrint(filename, absFilename, destination): """ Callback for when the file is ready to be selected and optionally printed. For SD file uploads this is only the case after they have finished streaming to the printer, which is why this callback is also used @@ -151,7 +149,7 @@ def uploadGcodeFile(target): exact file is already selected, such reloading it. """ if selectAfterUpload or printAfterSelect or (currentFilename == filename and currentOrigin == destination): - printer.selectFile(nameToSelect, destination == FileDestinations.SDCARD, printAfterSelect) + printer.selectFile(absFilename, destination == FileDestinations.SDCARD, printAfterSelect) filename, done = gcodeManager.addFile(file, target, fileProcessingFinished) if filename is None: diff --git a/src/octoprint/util/comm.py b/src/octoprint/util/comm.py index 736bb06d..36e81fef 100644 --- a/src/octoprint/util/comm.py +++ b/src/octoprint/util/comm.py @@ -1017,16 +1017,16 @@ class MachineCom(object): if self.isStreaming(): self._sendCommand("M29") - filename = self._currentFile.getFilename() + remote = self._currentFile.getRemoteFilename() payload = { "local": self._currentFile.getLocalFilename(), - "remote": self._currentFile.getRemoteFilename(), + "remote": remote, "time": self.getPrintTime() } self._currentFile = None self._changeState(self.STATE_OPERATIONAL) - self._callback.mcFileTransferDone(filename) + self._callback.mcFileTransferDone(remote) eventManager().fire(Events.TRANSFER_DONE, payload) self.refreshSdFiles() else: