mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 07:33:57 -06:00
Merge branch '3.0'
This commit is contained in:
commit
052b4b0b11
2 changed files with 32 additions and 25 deletions
|
@ -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.Workspace.WorkspaceWriter import WorkspaceWriter
|
||||||
from UM.Application import Application
|
from UM.Application import Application
|
||||||
from UM.Preferences import Preferences
|
from UM.Preferences import Preferences
|
||||||
|
@ -42,9 +45,14 @@ class ThreeMFWorkspaceWriter(WorkspaceWriter):
|
||||||
self._writeContainerToArchive(container, archive)
|
self._writeContainerToArchive(container, archive)
|
||||||
|
|
||||||
# Write preferences to 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_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())
|
archive.writestr(preferences_file, preferences_string.getvalue())
|
||||||
|
|
||||||
# Save Cura version
|
# Save Cura version
|
||||||
|
|
|
@ -47,7 +47,7 @@ class ProcessSlicedLayersJob(Job):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self._layers = layers
|
self._layers = layers
|
||||||
self._scene = Application.getInstance().getController().getScene()
|
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
|
self._abort_requested = False
|
||||||
|
|
||||||
## Aborts the processing of layers.
|
## Aborts the processing of layers.
|
||||||
|
@ -62,12 +62,11 @@ class ProcessSlicedLayersJob(Job):
|
||||||
def run(self):
|
def run(self):
|
||||||
start_time = time()
|
start_time = time()
|
||||||
if Application.getInstance().getController().getActiveView().getPluginId() == "LayerView":
|
if Application.getInstance().getController().getActiveView().getPluginId() == "LayerView":
|
||||||
self._progress = Message(catalog.i18nc("@info:status", "Processing Layers"), 0, False, -1)
|
self._progress_message.show()
|
||||||
self._progress.show()
|
|
||||||
Job.yieldThread()
|
Job.yieldThread()
|
||||||
if self._abort_requested:
|
if self._abort_requested:
|
||||||
if self._progress:
|
if self._progress_message:
|
||||||
self._progress.hide()
|
self._progress_message.hide()
|
||||||
return
|
return
|
||||||
|
|
||||||
Application.getInstance().getController().activeViewChanged.connect(self._onActiveViewChanged)
|
Application.getInstance().getController().activeViewChanged.connect(self._onActiveViewChanged)
|
||||||
|
@ -80,8 +79,8 @@ class ProcessSlicedLayersJob(Job):
|
||||||
node.getParent().removeChild(node)
|
node.getParent().removeChild(node)
|
||||||
break
|
break
|
||||||
if self._abort_requested:
|
if self._abort_requested:
|
||||||
if self._progress:
|
if self._progress_message:
|
||||||
self._progress.hide()
|
self._progress_message.hide()
|
||||||
return
|
return
|
||||||
|
|
||||||
# Force garbage collection.
|
# 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.
|
# 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._abort_requested:
|
||||||
if self._progress:
|
if self._progress_message:
|
||||||
self._progress.hide()
|
self._progress_message.hide()
|
||||||
return
|
return
|
||||||
if self._progress:
|
if self._progress_message:
|
||||||
self._progress.setProgress(progress)
|
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
|
# 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)
|
layer_mesh = layer_data.build(material_color_map, line_type_brightness)
|
||||||
|
|
||||||
if self._abort_requested:
|
if self._abort_requested:
|
||||||
if self._progress:
|
if self._progress_message:
|
||||||
self._progress.hide()
|
self._progress_message.hide()
|
||||||
return
|
return
|
||||||
|
|
||||||
# Add LayerDataDecorator to scene node to indicate that the node has layer data
|
# 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"):
|
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))
|
new_node.setPosition(Vector(-settings.getProperty("machine_width", "value") / 2, 0.0, settings.getProperty("machine_depth", "value") / 2))
|
||||||
|
|
||||||
if self._progress:
|
if self._progress_message:
|
||||||
self._progress.setProgress(100)
|
self._progress_message.setProgress(100)
|
||||||
|
|
||||||
view = Application.getInstance().getController().getActiveView()
|
view = Application.getInstance().getController().getActiveView()
|
||||||
if view.getPluginId() == "LayerView":
|
if view.getPluginId() == "LayerView":
|
||||||
view.resetLayerData()
|
view.resetLayerData()
|
||||||
|
|
||||||
if self._progress:
|
if self._progress_message:
|
||||||
self._progress.hide()
|
self._progress_message.hide()
|
||||||
|
|
||||||
# Clear the unparsed layers. This saves us a bunch of memory if the Job does not get destroyed.
|
# Clear the unparsed layers. This saves us a bunch of memory if the Job does not get destroyed.
|
||||||
self._layers = None
|
self._layers = None
|
||||||
|
@ -234,10 +233,10 @@ class ProcessSlicedLayersJob(Job):
|
||||||
def _onActiveViewChanged(self):
|
def _onActiveViewChanged(self):
|
||||||
if self.isRunning():
|
if self.isRunning():
|
||||||
if Application.getInstance().getController().getActiveView().getPluginId() == "LayerView":
|
if Application.getInstance().getController().getActiveView().getPluginId() == "LayerView":
|
||||||
if not self._progress:
|
if not self._progress_message:
|
||||||
self._progress = Message(catalog.i18nc("@info:status", "Processing Layers"), 0, False, 0, catalog.i18nc("@info:title", "Information"))
|
self._progress_message = Message(catalog.i18nc("@info:status", "Processing Layers"), 0, False, 0, catalog.i18nc("@info:title", "Information"))
|
||||||
if self._progress.getProgress() != 100:
|
if self._progress_message.getProgress() != 100:
|
||||||
self._progress.show()
|
self._progress_message.show()
|
||||||
else:
|
else:
|
||||||
if self._progress:
|
if self._progress_message:
|
||||||
self._progress.hide()
|
self._progress_message.hide()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue