Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGhostkeeper <rubend@tutanota.com>2018-03-16 16:05:40 +0300
committerGhostkeeper <rubend@tutanota.com>2018-03-16 16:54:48 +0300
commite74191f2dbb814eab228060c5e867a9634edceac (patch)
tree0606c90178e8a2a5f5274cdbb92cec10acef7372 /plugins/RemovableDriveOutputDevice
parentee4a6dc704ed0021812bad7c7c3de7ad06dd8499 (diff)
Cache preferred format
I think that makes the code a bit easier to read. This is not really done to make it faster, just more semantic. Contributes to issue CURA-5097.
Diffstat (limited to 'plugins/RemovableDriveOutputDevice')
-rw-r--r--plugins/RemovableDriveOutputDevice/RemovableDriveOutputDevice.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/plugins/RemovableDriveOutputDevice/RemovableDriveOutputDevice.py b/plugins/RemovableDriveOutputDevice/RemovableDriveOutputDevice.py
index e719ba3286..184b6b8a20 100644
--- a/plugins/RemovableDriveOutputDevice/RemovableDriveOutputDevice.py
+++ b/plugins/RemovableDriveOutputDevice/RemovableDriveOutputDevice.py
@@ -62,14 +62,15 @@ class RemovableDriveOutputDevice(OutputDevice):
if len(file_formats) == 0:
Logger.log("e", "There are no file formats available to write with!")
raise OutputDeviceError.WriteRequestFailedError(catalog.i18nc("@info:status", "There are no file formats available to write with!"))
+ preferred_format = file_formats[0]
# Just take the first file format available.
if file_handler is not None:
- writer = file_handler.getWriterByMimeType(file_formats[0]["mime_type"])
+ writer = file_handler.getWriterByMimeType(preferred_format["mime_type"])
else:
- writer = Application.getInstance().getMeshFileHandler().getWriterByMimeType(file_formats[0]["mime_type"])
+ writer = Application.getInstance().getMeshFileHandler().getWriterByMimeType(preferred_format["mime_type"])
- extension = file_formats[0]["extension"]
+ extension = preferred_format["extension"]
if file_name is None:
file_name = self._automaticFileName(nodes)