From 15a870c050b3d45151d30147608f868811114481 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Tue, 11 Oct 2016 13:39:44 +0200 Subject: [PATCH] Add some documentation CURA-2544 --- .../RemovableDriveOutputDevice/RemovableDriveOutputDevice.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/RemovableDriveOutputDevice/RemovableDriveOutputDevice.py b/plugins/RemovableDriveOutputDevice/RemovableDriveOutputDevice.py index b7d31e68f8..8b6dce8292 100644 --- a/plugins/RemovableDriveOutputDevice/RemovableDriveOutputDevice.py +++ b/plugins/RemovableDriveOutputDevice/RemovableDriveOutputDevice.py @@ -66,6 +66,7 @@ class RemovableDriveOutputDevice(OutputDevice): try: Logger.log("d", "Writing to %s", file_name) + # Using buffering greatly reduces the write time for many lines of gcode self._stream = open(file_name, "wt", buffering = 1) job = WriteMeshJob(writer, self._stream, node, MeshWriter.OutputMode.TextMode) job.setFileName(file_name) @@ -94,6 +95,7 @@ class RemovableDriveOutputDevice(OutputDevice): def _onFinished(self, job): if self._stream: + # Explicitly closing the stream flushes the write-buffer self._stream.close() self._stream = None