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>2020-03-30 15:00:36 +0300
committerGhostkeeper <rubend@tutanota.com>2020-03-30 15:00:36 +0300
commitf34edd6bec27c0c28c3102bf81b966b741c6aa4f (patch)
tree729bd43bf8616c5339db59cb0a945b8bf312dcdf /plugins/3MFWriter
parentbe85e6d75e7fa8f118a5da37a56d52af800e6f6d (diff)
Show error when we don't have permission to write workspace
Fixes several Sentry issues, among which Cura-EG.
Diffstat (limited to 'plugins/3MFWriter')
-rw-r--r--plugins/3MFWriter/ThreeMFWorkspaceWriter.py29
1 files changed, 19 insertions, 10 deletions
diff --git a/plugins/3MFWriter/ThreeMFWorkspaceWriter.py b/plugins/3MFWriter/ThreeMFWorkspaceWriter.py
index 6c7a82a588..4b6b978342 100644
--- a/plugins/3MFWriter/ThreeMFWorkspaceWriter.py
+++ b/plugins/3MFWriter/ThreeMFWorkspaceWriter.py
@@ -10,6 +10,8 @@ from UM.Logger import Logger
from UM.Preferences import Preferences
from UM.Settings.ContainerRegistry import ContainerRegistry
from UM.Workspace.WorkspaceWriter import WorkspaceWriter
+from UM.i18n import i18nCatalog
+catalog = i18nCatalog("cura")
from cura.Utils.Threading import call_on_qt_thread
@@ -26,6 +28,7 @@ class ThreeMFWorkspaceWriter(WorkspaceWriter):
mesh_writer = application.getMeshFileHandler().getWriter("3MFWriter")
if not mesh_writer: # We need to have the 3mf mesh writer, otherwise we can't save the entire workspace
+ self.setInformation(catalog.i18nc("@error:zip", "3MF Writer plug-in is corrupt."))
Logger.error("3MF Writer class is unavailable. Can't write workspace.")
return False
@@ -39,19 +42,24 @@ class ThreeMFWorkspaceWriter(WorkspaceWriter):
global_stack = machine_manager.activeMachine
- # Add global container stack data to the archive.
- self._writeContainerToArchive(global_stack, archive)
-
- # Also write all containers in the stack to the file
- for container in global_stack.getContainers():
- self._writeContainerToArchive(container, archive)
+ try:
+ # Add global container stack data to the archive.
+ self._writeContainerToArchive(global_stack, archive)
- # Check if the machine has extruders and save all that data as well.
- for extruder_stack in global_stack.extruders.values():
- self._writeContainerToArchive(extruder_stack, archive)
- for container in extruder_stack.getContainers():
+ # Also write all containers in the stack to the file
+ for container in global_stack.getContainers():
self._writeContainerToArchive(container, archive)
+ # Check if the machine has extruders and save all that data as well.
+ for extruder_stack in global_stack.extruders.values():
+ self._writeContainerToArchive(extruder_stack, archive)
+ for container in extruder_stack.getContainers():
+ self._writeContainerToArchive(container, archive)
+ except PermissionError:
+ self.setInformation(catalog.i18nc("@error:zip", "No permission to write the workspace here."))
+ Logger.error("No permission to write workspace to this stream.")
+ return False
+
# Write preferences to archive
original_preferences = Application.getInstance().getPreferences() #Copy only the preferences that we use to the workspace.
temp_preferences = Preferences()
@@ -81,6 +89,7 @@ class ThreeMFWorkspaceWriter(WorkspaceWriter):
# Close the archive & reset states.
archive.close()
except PermissionError:
+ self.setInformation(catalog.i18nc("@error:zip", "No permission to write the workspace here."))
Logger.error("No permission to write workspace to this stream.")
return False
mesh_writer.setStoreArchive(False)