From 81464d65b76244b7b8aa9dd9b0f71930b62f6581 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Sat, 29 Jun 2013 23:48:27 +0200 Subject: [PATCH] Some more cleanups --- octoprint/printer.py | 11 ++--------- octoprint/util/comm.py | 4 +++- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/octoprint/printer.py b/octoprint/printer.py index 3fa871d..bb2f131 100644 --- a/octoprint/printer.py +++ b/octoprint/printer.py @@ -70,10 +70,6 @@ class Printer(): self._sdPrinting = False self._sdStreaming = False - # TODO Still needed? - self._sdFile = None - self._sdStreamer = None - self._selectedFile = None # comm @@ -437,7 +433,7 @@ class Printer(): def mcReceivedRegisteredMessage(self, command, output): self._sendFeedbackCommandOutput(command, output) -#~~ sd file handling + #~~ sd file handling def getSdFiles(self): if self._comm is None: @@ -452,9 +448,6 @@ class Printer(): def deleteSdFile(self, filename): if not self._comm: return - - if self._sdFile == filename: - self._sdFile = None self._comm.deleteSdFile(filename) def initSdCard(self): @@ -517,7 +510,7 @@ class Printer(): return self.isOperational() and not self._comm.isStreaming() def isLoading(self): - return self._gcodeLoader is not None or self._sdStreamer is not None + return self._gcodeLoader is not None class GcodeLoader(threading.Thread): """ diff --git a/octoprint/util/comm.py b/octoprint/util/comm.py index 367bd4f..4ff25aa 100644 --- a/octoprint/util/comm.py +++ b/octoprint/util/comm.py @@ -404,7 +404,9 @@ class MachineCom(object): self.refreshSdFiles() def deleteSdFile(self, filename): - if not self.isOperational() or (self.isBusy() and self._sdFile == filename.lower()): + if not self.isOperational() or (self.isBusy() and + isinstance(self._currentFile, PrintingSdFileInformation) and + self._currentFile.getFilename() == filename): # do not delete a file from sd we are currently printing from return