diff --git a/plugins/3MFWriter/ThreeMFWorkspaceWriter.py b/plugins/3MFWriter/ThreeMFWorkspaceWriter.py index 0a915d610e..aaa590cbaf 100644 --- a/plugins/3MFWriter/ThreeMFWorkspaceWriter.py +++ b/plugins/3MFWriter/ThreeMFWorkspaceWriter.py @@ -1,3 +1,6 @@ +# Copyright (c) 2017 Ultimaker B.V. +# Cura is released under the terms of the AGPLv3 or higher. + from UM.Workspace.WorkspaceWriter import WorkspaceWriter from UM.Application import Application from UM.Preferences import Preferences @@ -42,9 +45,14 @@ class ThreeMFWorkspaceWriter(WorkspaceWriter): self._writeContainerToArchive(container, archive) # Write preferences to archive - preferences_file = zipfile.ZipInfo("Cura/preferences.cfg") + original_preferences = Preferences.getInstance() #Copy only the preferences that we use to the workspace. + temp_preferences = Preferences() + for preference in {"general/visible_settings", "cura/active_mode", "cura/categories_expanded"}: + temp_preferences.addPreference(preference, None) + temp_preferences.setValue(preference, original_preferences.getValue(preference)) preferences_string = StringIO() - Preferences.getInstance().writeToFile(preferences_string) + temp_preferences.writeToFile(preferences_string) + preferences_file = zipfile.ZipInfo("Cura/preferences.cfg") archive.writestr(preferences_file, preferences_string.getvalue()) # Save Cura version diff --git a/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py b/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py index 1fbe50873e..302abc330a 100644 --- a/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py +++ b/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py @@ -47,7 +47,7 @@ class ProcessSlicedLayersJob(Job): super().__init__() self._layers = layers self._scene = Application.getInstance().getController().getScene() - self._progress = None + self._progress_message = Message(catalog.i18nc("@info:status", "Processing Layers"), 0, False, -1) self._abort_requested = False ## Aborts the processing of layers. @@ -62,12 +62,11 @@ class ProcessSlicedLayersJob(Job): def run(self): start_time = time() if Application.getInstance().getController().getActiveView().getPluginId() == "LayerView": - self._progress = Message(catalog.i18nc("@info:status", "Processing Layers"), 0, False, -1) - self._progress.show() + self._progress_message.show() Job.yieldThread() if self._abort_requested: - if self._progress: - self._progress.hide() + if self._progress_message: + self._progress_message.hide() return Application.getInstance().getController().activeViewChanged.connect(self._onActiveViewChanged) @@ -80,8 +79,8 @@ class ProcessSlicedLayersJob(Job): node.getParent().removeChild(node) break if self._abort_requested: - if self._progress: - self._progress.hide() + if self._progress_message: + self._progress_message.hide() return # Force garbage collection. @@ -159,11 +158,11 @@ class ProcessSlicedLayersJob(Job): # This needs some work in LayerData so we can add the new layers instead of recreating the entire mesh. if self._abort_requested: - if self._progress: - self._progress.hide() + if self._progress_message: + self._progress_message.hide() return - if self._progress: - self._progress.setProgress(progress) + if self._progress_message: + self._progress_message.setProgress(progress) # We are done processing all the layers we got from the engine, now create a mesh out of the data @@ -197,8 +196,8 @@ class ProcessSlicedLayersJob(Job): layer_mesh = layer_data.build(material_color_map, line_type_brightness) if self._abort_requested: - if self._progress: - self._progress.hide() + if self._progress_message: + self._progress_message.hide() return # Add LayerDataDecorator to scene node to indicate that the node has layer data @@ -216,15 +215,15 @@ class ProcessSlicedLayersJob(Job): if not settings.getProperty("machine_center_is_zero", "value"): new_node.setPosition(Vector(-settings.getProperty("machine_width", "value") / 2, 0.0, settings.getProperty("machine_depth", "value") / 2)) - if self._progress: - self._progress.setProgress(100) + if self._progress_message: + self._progress_message.setProgress(100) view = Application.getInstance().getController().getActiveView() if view.getPluginId() == "LayerView": view.resetLayerData() - if self._progress: - self._progress.hide() + if self._progress_message: + self._progress_message.hide() # Clear the unparsed layers. This saves us a bunch of memory if the Job does not get destroyed. self._layers = None @@ -234,10 +233,10 @@ class ProcessSlicedLayersJob(Job): def _onActiveViewChanged(self): if self.isRunning(): if Application.getInstance().getController().getActiveView().getPluginId() == "LayerView": - if not self._progress: - self._progress = Message(catalog.i18nc("@info:status", "Processing Layers"), 0, False, 0, catalog.i18nc("@info:title", "Information")) - if self._progress.getProgress() != 100: - self._progress.show() + if not self._progress_message: + self._progress_message = Message(catalog.i18nc("@info:status", "Processing Layers"), 0, False, 0, catalog.i18nc("@info:title", "Information")) + if self._progress_message.getProgress() != 100: + self._progress_message.show() else: - if self._progress: - self._progress.hide() + if self._progress_message: + self._progress_message.hide()