diff options
author | Ghostkeeper <rubend@tutanota.com> | 2018-03-16 16:05:40 +0300 |
---|---|---|
committer | Ghostkeeper <rubend@tutanota.com> | 2018-03-16 16:54:48 +0300 |
commit | e74191f2dbb814eab228060c5e867a9634edceac (patch) | |
tree | 0606c90178e8a2a5f5274cdbb92cec10acef7372 /plugins/RemovableDriveOutputDevice | |
parent | ee4a6dc704ed0021812bad7c7c3de7ad06dd8499 (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.py | 7 |
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) |